Add Repo: steveicarus_ivtest (part 8)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- steveicarus_ivtest/ivltests/vhdl_and23_bit.vhd +15 -0
- steveicarus_ivtest/ivltests/vhdl_and_gate.v +46 -0
- steveicarus_ivtest/ivltests/vhdl_and_gate.vhd +16 -0
- steveicarus_ivtest/ivltests/vhdl_andg_bit.v +57 -0
- steveicarus_ivtest/ivltests/vhdl_andg_bit.vhd +16 -0
- steveicarus_ivtest/ivltests/vhdl_andg_stdlogic.v +89 -0
- steveicarus_ivtest/ivltests/vhdl_andg_stdlogic.vhd +16 -0
- steveicarus_ivtest/ivltests/vhdl_array_of_array.v +35 -0
- steveicarus_ivtest/ivltests/vhdl_array_of_array.vhd +35 -0
- steveicarus_ivtest/ivltests/vhdl_boolean.v +93 -0
- steveicarus_ivtest/ivltests/vhdl_boolean.vhd +43 -0
- steveicarus_ivtest/ivltests/vhdl_case_multi.v +45 -0
- steveicarus_ivtest/ivltests/vhdl_case_multi.vhd +41 -0
- steveicarus_ivtest/ivltests/vhdl_concat.v +42 -0
- steveicarus_ivtest/ivltests/vhdl_concat.vhd +34 -0
- steveicarus_ivtest/ivltests/vhdl_concat_func.v +38 -0
- steveicarus_ivtest/ivltests/vhdl_concat_func.vhd +41 -0
- steveicarus_ivtest/ivltests/vhdl_concurrent_assert.v +25 -0
- steveicarus_ivtest/ivltests/vhdl_concurrent_assert.vhd +37 -0
- steveicarus_ivtest/ivltests/vhdl_const_array.v +72 -0
- steveicarus_ivtest/ivltests/vhdl_const_array.vhd +59 -0
- steveicarus_ivtest/ivltests/vhdl_const_array_pkg.vhd +36 -0
- steveicarus_ivtest/ivltests/vhdl_const_package.v +40 -0
- steveicarus_ivtest/ivltests/vhdl_const_package.vhd +35 -0
- steveicarus_ivtest/ivltests/vhdl_const_package_pkg.vhd +32 -0
- steveicarus_ivtest/ivltests/vhdl_const_record.v +70 -0
- steveicarus_ivtest/ivltests/vhdl_const_record.vhd +75 -0
- steveicarus_ivtest/ivltests/vhdl_delay_assign.v +59 -0
- steveicarus_ivtest/ivltests/vhdl_delay_assign.vhd +38 -0
- steveicarus_ivtest/ivltests/vhdl_elab_range.v +42 -0
- steveicarus_ivtest/ivltests/vhdl_elab_range.vhd +44 -0
- steveicarus_ivtest/ivltests/vhdl_eval_cond.v +35 -0
- steveicarus_ivtest/ivltests/vhdl_eval_cond.vhd +37 -0
- steveicarus_ivtest/ivltests/vhdl_expr1.v +22 -0
- steveicarus_ivtest/ivltests/vhdl_expr1.vhd +19 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test1.v +31 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test1.vhd +80 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test2.v +31 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test2.vhd +80 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test3.v +31 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test3.vhd +85 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test4.v +31 -0
- steveicarus_ivtest/ivltests/vhdl_fa4_test4.vhd +102 -0
- steveicarus_ivtest/ivltests/vhdl_file_open.v +36 -0
- steveicarus_ivtest/ivltests/vhdl_file_open.vhd +50 -0
- steveicarus_ivtest/ivltests/vhdl_generic_default.v +33 -0
- steveicarus_ivtest/ivltests/vhdl_generic_default.vhd +33 -0
- steveicarus_ivtest/ivltests/vhdl_generic_eval.v +38 -0
- steveicarus_ivtest/ivltests/vhdl_generic_eval.vhd +79 -0
- steveicarus_ivtest/ivltests/vhdl_image_attr.v +30 -0
steveicarus_ivtest/ivltests/vhdl_and23_bit.vhd
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library ieee;
|
| 2 |
+
use ieee.numeric_bit.all;
|
| 3 |
+
|
| 4 |
+
entity and23 is
|
| 5 |
+
port (
|
| 6 |
+
a_i : in bit_vector (22 downto 0);
|
| 7 |
+
b_i : in bit_vector (22 downto 0);
|
| 8 |
+
c_o : out bit_vector (22 downto 0)
|
| 9 |
+
);
|
| 10 |
+
end entity and23;
|
| 11 |
+
|
| 12 |
+
architecture rtl of and23 is
|
| 13 |
+
begin
|
| 14 |
+
c_o <= a_i and b_i;
|
| 15 |
+
end architecture rtl;
|
steveicarus_ivtest/ivltests/vhdl_and_gate.v
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module stimulus (output reg A, B);
|
| 2 |
+
reg unsigned [1:0] stimulus_count = 2'b0;
|
| 3 |
+
|
| 4 |
+
initial begin
|
| 5 |
+
{A, B} = 2'b00;
|
| 6 |
+
#10 {A, B} = 2'b01;
|
| 7 |
+
#10 {A, B} = 2'b10;
|
| 8 |
+
#10 {A, B} = 2'b11;
|
| 9 |
+
end
|
| 10 |
+
|
| 11 |
+
endmodule
|
| 12 |
+
|
| 13 |
+
module scoreboard (input Y, A, B);
|
| 14 |
+
reg [3:0] truth_table;
|
| 15 |
+
reg Y_s;
|
| 16 |
+
|
| 17 |
+
initial begin
|
| 18 |
+
truth_table['b00] = 0;
|
| 19 |
+
truth_table['b01] = 0;
|
| 20 |
+
truth_table['b10] = 0;
|
| 21 |
+
truth_table['b11] = 1;
|
| 22 |
+
end
|
| 23 |
+
|
| 24 |
+
always @(A or B) begin
|
| 25 |
+
Y_s = truth_table[{A,B}];
|
| 26 |
+
#1;
|
| 27 |
+
//$display ("a = %b, b = %b, Y_s = %b, Y = %b", A, B, Y_s, Y);
|
| 28 |
+
if (Y_s !== Y) begin
|
| 29 |
+
$display("FAILED! - mismatch found for inputs %b and %b", A, B);
|
| 30 |
+
$finish;
|
| 31 |
+
end
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
endmodule
|
| 35 |
+
|
| 36 |
+
module test;
|
| 37 |
+
stimulus stim (A, B);
|
| 38 |
+
and_gate duv (.a_i(A), .b_i(B), .c_o(Y) );
|
| 39 |
+
scoreboard mon (Y, A, B);
|
| 40 |
+
|
| 41 |
+
initial begin
|
| 42 |
+
#100 $display("PASSED");
|
| 43 |
+
$finish;
|
| 44 |
+
end
|
| 45 |
+
|
| 46 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_and_gate.vhd
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library IEEE;
|
| 2 |
+
use IEEE.std_logic_1164.all;
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
entity and_gate is
|
| 6 |
+
port (
|
| 7 |
+
a_i : in std_logic; -- inputs
|
| 8 |
+
b_i : in std_logic;
|
| 9 |
+
c_o : out std_logic -- output
|
| 10 |
+
);
|
| 11 |
+
end entity and_gate;
|
| 12 |
+
|
| 13 |
+
architecture rtl of and_gate is
|
| 14 |
+
begin
|
| 15 |
+
c_o <= a_i and b_i;
|
| 16 |
+
end architecture rtl;
|
steveicarus_ivtest/ivltests/vhdl_andg_bit.v
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module stimulus (output reg A, B);
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
initial begin
|
| 5 |
+
{A, B} = 2'b00;
|
| 6 |
+
#10 {A, B} = 2'b01;
|
| 7 |
+
#10 {A, B} = 2'b10;
|
| 8 |
+
#10 {A, B} = 2'b11;
|
| 9 |
+
end
|
| 10 |
+
|
| 11 |
+
endmodule
|
| 12 |
+
|
| 13 |
+
module scoreboard (input Y, A, B);
|
| 14 |
+
|
| 15 |
+
function truth_table (input a, b);
|
| 16 |
+
reg [1:0] gate_operand;
|
| 17 |
+
reg gate_output;
|
| 18 |
+
begin
|
| 19 |
+
gate_operand[1:0] = {a, b};
|
| 20 |
+
case (gate_operand)
|
| 21 |
+
2'b00: gate_output = 0;
|
| 22 |
+
2'b01: gate_output = 0;
|
| 23 |
+
2'b10: gate_output = 0;
|
| 24 |
+
2'b11: gate_output = 1;
|
| 25 |
+
endcase
|
| 26 |
+
|
| 27 |
+
truth_table = gate_output;
|
| 28 |
+
end
|
| 29 |
+
endfunction
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
reg Y_t;
|
| 33 |
+
|
| 34 |
+
always @(A or B) begin
|
| 35 |
+
Y_t = truth_table (A, B);
|
| 36 |
+
#1;
|
| 37 |
+
//$display ("a = %b, b = %b, Y_s = %b, Y = %b", A, B, Y_s, Y);
|
| 38 |
+
if (Y_t !== Y) begin
|
| 39 |
+
$display("FAILED! - mismatch found for inputs %b and %b in AND operation", A, B);
|
| 40 |
+
$finish;
|
| 41 |
+
end
|
| 42 |
+
end
|
| 43 |
+
|
| 44 |
+
endmodule
|
| 45 |
+
|
| 46 |
+
module test;
|
| 47 |
+
stimulus stim (A, B);
|
| 48 |
+
and_gate duv (.a_i(A), .b_i(B), .c_o(Y) );
|
| 49 |
+
scoreboard mon (Y, A, B);
|
| 50 |
+
|
| 51 |
+
initial begin
|
| 52 |
+
#100;
|
| 53 |
+
$display("PASSED");
|
| 54 |
+
$finish;
|
| 55 |
+
end
|
| 56 |
+
|
| 57 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_andg_bit.vhd
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library IEEE;
|
| 2 |
+
use IEEE.numeric_bit.all;
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
entity and_gate is
|
| 6 |
+
port (
|
| 7 |
+
a_i : in bit; -- inputs
|
| 8 |
+
b_i : in bit;
|
| 9 |
+
c_o : out bit -- output
|
| 10 |
+
);
|
| 11 |
+
end entity and_gate;
|
| 12 |
+
|
| 13 |
+
architecture rtl of and_gate is
|
| 14 |
+
begin
|
| 15 |
+
c_o <= a_i and b_i;
|
| 16 |
+
end architecture rtl;
|
steveicarus_ivtest/ivltests/vhdl_andg_stdlogic.v
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module stimulus (output reg A, B);
|
| 2 |
+
|
| 3 |
+
initial begin
|
| 4 |
+
// both inputs are x
|
| 5 |
+
#0 {A, B} = 2'bxx;
|
| 6 |
+
// both inputs are z
|
| 7 |
+
#10 {A, B} = 2'bzz;
|
| 8 |
+
// one input is a zero
|
| 9 |
+
#10 {A, B} = 2'b0x;
|
| 10 |
+
#10 {A, B} = 2'bx0;
|
| 11 |
+
#10 {A, B} = 2'b0z;
|
| 12 |
+
#10 {A, B} = 2'bz0;
|
| 13 |
+
// one input is a one
|
| 14 |
+
#10 {A, B} = 2'b1x;
|
| 15 |
+
#10 {A, B} = 2'bx1;
|
| 16 |
+
#10 {A, B} = 2'b1z;
|
| 17 |
+
#10 {A, B} = 2'bz1;
|
| 18 |
+
// normal bit operands
|
| 19 |
+
#10 {A, B} = 2'b00;
|
| 20 |
+
#10 {A, B} = 2'b01;
|
| 21 |
+
#10 {A, B} = 2'b10;
|
| 22 |
+
#10 {A, B} = 2'b11;
|
| 23 |
+
end
|
| 24 |
+
|
| 25 |
+
endmodule
|
| 26 |
+
|
| 27 |
+
module scoreboard (input Y, A, B);
|
| 28 |
+
|
| 29 |
+
function truth_table (input a, b);
|
| 30 |
+
reg [1:0] gate_operand;
|
| 31 |
+
reg gate_output;
|
| 32 |
+
begin
|
| 33 |
+
gate_operand[1:0] = {a, b};
|
| 34 |
+
case (gate_operand)
|
| 35 |
+
// both inputs are x
|
| 36 |
+
2'bxx: gate_output = 1'bx;
|
| 37 |
+
// both inputs are z
|
| 38 |
+
2'bzz: gate_output = 1'bx;
|
| 39 |
+
// output should be zero (one input is a zero)
|
| 40 |
+
2'b0x: gate_output = 0;
|
| 41 |
+
2'bx0: gate_output = 0;
|
| 42 |
+
2'b0z: gate_output = 0;
|
| 43 |
+
2'bz0: gate_output = 0;
|
| 44 |
+
// output is x (one input is a one)
|
| 45 |
+
2'b1x: gate_output = 1'bx;
|
| 46 |
+
2'bx1: gate_output = 1'bx;
|
| 47 |
+
2'b1z: gate_output = 1'bx;
|
| 48 |
+
2'bz1: gate_output = 1'bx;
|
| 49 |
+
// inputs x, z
|
| 50 |
+
2'bxz: gate_output = 1'bx;
|
| 51 |
+
2'bzx: gate_output = 1'bx;
|
| 52 |
+
// normal operation on bit
|
| 53 |
+
2'b00: gate_output = 0;
|
| 54 |
+
2'b01: gate_output = 0;
|
| 55 |
+
2'b10: gate_output = 0;
|
| 56 |
+
2'b11: gate_output = 1;
|
| 57 |
+
endcase
|
| 58 |
+
|
| 59 |
+
truth_table = gate_output;
|
| 60 |
+
end
|
| 61 |
+
endfunction
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
reg Y_t;
|
| 65 |
+
|
| 66 |
+
always @(A or B) begin
|
| 67 |
+
Y_t = truth_table (A, B);
|
| 68 |
+
#1;
|
| 69 |
+
//$display ("a = %b, b = %b, Y_s = %b, Y = %b", A, B, Y_s, Y);
|
| 70 |
+
if (Y_t !== Y) begin
|
| 71 |
+
$display("FAILED! - mismatch found for inputs %b and %b in AND operation", A, B);
|
| 72 |
+
$finish;
|
| 73 |
+
end
|
| 74 |
+
end
|
| 75 |
+
|
| 76 |
+
endmodule
|
| 77 |
+
|
| 78 |
+
module test;
|
| 79 |
+
stimulus stim (A, B);
|
| 80 |
+
and_gate duv (.a_i(A), .b_i(B), .c_o(Y) );
|
| 81 |
+
scoreboard mon (Y, A, B);
|
| 82 |
+
|
| 83 |
+
initial begin
|
| 84 |
+
#200;
|
| 85 |
+
$display("PASSED");
|
| 86 |
+
$finish;
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_andg_stdlogic.vhd
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library IEEE;
|
| 2 |
+
use IEEE.std_logic_1164.all;
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
entity and_gate is
|
| 6 |
+
port (
|
| 7 |
+
a_i : in std_logic; -- inputs
|
| 8 |
+
b_i : in std_logic;
|
| 9 |
+
c_o : out std_logic -- output
|
| 10 |
+
);
|
| 11 |
+
end entity and_gate;
|
| 12 |
+
|
| 13 |
+
architecture rtl of and_gate is
|
| 14 |
+
begin
|
| 15 |
+
c_o <= a_i and b_i;
|
| 16 |
+
end architecture rtl;
|
steveicarus_ivtest/ivltests/vhdl_array_of_array.v
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test case for handling an array of arrays
|
| 21 |
+
|
| 22 |
+
module vhdl_array_of_array_test;
|
| 23 |
+
vhdl_array_of_array dut();
|
| 24 |
+
|
| 25 |
+
initial begin
|
| 26 |
+
if(dut.sig[0] !== 8'haa)
|
| 27 |
+
begin
|
| 28 |
+
$display("FAILED");
|
| 29 |
+
$finish();
|
| 30 |
+
end
|
| 31 |
+
|
| 32 |
+
$display("PASSED");
|
| 33 |
+
end
|
| 34 |
+
|
| 35 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_array_of_array.vhd
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test case for handling an array of arrays
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
|
| 26 |
+
entity vhdl_array_of_array is
|
| 27 |
+
end entity vhdl_array_of_array;
|
| 28 |
+
|
| 29 |
+
architecture test of vhdl_array_of_array is
|
| 30 |
+
type t_byte_array is array (natural range <>) of std_logic_vector(7 downto 0);
|
| 31 |
+
signal sig : t_byte_array(2 downto 0);
|
| 32 |
+
|
| 33 |
+
begin
|
| 34 |
+
sig <= (0 => x"aa", 1 => x"bb", 2 => x"cc");
|
| 35 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_boolean.v
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// @author Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// boolean values test.
|
| 21 |
+
|
| 22 |
+
module vhdl_boolean_test;
|
| 23 |
+
|
| 24 |
+
vhdl_boolean dut();
|
| 25 |
+
|
| 26 |
+
initial begin
|
| 27 |
+
if(dut.true_val != \true ) begin
|
| 28 |
+
$display("FAILED true 1");
|
| 29 |
+
$finish();
|
| 30 |
+
end
|
| 31 |
+
|
| 32 |
+
if(!dut.true_val) begin
|
| 33 |
+
$display("FAILED true 2");
|
| 34 |
+
$finish();
|
| 35 |
+
end
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if(dut.false_val != \false ) begin
|
| 39 |
+
$display("FAILED false 1");
|
| 40 |
+
$finish();
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
if(dut.false_val) begin
|
| 44 |
+
$display("FAILED false 2");
|
| 45 |
+
$finish();
|
| 46 |
+
end
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if(!dut.and1) begin
|
| 50 |
+
$display("FAILED and1");
|
| 51 |
+
$finish();
|
| 52 |
+
end
|
| 53 |
+
|
| 54 |
+
if(dut.and2) begin
|
| 55 |
+
$display("FAILED and2");
|
| 56 |
+
$finish();
|
| 57 |
+
end
|
| 58 |
+
|
| 59 |
+
if(dut.and3) begin
|
| 60 |
+
$display("FAILED and3");
|
| 61 |
+
$finish();
|
| 62 |
+
end
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
if(!dut.or1) begin
|
| 66 |
+
$display("FAILED or1");
|
| 67 |
+
$finish();
|
| 68 |
+
end
|
| 69 |
+
|
| 70 |
+
if(!dut.or2) begin
|
| 71 |
+
$display("FAILED or2");
|
| 72 |
+
$finish();
|
| 73 |
+
end
|
| 74 |
+
|
| 75 |
+
if(dut.or3) begin
|
| 76 |
+
$display("FAILED or3");
|
| 77 |
+
$finish();
|
| 78 |
+
end
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
if(!dut.not1) begin
|
| 82 |
+
$display("FAILED not1");
|
| 83 |
+
$finish();
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
if(dut.not2) begin
|
| 87 |
+
$display("FAILED not2");
|
| 88 |
+
$finish();
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
$display("PASSED");
|
| 92 |
+
end
|
| 93 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_boolean.vhd
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- @author Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- boolean values test.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
|
| 24 |
+
entity vhdl_boolean is
|
| 25 |
+
end vhdl_boolean;
|
| 26 |
+
|
| 27 |
+
architecture test of vhdl_boolean is
|
| 28 |
+
signal true_val, false_val, and1, and2, and3, or1, or2, or3, not1, not2 : boolean;
|
| 29 |
+
begin
|
| 30 |
+
true_val <= true;
|
| 31 |
+
false_val <= false;
|
| 32 |
+
|
| 33 |
+
and1 <= true and true;
|
| 34 |
+
and2 <= true and false;
|
| 35 |
+
and3 <= false and false;
|
| 36 |
+
|
| 37 |
+
or1 <= true or true;
|
| 38 |
+
or2 <= true or false;
|
| 39 |
+
or3 <= false or false;
|
| 40 |
+
|
| 41 |
+
not1 <= not false;
|
| 42 |
+
not2 <= not true;
|
| 43 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_case_multi.v
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2014 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
// Test for multiple choices in case alternative statements.
|
| 20 |
+
|
| 21 |
+
module vhdl_case_multi_test;
|
| 22 |
+
reg [2:0] test_vec;
|
| 23 |
+
reg parity;
|
| 24 |
+
vhdl_case_multi dut(test_vec, parity);
|
| 25 |
+
|
| 26 |
+
initial begin
|
| 27 |
+
// Execute both paths
|
| 28 |
+
test_vec = 'b101;
|
| 29 |
+
#1;
|
| 30 |
+
if(parity !== 1'b0) begin
|
| 31 |
+
$display("FAILED 1");
|
| 32 |
+
$finish();
|
| 33 |
+
end
|
| 34 |
+
|
| 35 |
+
test_vec = 'b001;
|
| 36 |
+
#1;
|
| 37 |
+
if(parity !== 1'b1) begin
|
| 38 |
+
$display("FAILED 2");
|
| 39 |
+
$finish();
|
| 40 |
+
end
|
| 41 |
+
|
| 42 |
+
$display("PASSED");
|
| 43 |
+
end
|
| 44 |
+
endmodule
|
| 45 |
+
|
steveicarus_ivtest/ivltests/vhdl_case_multi.vhd
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2014 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
-- Test for multiple choices in case alternative statements.
|
| 20 |
+
|
| 21 |
+
library ieee;
|
| 22 |
+
use ieee.std_logic_1164.all;
|
| 23 |
+
|
| 24 |
+
entity vhdl_case_multi is
|
| 25 |
+
port ( inp: in std_logic_vector (0 to 2);
|
| 26 |
+
parity: out std_logic );
|
| 27 |
+
end vhdl_case_multi;
|
| 28 |
+
|
| 29 |
+
architecture vhdl_case_multi_rtl of vhdl_case_multi is
|
| 30 |
+
begin
|
| 31 |
+
|
| 32 |
+
process (inp)
|
| 33 |
+
begin
|
| 34 |
+
case inp is
|
| 35 |
+
when "000"|"011"|"101"|"110" => parity <= "0";
|
| 36 |
+
when "001"|"010"|"100"|"111" => parity <= "1";
|
| 37 |
+
when others => parity <= "Z";
|
| 38 |
+
end case;
|
| 39 |
+
end process;
|
| 40 |
+
|
| 41 |
+
end vhdl_case_multi_rtl;
|
steveicarus_ivtest/ivltests/vhdl_concat.v
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2014 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for expression concatenation in VHDL.
|
| 21 |
+
|
| 22 |
+
module concat_test;
|
| 23 |
+
concat dut();
|
| 24 |
+
|
| 25 |
+
initial begin
|
| 26 |
+
#1; // wait for signal assignments
|
| 27 |
+
|
| 28 |
+
if(dut.concat1 !== 2'b10)
|
| 29 |
+
begin
|
| 30 |
+
$display("FAILED: concat1 should be 10 but is %b", dut.concat1);
|
| 31 |
+
$finish();
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
if(dut.concat2 !== 5'b11010)
|
| 35 |
+
begin
|
| 36 |
+
$display("FAILED: concat2 should be 11010 but is %b", dut.concat2);
|
| 37 |
+
$finish();
|
| 38 |
+
end
|
| 39 |
+
|
| 40 |
+
$display("PASSED");
|
| 41 |
+
end
|
| 42 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_concat.vhd
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2014 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for expression concatenation in VHDL.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
|
| 25 |
+
entity concat is
|
| 26 |
+
end concat;
|
| 27 |
+
|
| 28 |
+
architecture test of concat is
|
| 29 |
+
signal concat1 : std_logic_vector(1 downto 0);
|
| 30 |
+
signal concat2 : std_logic_vector(0 to 4);
|
| 31 |
+
begin
|
| 32 |
+
concat1 <= '1' & '0';
|
| 33 |
+
concat2 <= '1' & "10" & concat1;
|
| 34 |
+
end test;
|
steveicarus_ivtest/ivltests/vhdl_concat_func.v
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place / Suite 330, Boston, MA 02111/1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for concatenation of function call results.
|
| 21 |
+
|
| 22 |
+
module test_concat_func();
|
| 23 |
+
logic [7:0] in_word, out_word;
|
| 24 |
+
|
| 25 |
+
concat_func dut(in_word, out_word);
|
| 26 |
+
|
| 27 |
+
initial begin
|
| 28 |
+
in_word = 8'b11101010;
|
| 29 |
+
#1;
|
| 30 |
+
|
| 31 |
+
if(out_word !== 8'b11010010) begin
|
| 32 |
+
$display("FAILED out_word = %b", out_word);
|
| 33 |
+
$finish();
|
| 34 |
+
end
|
| 35 |
+
|
| 36 |
+
$display("PASSED");
|
| 37 |
+
end
|
| 38 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_concat_func.vhd
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for concatenation of function call results.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
|
| 26 |
+
entity concat_func is
|
| 27 |
+
port(in_word : in std_logic_vector(7 downto 0);
|
| 28 |
+
out_word : out std_logic_vector(7 downto 0));
|
| 29 |
+
end entity concat_func;
|
| 30 |
+
|
| 31 |
+
architecture test of concat_func is
|
| 32 |
+
begin
|
| 33 |
+
process(in_word)
|
| 34 |
+
variable tmp : unsigned(7 downto 0);
|
| 35 |
+
variable int : integer;
|
| 36 |
+
begin
|
| 37 |
+
tmp := unsigned(in_word);
|
| 38 |
+
int := to_integer(tmp);
|
| 39 |
+
out_word <= in_word(7 downto 6) & std_logic_vector(to_unsigned(int, 3)) & std_logic_vector(resize(tmp, 3));
|
| 40 |
+
end process;
|
| 41 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_concurrent_assert.v
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2016 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for concurrent assertion statements.
|
| 21 |
+
|
| 22 |
+
module vhdl_concurrent_assert_test;
|
| 23 |
+
vhdl_concurrent_assert dut();
|
| 24 |
+
// we do not need anything else here
|
| 25 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_concurrent_assert.vhd
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2016 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for concurrent assertion statements.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
|
| 25 |
+
entity vhdl_concurrent_assert is
|
| 26 |
+
end vhdl_concurrent_assert;
|
| 27 |
+
|
| 28 |
+
architecture test of vhdl_concurrent_assert is
|
| 29 |
+
signal bool_false: boolean := false;
|
| 30 |
+
signal bool_true: boolean := true;
|
| 31 |
+
begin
|
| 32 |
+
assert (bool_false)
|
| 33 |
+
report "this assert should be fired";
|
| 34 |
+
|
| 35 |
+
assert (bool_true)
|
| 36 |
+
report "this assert should not be fired";
|
| 37 |
+
end test;
|
steveicarus_ivtest/ivltests/vhdl_const_array.v
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for constant arrays access
|
| 21 |
+
|
| 22 |
+
module constant_array_test();
|
| 23 |
+
reg [7:0] out_word;
|
| 24 |
+
reg [2:0] index;
|
| 25 |
+
constant_array dut(index, out_word);
|
| 26 |
+
|
| 27 |
+
initial begin
|
| 28 |
+
index = 2;
|
| 29 |
+
#1; // wait for signal assignments
|
| 30 |
+
|
| 31 |
+
if(out_word !== 16)
|
| 32 |
+
begin
|
| 33 |
+
$display("FAILED 1");
|
| 34 |
+
$finish();
|
| 35 |
+
end
|
| 36 |
+
|
| 37 |
+
index = 4;
|
| 38 |
+
#1;
|
| 39 |
+
|
| 40 |
+
if(out_word !== 64)
|
| 41 |
+
begin
|
| 42 |
+
$display("FAILED 2");
|
| 43 |
+
$finish();
|
| 44 |
+
end
|
| 45 |
+
|
| 46 |
+
if(dut.test_a !== 32)
|
| 47 |
+
begin
|
| 48 |
+
$display("FAILED 3");
|
| 49 |
+
$finish();
|
| 50 |
+
end
|
| 51 |
+
|
| 52 |
+
if(dut.test_b !== 4)
|
| 53 |
+
begin
|
| 54 |
+
$display("FAILED 4");
|
| 55 |
+
$finish();
|
| 56 |
+
end
|
| 57 |
+
|
| 58 |
+
if(dut.test_c !== 3'b100)
|
| 59 |
+
begin
|
| 60 |
+
$display("FAILED 5");
|
| 61 |
+
$finish();
|
| 62 |
+
end
|
| 63 |
+
|
| 64 |
+
if(dut.test_d !== 1'b1)
|
| 65 |
+
begin
|
| 66 |
+
$display("FAILED 6");
|
| 67 |
+
$finish();
|
| 68 |
+
end
|
| 69 |
+
|
| 70 |
+
$display("PASSED");
|
| 71 |
+
end
|
| 72 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_const_array.vhd
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for constant arrays access
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
use work.constant_array_pkg.all;
|
| 26 |
+
|
| 27 |
+
entity constant_array is
|
| 28 |
+
port (index : in std_logic_vector(2 downto 0);
|
| 29 |
+
output : out std_logic_vector(7 downto 0));
|
| 30 |
+
end entity constant_array;
|
| 31 |
+
|
| 32 |
+
architecture test of constant_array is
|
| 33 |
+
type logic_array is array (integer range <>) of std_logic_vector(0 to 3);
|
| 34 |
+
constant test_array : logic_array(0 to 5) :=
|
| 35 |
+
(0 => "0010",
|
| 36 |
+
1 => "1000",
|
| 37 |
+
2 => "0100",
|
| 38 |
+
3 => "0110",
|
| 39 |
+
4 => "0101",
|
| 40 |
+
5 => "1100");
|
| 41 |
+
|
| 42 |
+
-- Check if constant vectors are not broken with the changes
|
| 43 |
+
constant vector : std_logic_vector(5 downto 0) := "110011";
|
| 44 |
+
|
| 45 |
+
signal test_a : unsigned(7 downto 0);
|
| 46 |
+
signal test_b : std_logic_vector(3 downto 0);
|
| 47 |
+
signal test_c : std_logic_vector(2 downto 0);
|
| 48 |
+
signal test_d : std_logic;
|
| 49 |
+
begin
|
| 50 |
+
test_a <= const_array(3);
|
| 51 |
+
test_b <= test_array(2);
|
| 52 |
+
test_c <= vector(4 downto 2);
|
| 53 |
+
test_d <= vector(5);
|
| 54 |
+
|
| 55 |
+
process (index)
|
| 56 |
+
begin
|
| 57 |
+
output <= const_array(to_integer(unsigned(index)));
|
| 58 |
+
end process;
|
| 59 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_const_array_pkg.vhd
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for constant arrays access
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
|
| 26 |
+
package constant_array_pkg is
|
| 27 |
+
type t_unsigned_array is array (natural range <>) of unsigned(7 downto 0);
|
| 28 |
+
constant const_array : t_unsigned_array(7 downto 0) :=
|
| 29 |
+
(0 => "00000010",
|
| 30 |
+
1 => "00001000",
|
| 31 |
+
2 => "00010000",
|
| 32 |
+
3 => "00100000",
|
| 33 |
+
4 => "01000000",
|
| 34 |
+
5 => "01111100",
|
| 35 |
+
others => "00000010");
|
| 36 |
+
end package constant_array_pkg;
|
steveicarus_ivtest/ivltests/vhdl_const_package.v
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2014 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
// Tests if constants in packages can be initialized with expressions
|
| 20 |
+
// that normally require elaboration to be properly emitted.
|
| 21 |
+
|
| 22 |
+
module const_package_test;
|
| 23 |
+
const_package dut();
|
| 24 |
+
|
| 25 |
+
initial begin
|
| 26 |
+
if(dut.c_bitstring != 'b1001) begin
|
| 27 |
+
$display("FAILED 1");
|
| 28 |
+
$finish;
|
| 29 |
+
end
|
| 30 |
+
|
| 31 |
+
#1; // wait for signal assignment
|
| 32 |
+
|
| 33 |
+
if(dut.c_aggregate != 'b10001000) begin
|
| 34 |
+
$display("FAILED 2");
|
| 35 |
+
$finish;
|
| 36 |
+
end
|
| 37 |
+
|
| 38 |
+
$display("PASSED");
|
| 39 |
+
end
|
| 40 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_const_package.vhd
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2014 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Tests if constants in packages can be initialized with expressions
|
| 21 |
+
-- that normally require elaboration to be properly emitted.
|
| 22 |
+
|
| 23 |
+
library IEEE;
|
| 24 |
+
use IEEE.STD_LOGIC_1164.all;
|
| 25 |
+
use work.const_package_pkg.all;
|
| 26 |
+
|
| 27 |
+
entity const_package is
|
| 28 |
+
end const_package;
|
| 29 |
+
|
| 30 |
+
architecture test of const_package is
|
| 31 |
+
signal bitstring : std_logic_vector(3 downto 0) := c_bitstring;
|
| 32 |
+
signal aggregate : std_logic_vector(7 downto 0);
|
| 33 |
+
begin
|
| 34 |
+
aggregate <= c_aggregate;
|
| 35 |
+
end test;
|
steveicarus_ivtest/ivltests/vhdl_const_package_pkg.vhd
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2014 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Tests if constants in packages can be initialized with expressions
|
| 21 |
+
-- that normally require elaboration to be properly emitted.
|
| 22 |
+
|
| 23 |
+
library IEEE;
|
| 24 |
+
use IEEE.STD_LOGIC_1164.all;
|
| 25 |
+
|
| 26 |
+
package const_package_pkg is
|
| 27 |
+
constant c_bitstring : std_logic_vector(3 downto 0) := "1001";
|
| 28 |
+
constant c_aggregate : std_logic_vector(7 downto 0) := (7 => '1', 3 => '1', others => '0');
|
| 29 |
+
end const_package_pkg;
|
| 30 |
+
|
| 31 |
+
package body const_package_pkg is
|
| 32 |
+
end const_package_pkg;
|
steveicarus_ivtest/ivltests/vhdl_const_record.v
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for accessing constant records & arrays of records in VHDL.
|
| 21 |
+
|
| 22 |
+
module vhdl_const_record_test;
|
| 23 |
+
int sel;
|
| 24 |
+
logic [7:0] hex;
|
| 25 |
+
logic [7:0] aval;
|
| 26 |
+
vhdl_const_record dut(sel, hex, aval);
|
| 27 |
+
|
| 28 |
+
initial begin
|
| 29 |
+
if(dut.sig !== 8'h66)
|
| 30 |
+
begin
|
| 31 |
+
$display("FAILED 1");
|
| 32 |
+
$finish();
|
| 33 |
+
end
|
| 34 |
+
|
| 35 |
+
sel = 0;
|
| 36 |
+
#1;
|
| 37 |
+
if(hex !== 8'h14 || aval !== 8'haa || dut.sig2 !== 8'h00)
|
| 38 |
+
begin
|
| 39 |
+
$display("FAILED 2");
|
| 40 |
+
$finish();
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
sel = 1;
|
| 44 |
+
#1;
|
| 45 |
+
if(hex !== 8'h24 || aval !== 8'hbb || dut.sig2 !== 8'h11)
|
| 46 |
+
begin
|
| 47 |
+
$display("FAILED 3");
|
| 48 |
+
$finish();
|
| 49 |
+
end
|
| 50 |
+
|
| 51 |
+
sel = 2;
|
| 52 |
+
#1;
|
| 53 |
+
if(hex !== 8'h34 || aval !== 8'hcc || dut.sig2 !== 8'h22)
|
| 54 |
+
begin
|
| 55 |
+
$display("FAILED 4");
|
| 56 |
+
$finish();
|
| 57 |
+
end
|
| 58 |
+
|
| 59 |
+
sel = 3;
|
| 60 |
+
#1;
|
| 61 |
+
if(hex !== 8'h56 || aval !== 8'hdd || dut.sig2 !== 8'h33)
|
| 62 |
+
begin
|
| 63 |
+
$display("FAILED 5");
|
| 64 |
+
$finish();
|
| 65 |
+
end
|
| 66 |
+
|
| 67 |
+
$display("PASSED");
|
| 68 |
+
end
|
| 69 |
+
endmodule
|
| 70 |
+
|
steveicarus_ivtest/ivltests/vhdl_const_record.vhd
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for accessing constant records & arrays of records in VHDL.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
|
| 26 |
+
entity vhdl_const_record is
|
| 27 |
+
port(sel : in integer range 0 to 3;
|
| 28 |
+
hex : out std_logic_vector(7 downto 0);
|
| 29 |
+
aval : out std_logic_vector(7 downto 0));
|
| 30 |
+
end entity vhdl_const_record;
|
| 31 |
+
|
| 32 |
+
architecture test of vhdl_const_record is
|
| 33 |
+
type t_var is (var_presence, var_identif, var_1, var_2, var_3, var_rst, var_4, var_5, var_whatever);
|
| 34 |
+
type t_byte_array is array (natural range <>) of std_logic_vector(7 downto 0);
|
| 35 |
+
|
| 36 |
+
type t_var_record is record
|
| 37 |
+
var : t_var; -- 32 bits
|
| 38 |
+
a : t_byte_array (3 downto 0); -- 4*8 bits
|
| 39 |
+
hexvalue : std_logic_vector (7 downto 0); -- 8 bits
|
| 40 |
+
end record; -- total 72 bits
|
| 41 |
+
|
| 42 |
+
type t_var_array is array (natural range <>) of t_var_record;
|
| 43 |
+
|
| 44 |
+
constant c_vars_array : t_var_array(0 to 3) := (
|
| 45 |
+
0 => (var => var_presence,
|
| 46 |
+
hexvalue => x"14",
|
| 47 |
+
a => (0 => x"aa", 1 => x"ab", 2 => x"ac", 3 => x"ad")),
|
| 48 |
+
1 => (var => var_identif,
|
| 49 |
+
hexvalue => x"24",
|
| 50 |
+
a => (0 => x"ba", 1 => x"bb", 2 => x"bc", 3 => x"bd")),
|
| 51 |
+
2 => (var => var_1,
|
| 52 |
+
hexvalue => x"34",
|
| 53 |
+
a => (0 => x"ca", 1 => x"cb", 2 => x"cc", 3 => x"cd")),
|
| 54 |
+
3 => (var => var_2,
|
| 55 |
+
hexvalue => x"56",
|
| 56 |
+
a => (0 => x"da", 1 => x"db", 2 => x"dc", 3 => x"dd"))
|
| 57 |
+
);
|
| 58 |
+
|
| 59 |
+
constant c_record : t_var_record := (
|
| 60 |
+
var => var_4,
|
| 61 |
+
hexvalue => x"66",
|
| 62 |
+
a => (0 => x"00", 1 => x"11", 2 => x"22", 3 => x"33")
|
| 63 |
+
);
|
| 64 |
+
signal sig : std_logic_vector(7 downto 0);
|
| 65 |
+
signal sig2 : std_logic_vector(7 downto 0);
|
| 66 |
+
begin
|
| 67 |
+
sig <= c_record.hexvalue;
|
| 68 |
+
|
| 69 |
+
process(sel)
|
| 70 |
+
begin
|
| 71 |
+
sig2 <= c_record.a(sel);
|
| 72 |
+
hex <= c_vars_array(sel).hexvalue;
|
| 73 |
+
aval <= c_vars_array(sel).a(sel);
|
| 74 |
+
end process;
|
| 75 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_delay_assign.v
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2016 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for delayed assignment statements.
|
| 21 |
+
|
| 22 |
+
module vhdl_delay_assign_test;
|
| 23 |
+
logic a, b, c;
|
| 24 |
+
int passed = 0;
|
| 25 |
+
vhdl_delay_assign dut(a, b, c);
|
| 26 |
+
|
| 27 |
+
always @(b)
|
| 28 |
+
begin
|
| 29 |
+
if($time == 10) begin
|
| 30 |
+
passed = passed + 1;
|
| 31 |
+
end else begin
|
| 32 |
+
$display("FAILED 1");
|
| 33 |
+
$finish();
|
| 34 |
+
end
|
| 35 |
+
end
|
| 36 |
+
|
| 37 |
+
always @(c)
|
| 38 |
+
begin
|
| 39 |
+
if($time == 10) begin
|
| 40 |
+
passed = passed + 1;
|
| 41 |
+
end else begin
|
| 42 |
+
$display("FAILED 2");
|
| 43 |
+
$finish();
|
| 44 |
+
end
|
| 45 |
+
end
|
| 46 |
+
|
| 47 |
+
initial begin
|
| 48 |
+
a = 1;
|
| 49 |
+
#11;
|
| 50 |
+
|
| 51 |
+
if(passed !== 2) begin
|
| 52 |
+
$display("FAILED 3");
|
| 53 |
+
$finish();
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
$display("PASSED");
|
| 57 |
+
end
|
| 58 |
+
|
| 59 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_delay_assign.vhd
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2016 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for delayed assignment statements.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
|
| 25 |
+
entity vhdl_delay_assign is
|
| 26 |
+
port(a : in std_logic;
|
| 27 |
+
b, c : out std_logic);
|
| 28 |
+
end vhdl_delay_assign;
|
| 29 |
+
|
| 30 |
+
architecture test of vhdl_delay_assign is
|
| 31 |
+
begin
|
| 32 |
+
b <= a after 10 ns;
|
| 33 |
+
|
| 34 |
+
process(a)
|
| 35 |
+
begin
|
| 36 |
+
c <= a after 10 ns;
|
| 37 |
+
end process;
|
| 38 |
+
end test;
|
steveicarus_ivtest/ivltests/vhdl_elab_range.v
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2016 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Bug report test (could not elaborate a function used to specify a range).
|
| 21 |
+
|
| 22 |
+
module vhdl_elab_range_test;
|
| 23 |
+
integer left, right;
|
| 24 |
+
vhdl_elab_range dut(left, right);
|
| 25 |
+
|
| 26 |
+
initial begin
|
| 27 |
+
#1;
|
| 28 |
+
|
| 29 |
+
if(left !== 2) begin
|
| 30 |
+
$display("FAILED 1");
|
| 31 |
+
$finish();
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
if(right !== 0) begin
|
| 35 |
+
$display("FAILED 2");
|
| 36 |
+
$finish();
|
| 37 |
+
end
|
| 38 |
+
|
| 39 |
+
$display("PASSED");
|
| 40 |
+
end
|
| 41 |
+
|
| 42 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_elab_range.vhd
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2016 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Bug report test (could not elaborate a function used to specify a range).
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
|
| 26 |
+
entity vhdl_elab_range is
|
| 27 |
+
port(sig_left, sig_right : out integer);
|
| 28 |
+
end entity vhdl_elab_range;
|
| 29 |
+
|
| 30 |
+
architecture test of vhdl_elab_range is
|
| 31 |
+
function inc_by_two(a : in integer) return integer is
|
| 32 |
+
begin
|
| 33 |
+
return a + 2;
|
| 34 |
+
end function inc_by_two;
|
| 35 |
+
|
| 36 |
+
signal test_sig : unsigned(inc_by_two(0) downto 0) := (others => '0');
|
| 37 |
+
begin
|
| 38 |
+
process
|
| 39 |
+
begin
|
| 40 |
+
sig_left <= test_sig'left;
|
| 41 |
+
sig_right <= test_sig'right;
|
| 42 |
+
wait;
|
| 43 |
+
end process;
|
| 44 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_eval_cond.v
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2016 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place / Suite 330, Boston, MA 02111/1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test initial conditional assignment evaluation
|
| 21 |
+
|
| 22 |
+
module vhdl_eval_cond_test;
|
| 23 |
+
logic in, out;
|
| 24 |
+
vhdl_eval_cond dut(in, out);
|
| 25 |
+
|
| 26 |
+
assign in = 1;
|
| 27 |
+
|
| 28 |
+
initial begin
|
| 29 |
+
if(out === 1'b0)
|
| 30 |
+
$display("PASSED");
|
| 31 |
+
else
|
| 32 |
+
$display("FAILED");
|
| 33 |
+
end
|
| 34 |
+
|
| 35 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_eval_cond.vhd
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2016 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and-or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test initial conditional assignment evaluation
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
|
| 25 |
+
entity vhdl_eval_cond is
|
| 26 |
+
port(
|
| 27 |
+
input : in std_logic;
|
| 28 |
+
output : out std_logic
|
| 29 |
+
);
|
| 30 |
+
end vhdl_eval_cond;
|
| 31 |
+
|
| 32 |
+
architecture rtl of vhdl_eval_cond is
|
| 33 |
+
|
| 34 |
+
begin
|
| 35 |
+
output <= '1' when input = '0' else '0';
|
| 36 |
+
end rtl;
|
| 37 |
+
|
steveicarus_ivtest/ivltests/vhdl_expr1.v
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module main;
|
| 2 |
+
|
| 3 |
+
wire [3:0] a, b;
|
| 4 |
+
wire [3:0] out;
|
| 5 |
+
|
| 6 |
+
subtract dut (.a(a), .b(b), .out_sig(out));
|
| 7 |
+
|
| 8 |
+
reg [8:0] test_vector;
|
| 9 |
+
assign {a, b} = test_vector;
|
| 10 |
+
|
| 11 |
+
initial begin
|
| 12 |
+
for (test_vector=0 ; test_vector[8]==0 ; test_vector=test_vector+1) begin
|
| 13 |
+
#1 if (out != a-b) begin
|
| 14 |
+
$display("FAILED -- out=%b, expecting %b-%b=%b", out, a, b, a-b);
|
| 15 |
+
$finish;
|
| 16 |
+
end
|
| 17 |
+
end
|
| 18 |
+
|
| 19 |
+
$display("PASSED");
|
| 20 |
+
$finish;
|
| 21 |
+
end // initial begin
|
| 22 |
+
endmodule // main
|
steveicarus_ivtest/ivltests/vhdl_expr1.vhd
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- This VHDL was converted from Verilog using the
|
| 2 |
+
-- Icarus Verilog VHDL Code Generator 0.10.0 (devel) (s20090923-519-g6ce96cc)
|
| 3 |
+
|
| 4 |
+
library ieee;
|
| 5 |
+
use ieee.std_logic_1164.all;
|
| 6 |
+
use ieee.numeric_std.all;
|
| 7 |
+
|
| 8 |
+
entity subtract is
|
| 9 |
+
port (
|
| 10 |
+
a : in unsigned(3 downto 0);
|
| 11 |
+
b : in unsigned(3 downto 0);
|
| 12 |
+
out_sig : out unsigned(3 downto 0)
|
| 13 |
+
);
|
| 14 |
+
end entity;
|
| 15 |
+
|
| 16 |
+
architecture test of subtract is
|
| 17 |
+
begin
|
| 18 |
+
out_sig <= (a + not b) + 1;
|
| 19 |
+
end architecture;
|
steveicarus_ivtest/ivltests/vhdl_fa4_test1.v
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* This module instantiates the fa4 entity, which in turn
|
| 3 |
+
* instantiates other entities. This demonstrates hierarchical
|
| 4 |
+
* constructs in VHDL.
|
| 5 |
+
*/
|
| 6 |
+
module test;
|
| 7 |
+
|
| 8 |
+
reg [3:0] a, b;
|
| 9 |
+
reg cin;
|
| 10 |
+
|
| 11 |
+
wire [3:0] s;
|
| 12 |
+
wire cout;
|
| 13 |
+
|
| 14 |
+
initial begin
|
| 15 |
+
cin = 0;
|
| 16 |
+
a = 4'h2;
|
| 17 |
+
b = 4'h3;
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
initial begin
|
| 21 |
+
#1;
|
| 22 |
+
if (s !== 4'h5) begin
|
| 23 |
+
$display("Error in trivial sum");
|
| 24 |
+
$finish;
|
| 25 |
+
end
|
| 26 |
+
$display ("PASSED");
|
| 27 |
+
end
|
| 28 |
+
|
| 29 |
+
fa4 duv (.c_i(cin), .va_i(a), .vb_i(b), .vs_o(s), .c_o(cout) );
|
| 30 |
+
|
| 31 |
+
endmodule // test
|
steveicarus_ivtest/ivltests/vhdl_fa4_test1.vhd
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library ieee;
|
| 2 |
+
use ieee.numeric_bit.all;
|
| 3 |
+
|
| 4 |
+
-- Declare a 1-bit full-adder.
|
| 5 |
+
entity fa1 is
|
| 6 |
+
port (a_i, b_i, c_i: in bit;
|
| 7 |
+
s_o, c_o: out bit
|
| 8 |
+
);
|
| 9 |
+
end entity fa1;
|
| 10 |
+
|
| 11 |
+
architecture fa1_rtl of fa1 is
|
| 12 |
+
begin
|
| 13 |
+
|
| 14 |
+
s_o <= a_i xor b_i xor c_i;
|
| 15 |
+
c_o <= (a_i and b_i) or (c_i and (a_i xor b_i));
|
| 16 |
+
|
| 17 |
+
end architecture fa1_rtl;
|
| 18 |
+
|
| 19 |
+
-- Declare and implement a 4-bit full-adder that uses the
|
| 20 |
+
-- 1-bit full-adder described above.
|
| 21 |
+
entity fa4 is
|
| 22 |
+
port (va_i, vb_i: in bit_vector (3 downto 0);
|
| 23 |
+
c_i: in bit;
|
| 24 |
+
vs_o: out bit_vector (3 downto 0);
|
| 25 |
+
c_o: out bit
|
| 26 |
+
);
|
| 27 |
+
end entity fa4;
|
| 28 |
+
|
| 29 |
+
architecture fa4_rtl of fa4 is
|
| 30 |
+
|
| 31 |
+
-- full 1-bit adder
|
| 32 |
+
component fa1 is
|
| 33 |
+
port (a_i, b_i, c_i: in bit;
|
| 34 |
+
s_o, c_o: out bit);
|
| 35 |
+
end component fa1;
|
| 36 |
+
|
| 37 |
+
-- internal carry signals propagation
|
| 38 |
+
signal c_int4, c_int3, c_int2, c_int1, c_int0: bit;
|
| 39 |
+
|
| 40 |
+
begin
|
| 41 |
+
|
| 42 |
+
-- carry in
|
| 43 |
+
c_int0 <= c_i;
|
| 44 |
+
|
| 45 |
+
-- slice 0
|
| 46 |
+
s0: fa1 port map (c_i => c_int0,
|
| 47 |
+
a_i => va_i(0),
|
| 48 |
+
b_i => vb_i(0),
|
| 49 |
+
s_o => vs_o(0),
|
| 50 |
+
c_o => c_int1
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
-- slice 1
|
| 54 |
+
s1: fa1 port map (c_i => c_int1,
|
| 55 |
+
a_i => va_i(1),
|
| 56 |
+
b_i => vb_i(1),
|
| 57 |
+
s_o => vs_o(1),
|
| 58 |
+
c_o => c_int2
|
| 59 |
+
);
|
| 60 |
+
|
| 61 |
+
-- slice 2
|
| 62 |
+
s2: fa1 port map (c_i => c_int2,
|
| 63 |
+
a_i => va_i(2),
|
| 64 |
+
b_i => vb_i(2),
|
| 65 |
+
s_o => vs_o(2),
|
| 66 |
+
c_o => c_int3
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
-- slice 3
|
| 70 |
+
s3: fa1 port map (c_i => c_int3,
|
| 71 |
+
a_i => va_i(3),
|
| 72 |
+
b_i => vb_i(3),
|
| 73 |
+
s_o => vs_o(3),
|
| 74 |
+
c_o => c_int4
|
| 75 |
+
);
|
| 76 |
+
|
| 77 |
+
-- carry out
|
| 78 |
+
c_o <= c_int4;
|
| 79 |
+
|
| 80 |
+
end architecture fa4_rtl;
|
steveicarus_ivtest/ivltests/vhdl_fa4_test2.v
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* This module instantiates the fa4 entity, which in turn
|
| 3 |
+
* instantiates other entities. This demonstrates hierarchical
|
| 4 |
+
* constructs in VHDL.
|
| 5 |
+
*/
|
| 6 |
+
module test;
|
| 7 |
+
|
| 8 |
+
reg [3:0] a, b;
|
| 9 |
+
reg cin;
|
| 10 |
+
|
| 11 |
+
wire [3:0] s;
|
| 12 |
+
wire cout;
|
| 13 |
+
|
| 14 |
+
initial begin
|
| 15 |
+
cin = 0;
|
| 16 |
+
a = 4'h2;
|
| 17 |
+
b = 4'h3;
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
initial begin
|
| 21 |
+
#1;
|
| 22 |
+
if (s !== 4'h5) begin
|
| 23 |
+
$display("Error in trivial sum");
|
| 24 |
+
$finish;
|
| 25 |
+
end
|
| 26 |
+
$display ("PASSED");
|
| 27 |
+
end
|
| 28 |
+
|
| 29 |
+
fa4 duv (.c_i(cin), .va_i(a), .vb_i(b), .vs_o(s), .c_o(cout) );
|
| 30 |
+
|
| 31 |
+
endmodule // test
|
steveicarus_ivtest/ivltests/vhdl_fa4_test2.vhd
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library ieee;
|
| 2 |
+
use ieee.numeric_bit.all;
|
| 3 |
+
|
| 4 |
+
-- Declare a 1-bit full-adder.
|
| 5 |
+
entity fa1 is
|
| 6 |
+
port (a_i, b_i, c_i: in bit;
|
| 7 |
+
s_o, c_o: out bit
|
| 8 |
+
);
|
| 9 |
+
end entity fa1;
|
| 10 |
+
|
| 11 |
+
architecture fa1_rtl of fa1 is
|
| 12 |
+
begin
|
| 13 |
+
|
| 14 |
+
s_o <= a_i xor b_i xor c_i;
|
| 15 |
+
c_o <= (a_i and b_i) or (c_i and (a_i xor b_i));
|
| 16 |
+
|
| 17 |
+
end architecture fa1_rtl;
|
| 18 |
+
|
| 19 |
+
-- Declare and implement a 4-bit full-adder that uses the
|
| 20 |
+
-- 1-bit full-adder described above.
|
| 21 |
+
entity fa4 is
|
| 22 |
+
port (va_i, vb_i: in bit_vector (3 downto 0);
|
| 23 |
+
c_i: in bit;
|
| 24 |
+
vs_o: out bit_vector (3 downto 0);
|
| 25 |
+
c_o: out bit
|
| 26 |
+
);
|
| 27 |
+
end entity fa4;
|
| 28 |
+
|
| 29 |
+
architecture fa4_rtl of fa4 is
|
| 30 |
+
|
| 31 |
+
-- full 1-bit adder
|
| 32 |
+
component fa1 is
|
| 33 |
+
port (a_i, b_i, c_i: in bit;
|
| 34 |
+
s_o, c_o: out bit);
|
| 35 |
+
end component fa1;
|
| 36 |
+
|
| 37 |
+
-- internal carry signals propagation
|
| 38 |
+
signal c_int: bit_vector (4 downto 0);
|
| 39 |
+
|
| 40 |
+
begin
|
| 41 |
+
|
| 42 |
+
-- carry in
|
| 43 |
+
c_int(0) <= c_i;
|
| 44 |
+
|
| 45 |
+
-- slice 0
|
| 46 |
+
s0: fa1 port map (c_i => c_int(0),
|
| 47 |
+
a_i => va_i(0),
|
| 48 |
+
b_i => vb_i(0),
|
| 49 |
+
s_o => vs_o(0),
|
| 50 |
+
c_o => c_int(1)
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
-- slice 1
|
| 54 |
+
s1: fa1 port map (c_i => c_int(1),
|
| 55 |
+
a_i => va_i(1),
|
| 56 |
+
b_i => vb_i(1),
|
| 57 |
+
s_o => vs_o(1),
|
| 58 |
+
c_o => c_int(2)
|
| 59 |
+
);
|
| 60 |
+
|
| 61 |
+
-- slice 2
|
| 62 |
+
s2: fa1 port map (c_i => c_int(2),
|
| 63 |
+
a_i => va_i(2),
|
| 64 |
+
b_i => vb_i(2),
|
| 65 |
+
s_o => vs_o(2),
|
| 66 |
+
c_o => c_int(3)
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
-- slice 3
|
| 70 |
+
s3: fa1 port map (c_i => c_int(3),
|
| 71 |
+
a_i => va_i(3),
|
| 72 |
+
b_i => vb_i(3),
|
| 73 |
+
s_o => vs_o(3),
|
| 74 |
+
c_o => c_int(4)
|
| 75 |
+
);
|
| 76 |
+
|
| 77 |
+
-- carry out
|
| 78 |
+
c_o <= c_int(4);
|
| 79 |
+
|
| 80 |
+
end architecture fa4_rtl;
|
steveicarus_ivtest/ivltests/vhdl_fa4_test3.v
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* This module instantiates the fa4 entity, which in turn
|
| 3 |
+
* instantiates other entities. This demonstrates hierarchical
|
| 4 |
+
* constructs in VHDL.
|
| 5 |
+
*/
|
| 6 |
+
module test;
|
| 7 |
+
|
| 8 |
+
reg [3:0] a, b;
|
| 9 |
+
reg cin;
|
| 10 |
+
|
| 11 |
+
wire [3:0] s;
|
| 12 |
+
wire cout;
|
| 13 |
+
|
| 14 |
+
initial begin
|
| 15 |
+
cin = 0;
|
| 16 |
+
a = 4'h2;
|
| 17 |
+
b = 4'h3;
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
initial begin
|
| 21 |
+
#1;
|
| 22 |
+
if (s !== 4'h5) begin
|
| 23 |
+
$display("Error in trivial sum");
|
| 24 |
+
$finish;
|
| 25 |
+
end
|
| 26 |
+
$display ("PASSED");
|
| 27 |
+
end
|
| 28 |
+
|
| 29 |
+
fa4 duv (.c_i(cin), .va_i(a), .vb_i(b), .vs_o(s), .c_o(cout) );
|
| 30 |
+
|
| 31 |
+
endmodule // test
|
steveicarus_ivtest/ivltests/vhdl_fa4_test3.vhd
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- In this test, we declare a component in the "gates" package
|
| 2 |
+
-- and show that it can be referenced within the package namespace.
|
| 3 |
+
|
| 4 |
+
library ieee;
|
| 5 |
+
use ieee.numeric_bit.all;
|
| 6 |
+
|
| 7 |
+
package gates is
|
| 8 |
+
-- full 1-bit adder
|
| 9 |
+
component fa1 is
|
| 10 |
+
port (a_i, b_i, c_i: in bit;
|
| 11 |
+
s_o, c_o: out bit);
|
| 12 |
+
end component fa1;
|
| 13 |
+
end package gates;
|
| 14 |
+
|
| 15 |
+
-- Declare and implement a 4-bit full-adder that uses the
|
| 16 |
+
-- 1-bit full-adder described above.
|
| 17 |
+
entity fa4 is
|
| 18 |
+
port (va_i, vb_i: in bit_vector (3 downto 0);
|
| 19 |
+
c_i: in bit;
|
| 20 |
+
vs_o: out bit_vector (3 downto 0);
|
| 21 |
+
c_o: out bit
|
| 22 |
+
);
|
| 23 |
+
end entity fa4;
|
| 24 |
+
|
| 25 |
+
architecture fa4_rtl of fa4 is
|
| 26 |
+
|
| 27 |
+
use work.gates.fa1;
|
| 28 |
+
|
| 29 |
+
-- internal carry signals propagation
|
| 30 |
+
signal c_int: bit_vector (4 downto 0);
|
| 31 |
+
|
| 32 |
+
begin
|
| 33 |
+
|
| 34 |
+
-- carry in
|
| 35 |
+
c_int(0) <= c_i;
|
| 36 |
+
|
| 37 |
+
-- slice 0
|
| 38 |
+
s0: fa1 port map (c_i => c_int(0),
|
| 39 |
+
a_i => va_i(0),
|
| 40 |
+
b_i => vb_i(0),
|
| 41 |
+
s_o => vs_o(0),
|
| 42 |
+
c_o => c_int(1)
|
| 43 |
+
);
|
| 44 |
+
|
| 45 |
+
-- slice 1
|
| 46 |
+
s1: fa1 port map (c_i => c_int(1),
|
| 47 |
+
a_i => va_i(1),
|
| 48 |
+
b_i => vb_i(1),
|
| 49 |
+
s_o => vs_o(1),
|
| 50 |
+
c_o => c_int(2)
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
-- slice 2
|
| 54 |
+
s2: fa1 port map (c_i => c_int(2),
|
| 55 |
+
a_i => va_i(2),
|
| 56 |
+
b_i => vb_i(2),
|
| 57 |
+
s_o => vs_o(2),
|
| 58 |
+
c_o => c_int(3)
|
| 59 |
+
);
|
| 60 |
+
|
| 61 |
+
-- slice 3
|
| 62 |
+
s3: fa1 port map (c_i => c_int(3),
|
| 63 |
+
a_i => va_i(3),
|
| 64 |
+
b_i => vb_i(3),
|
| 65 |
+
s_o => vs_o(3),
|
| 66 |
+
c_o => c_int(4)
|
| 67 |
+
);
|
| 68 |
+
|
| 69 |
+
-- carry out
|
| 70 |
+
c_o <= c_int(4);
|
| 71 |
+
|
| 72 |
+
end architecture fa4_rtl;
|
| 73 |
+
|
| 74 |
+
-- Declare a 1-bit full-adder.
|
| 75 |
+
entity fa1 is
|
| 76 |
+
port (a_i, b_i, c_i: in bit;
|
| 77 |
+
s_o, c_o: out bit
|
| 78 |
+
);
|
| 79 |
+
end entity fa1;
|
| 80 |
+
|
| 81 |
+
architecture fa1_rtl of fa1 is
|
| 82 |
+
begin
|
| 83 |
+
s_o <= a_i xor b_i xor c_i;
|
| 84 |
+
c_o <= (a_i and b_i) or (c_i and (a_i xor b_i));
|
| 85 |
+
end architecture fa1_rtl;
|
steveicarus_ivtest/ivltests/vhdl_fa4_test4.v
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* This module instantiates the fa4 entity, which in turn
|
| 3 |
+
* instantiates other entities. This demonstrates hierarchical
|
| 4 |
+
* constructs in VHDL.
|
| 5 |
+
*/
|
| 6 |
+
module test;
|
| 7 |
+
|
| 8 |
+
reg [3:0] a, b;
|
| 9 |
+
reg cin;
|
| 10 |
+
|
| 11 |
+
wire [3:0] s;
|
| 12 |
+
wire cout;
|
| 13 |
+
|
| 14 |
+
initial begin
|
| 15 |
+
cin = 0;
|
| 16 |
+
a = 4'h2;
|
| 17 |
+
b = 4'h3;
|
| 18 |
+
end
|
| 19 |
+
|
| 20 |
+
initial begin
|
| 21 |
+
#1;
|
| 22 |
+
if (s !== 4'h5) begin
|
| 23 |
+
$display("Error in trivial sum");
|
| 24 |
+
$finish;
|
| 25 |
+
end
|
| 26 |
+
$display ("PASSED");
|
| 27 |
+
end
|
| 28 |
+
|
| 29 |
+
fa4 duv (.c_i(cin), .va_i(a), .vb_i(b), .vs_o(s), .c_o(cout) );
|
| 30 |
+
|
| 31 |
+
endmodule // test
|
steveicarus_ivtest/ivltests/vhdl_fa4_test4.vhd
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- In this test, we declare a component in the "mypackage" package
|
| 2 |
+
-- and show that it can be referenced within the package namespace.
|
| 3 |
+
-- it also shows the usage of subtypes, constants and signals
|
| 4 |
+
-- expressed in terms of defined subtypes
|
| 5 |
+
|
| 6 |
+
library ieee;
|
| 7 |
+
use ieee.numeric_bit.all;
|
| 8 |
+
|
| 9 |
+
package mypackage is
|
| 10 |
+
|
| 11 |
+
-- trivial sub type
|
| 12 |
+
subtype Myrange_t is integer range 0 to 4;
|
| 13 |
+
|
| 14 |
+
-- some constants
|
| 15 |
+
constant ZERO: Myrange_t := 0;
|
| 16 |
+
constant ONE: Myrange_t := 1;
|
| 17 |
+
constant TWO: Myrange_t := 2;
|
| 18 |
+
constant THREE: Myrange_t := 3;
|
| 19 |
+
constant FOUR: Myrange_t := 4;
|
| 20 |
+
|
| 21 |
+
-- another subtype
|
| 22 |
+
subtype AdderWidth_t is bit_vector (THREE downto ZERO);
|
| 23 |
+
subtype CarryWidth_t is bit_vector (THREE+1 downto ZERO);
|
| 24 |
+
|
| 25 |
+
-- full 1-bit adder
|
| 26 |
+
component fa1 is
|
| 27 |
+
port (a_i, b_i, c_i: in bit;
|
| 28 |
+
s_o, c_o: out bit);
|
| 29 |
+
end component fa1;
|
| 30 |
+
end package mypackage;
|
| 31 |
+
|
| 32 |
+
-- Declare and implement a 4-bit full-adder that uses the
|
| 33 |
+
-- 1-bit full-adder described above.
|
| 34 |
+
|
| 35 |
+
use work.mypackage.all;
|
| 36 |
+
entity fa4 is
|
| 37 |
+
port (va_i, vb_i: in AdderWidth_t;
|
| 38 |
+
c_i: in bit;
|
| 39 |
+
vs_o: out AdderWidth_t;
|
| 40 |
+
c_o: out bit
|
| 41 |
+
);
|
| 42 |
+
end entity fa4;
|
| 43 |
+
|
| 44 |
+
architecture fa4_rtl of fa4 is
|
| 45 |
+
|
| 46 |
+
-- auxiliary signal for carry
|
| 47 |
+
signal c_int: CarryWidth_t;
|
| 48 |
+
|
| 49 |
+
begin
|
| 50 |
+
|
| 51 |
+
-- carry in
|
| 52 |
+
c_int(ZERO) <= c_i;
|
| 53 |
+
|
| 54 |
+
-- slice 0
|
| 55 |
+
s0: fa1 port map (c_i => c_int(ZERO),
|
| 56 |
+
a_i => va_i(ZERO),
|
| 57 |
+
b_i => vb_i(ZERO),
|
| 58 |
+
s_o => vs_o(ZERO),
|
| 59 |
+
c_o => c_int(ONE)
|
| 60 |
+
);
|
| 61 |
+
|
| 62 |
+
-- slice 1
|
| 63 |
+
s1: fa1 port map (c_i => c_int(ONE),
|
| 64 |
+
a_i => va_i(ONE),
|
| 65 |
+
b_i => vb_i(ONE),
|
| 66 |
+
s_o => vs_o(ONE),
|
| 67 |
+
c_o => c_int(TWO)
|
| 68 |
+
);
|
| 69 |
+
|
| 70 |
+
-- slice 2
|
| 71 |
+
s2: fa1 port map (c_i => c_int(TWO),
|
| 72 |
+
a_i => va_i(TWO),
|
| 73 |
+
b_i => vb_i(TWO),
|
| 74 |
+
s_o => vs_o(TWO),
|
| 75 |
+
c_o => c_int(THREE)
|
| 76 |
+
);
|
| 77 |
+
|
| 78 |
+
-- slice 3
|
| 79 |
+
s3: fa1 port map (c_i => c_int(THREE),
|
| 80 |
+
a_i => va_i(THREE),
|
| 81 |
+
b_i => vb_i(THREE),
|
| 82 |
+
s_o => vs_o(THREE),
|
| 83 |
+
c_o => c_int(FOUR)
|
| 84 |
+
);
|
| 85 |
+
|
| 86 |
+
-- carry out
|
| 87 |
+
c_o <= c_int(FOUR);
|
| 88 |
+
|
| 89 |
+
end architecture fa4_rtl;
|
| 90 |
+
|
| 91 |
+
-- Declare a 1-bit full-adder.
|
| 92 |
+
entity fa1 is
|
| 93 |
+
port (a_i, b_i, c_i: in bit;
|
| 94 |
+
s_o, c_o: out bit
|
| 95 |
+
);
|
| 96 |
+
end entity fa1;
|
| 97 |
+
|
| 98 |
+
architecture fa1_rtl of fa1 is
|
| 99 |
+
begin
|
| 100 |
+
s_o <= a_i xor b_i xor c_i;
|
| 101 |
+
c_o <= (a_i and b_i) or (c_i and (a_i xor b_i));
|
| 102 |
+
end architecture fa1_rtl;
|
steveicarus_ivtest/ivltests/vhdl_file_open.v
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2016 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test file_open() function.
|
| 21 |
+
|
| 22 |
+
module file_open_test;
|
| 23 |
+
logic active, ok;
|
| 24 |
+
vhdl_file_open dut(active, ok);
|
| 25 |
+
|
| 26 |
+
initial begin
|
| 27 |
+
active = 1;
|
| 28 |
+
#1;
|
| 29 |
+
if(ok !== 1'b1) begin
|
| 30 |
+
$display("FAILED");
|
| 31 |
+
$finish();
|
| 32 |
+
end
|
| 33 |
+
|
| 34 |
+
$display("PASSED");
|
| 35 |
+
end
|
| 36 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_file_open.vhd
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2016 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test file_open() function.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
use ieee.numeric_std.all;
|
| 25 |
+
use std.textio.all;
|
| 26 |
+
|
| 27 |
+
entity vhdl_file_open is
|
| 28 |
+
port(active : in std_logic;
|
| 29 |
+
ok : out std_logic);
|
| 30 |
+
end vhdl_file_open;
|
| 31 |
+
|
| 32 |
+
architecture test of vhdl_file_open is
|
| 33 |
+
begin
|
| 34 |
+
process(active)
|
| 35 |
+
file ok_file, bad_file : text;
|
| 36 |
+
variable ok_status, bad_status : FILE_OPEN_STATUS;
|
| 37 |
+
begin
|
| 38 |
+
if rising_edge(active) then
|
| 39 |
+
file_open(ok_status, ok_file, "ivltests/vhdl_file_open.vhd", read_mode);
|
| 40 |
+
file_open(bad_status, bad_file, "not_existing_file", read_mode);
|
| 41 |
+
|
| 42 |
+
if ok_status = OPEN_OK and bad_status = NAME_ERROR then
|
| 43 |
+
ok := '1';
|
| 44 |
+
else
|
| 45 |
+
ok := '0';
|
| 46 |
+
end if;
|
| 47 |
+
file_close(ok_file);
|
| 48 |
+
end if;
|
| 49 |
+
end process;
|
| 50 |
+
end test;
|
steveicarus_ivtest/ivltests/vhdl_generic_default.v
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for generics without a default value.
|
| 21 |
+
|
| 22 |
+
module vhdl_generic_default_test;
|
| 23 |
+
logic a;
|
| 24 |
+
vhdl_generic_default #(.\value (1'b1))dut(a);
|
| 25 |
+
|
| 26 |
+
initial begin
|
| 27 |
+
if(a !== 1'b1) begin
|
| 28 |
+
$display("FAILED");
|
| 29 |
+
$finish();
|
| 30 |
+
end
|
| 31 |
+
$display("PASSED");
|
| 32 |
+
end
|
| 33 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_generic_default.vhd
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for generics without a default value.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
|
| 25 |
+
entity vhdl_generic_default is
|
| 26 |
+
generic(value : std_logic);
|
| 27 |
+
port(a : out std_logic);
|
| 28 |
+
end vhdl_generic_default;
|
| 29 |
+
|
| 30 |
+
architecture test of vhdl_generic_default is
|
| 31 |
+
begin
|
| 32 |
+
a <= value;
|
| 33 |
+
end test;
|
steveicarus_ivtest/ivltests/vhdl_generic_eval.v
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2015 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for generics evaluation.
|
| 21 |
+
|
| 22 |
+
module generic_eval();
|
| 23 |
+
reg [7:0] data;
|
| 24 |
+
reg out_bit_def, out_bit_ovr;
|
| 25 |
+
test_eval_generic dut(data, out_bit_def, out_bit_ovr);
|
| 26 |
+
|
| 27 |
+
initial begin
|
| 28 |
+
data = 8'b11010010;
|
| 29 |
+
#1;
|
| 30 |
+
|
| 31 |
+
if(out_bit_def !== 1'b0 || out_bit_ovr !== 1'b1) begin
|
| 32 |
+
$display("FAILED");
|
| 33 |
+
$finish();
|
| 34 |
+
end
|
| 35 |
+
|
| 36 |
+
$display("PASSED");
|
| 37 |
+
end
|
| 38 |
+
endmodule
|
steveicarus_ivtest/ivltests/vhdl_generic_eval.vhd
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
-- Copyright (c) 2015 CERN
|
| 2 |
+
-- Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
--
|
| 4 |
+
-- This source code is free software; you can redistribute it
|
| 5 |
+
-- and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
-- General Public License as published by the Free Software
|
| 7 |
+
-- Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
-- any later version.
|
| 9 |
+
--
|
| 10 |
+
-- This program is distributed in the hope that it will be useful,
|
| 11 |
+
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
-- GNU General Public License for more details.
|
| 14 |
+
--
|
| 15 |
+
-- You should have received a copy of the GNU General Public License
|
| 16 |
+
-- along with this program; if not, write to the Free Software
|
| 17 |
+
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
-- Test for generics evaluation.
|
| 21 |
+
|
| 22 |
+
library ieee;
|
| 23 |
+
use ieee.std_logic_1164.all;
|
| 24 |
+
|
| 25 |
+
entity eval_generic is
|
| 26 |
+
generic(
|
| 27 |
+
msb : integer range 1 to 7 := 7;
|
| 28 |
+
bit_select : integer range 0 to 7 := 3
|
| 29 |
+
);
|
| 30 |
+
port(
|
| 31 |
+
in_word : in std_logic_vector(msb downto 0);
|
| 32 |
+
out_bit : out std_logic
|
| 33 |
+
);
|
| 34 |
+
end entity eval_generic;
|
| 35 |
+
|
| 36 |
+
architecture test of eval_generic is
|
| 37 |
+
begin
|
| 38 |
+
out_bit <= in_word(bit_select);
|
| 39 |
+
end architecture test;
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
library ieee;
|
| 43 |
+
use ieee.std_logic_1164.all;
|
| 44 |
+
|
| 45 |
+
entity test_eval_generic is
|
| 46 |
+
port(
|
| 47 |
+
in_word : in std_logic_vector(7 downto 0);
|
| 48 |
+
out_bit_def, out_bit_ovr : out std_logic
|
| 49 |
+
);
|
| 50 |
+
end entity test_eval_generic;
|
| 51 |
+
|
| 52 |
+
architecture test of test_eval_generic is
|
| 53 |
+
constant const_int : integer := 7;
|
| 54 |
+
|
| 55 |
+
component eval_generic is
|
| 56 |
+
generic(
|
| 57 |
+
msb : integer range 1 to 7;
|
| 58 |
+
bit_select : integer range 0 to 7
|
| 59 |
+
);
|
| 60 |
+
port(
|
| 61 |
+
in_word : in std_logic_vector(msb downto 0);
|
| 62 |
+
out_bit : out std_logic
|
| 63 |
+
);
|
| 64 |
+
end component eval_generic;
|
| 65 |
+
begin
|
| 66 |
+
override_test_unit: eval_generic
|
| 67 |
+
generic map(bit_select => 2,
|
| 68 |
+
msb => const_int)
|
| 69 |
+
port map(
|
| 70 |
+
in_word => (others => '1'),
|
| 71 |
+
out_bit => out_bit_ovr
|
| 72 |
+
);
|
| 73 |
+
|
| 74 |
+
default_test_unit: eval_generic
|
| 75 |
+
port map(
|
| 76 |
+
in_word => in_word,
|
| 77 |
+
out_bit => out_bit_def
|
| 78 |
+
);
|
| 79 |
+
end architecture test;
|
steveicarus_ivtest/ivltests/vhdl_image_attr.v
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (c) 2016 CERN
|
| 2 |
+
// Maciej Suminski <maciej.suminski@cern.ch>
|
| 3 |
+
//
|
| 4 |
+
// This source code is free software; you can redistribute it
|
| 5 |
+
// and/or modify it in source code form under the terms of the GNU
|
| 6 |
+
// General Public License as published by the Free Software
|
| 7 |
+
// Foundation; either version 2 of the License, or (at your option)
|
| 8 |
+
// any later version.
|
| 9 |
+
//
|
| 10 |
+
// This program is distributed in the hope that it will be useful,
|
| 11 |
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
+
// GNU General Public License for more details.
|
| 14 |
+
//
|
| 15 |
+
// You should have received a copy of the GNU General Public License
|
| 16 |
+
// along with this program; if not, write to the Free Software
|
| 17 |
+
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
// Test for 'image attribute in VHDL.
|
| 21 |
+
|
| 22 |
+
module image_attr_test;
|
| 23 |
+
logic start_test;
|
| 24 |
+
image_attr_entity dut(start_test);
|
| 25 |
+
|
| 26 |
+
initial begin
|
| 27 |
+
start_test = 1'b0;
|
| 28 |
+
#1 start_test = 1'b1;
|
| 29 |
+
end
|
| 30 |
+
endmodule
|