add chips/yosys (part 9)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- chips/yosys/tests/verific/mixed_flist.flist +2 -0
- chips/yosys/tests/verific/mixed_flist.sv +4 -0
- chips/yosys/tests/verific/mixed_flist.vhd +14 -0
- chips/yosys/tests/verific/mixed_flist.ys +3 -0
- chips/yosys/tests/verific/port_bus_order.ys +13 -0
- chips/yosys/tests/verific/range_case.sv +11 -0
- chips/yosys/tests/verific/range_case.ys +16 -0
- chips/yosys/tests/verific/rom_case.ys +78 -0
- chips/yosys/tests/verific/setenv.flist +1 -0
- chips/yosys/tests/verific/setenv.ys +4 -0
- chips/yosys/tests/verific/sva_continue_on_err.ys +38 -0
- chips/yosys/tests/verific/sva_continue_on_err_explosion.ys +31 -0
- chips/yosys/tests/verific/sva_eventually.sv +85 -0
- chips/yosys/tests/verific/sva_eventually.ys +103 -0
- chips/yosys/tests/verific/sva_expect.ys +10 -0
- chips/yosys/tests/verific/sva_muxing.ys +81 -0
- chips/yosys/tests/verific/sva_no_continue_on_err.ys +9 -0
- chips/yosys/tests/verilog/.gitignore +11 -0
- chips/yosys/tests/verilog/absurd_width.ys +17 -0
- chips/yosys/tests/verilog/absurd_width_const.ys +16 -0
- chips/yosys/tests/verilog/always_comb_latch_1.ys +13 -0
- chips/yosys/tests/verilog/always_comb_latch_2.ys +15 -0
- chips/yosys/tests/verilog/always_comb_latch_3.ys +20 -0
- chips/yosys/tests/verilog/always_comb_latch_4.ys +17 -0
- chips/yosys/tests/verilog/always_comb_nolatch_1.ys +16 -0
- chips/yosys/tests/verilog/always_comb_nolatch_2.ys +17 -0
- chips/yosys/tests/verilog/always_comb_nolatch_3.ys +21 -0
- chips/yosys/tests/verilog/always_comb_nolatch_4.ys +16 -0
- chips/yosys/tests/verilog/always_comb_nolatch_5.ys +15 -0
- chips/yosys/tests/verilog/always_comb_nolatch_6.ys +15 -0
- chips/yosys/tests/verilog/asgn_expr.sv +73 -0
- chips/yosys/tests/verilog/asgn_expr.ys +4 -0
- chips/yosys/tests/verilog/asgn_expr_not_proc_1.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_proc_2.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_proc_3.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_proc_4.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_proc_5.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_sv_1.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_sv_2.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_sv_3.ys +7 -0
- chips/yosys/tests/verilog/asgn_expr_not_sv_4.ys +15 -0
- chips/yosys/tests/verilog/assign_to_reg.ys +22 -0
- chips/yosys/tests/verilog/atom_type_signedness.ys +19 -0
- chips/yosys/tests/verilog/attr_signed.ys +21 -0
- chips/yosys/tests/verilog/automatic_lifetime.ys +109 -0
- chips/yosys/tests/verilog/block_end_label_only.ys +9 -0
- chips/yosys/tests/verilog/block_end_label_wrong.ys +9 -0
- chips/yosys/tests/verilog/block_labels.ys +26 -0
- chips/yosys/tests/verilog/bug2037.ys +58 -0
- chips/yosys/tests/verilog/bug2042-sv.ys +61 -0
chips/yosys/tests/verific/mixed_flist.flist
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
mixed_flist.sv
|
| 2 |
+
mixed_flist.vhd
|
chips/yosys/tests/verific/mixed_flist.sv
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module sv_top(input logic a, output logic y);
|
| 2 |
+
// Instantiates VHDL entity to ensure mixed -f list is required
|
| 3 |
+
vhdl_mod u_vhdl(.a(a), .y(y));
|
| 4 |
+
endmodule
|
chips/yosys/tests/verific/mixed_flist.vhd
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library ieee;
|
| 2 |
+
use ieee.std_logic_1164.all;
|
| 3 |
+
|
| 4 |
+
entity vhdl_mod is
|
| 5 |
+
port (
|
| 6 |
+
a : in std_logic;
|
| 7 |
+
y : out std_logic
|
| 8 |
+
);
|
| 9 |
+
end entity vhdl_mod;
|
| 10 |
+
|
| 11 |
+
architecture rtl of vhdl_mod is
|
| 12 |
+
begin
|
| 13 |
+
y <= a;
|
| 14 |
+
end architecture rtl;
|
chips/yosys/tests/verific/mixed_flist.ys
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -f -sv mixed_flist.flist
|
| 2 |
+
verific -import sv_top
|
| 3 |
+
select -assert-mod-count 1 sv_top
|
chips/yosys/tests/verific/port_bus_order.ys
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -sv <<EOT
|
| 2 |
+
module simple (
|
| 3 |
+
input [3:0] I2,
|
| 4 |
+
input [3:0] I1,
|
| 5 |
+
output [3:0] result
|
| 6 |
+
);
|
| 7 |
+
assign result = I2 & I1;
|
| 8 |
+
endmodule
|
| 9 |
+
EOT
|
| 10 |
+
verific -import simple
|
| 11 |
+
|
| 12 |
+
write_verilog verilog_port_bus_order.out
|
| 13 |
+
!grep -qF 'simple(I2, I1, result)' verilog_port_bus_order.out
|
chips/yosys/tests/verific/range_case.sv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top(input clk, input signed [3:0] sel_w , output reg out);
|
| 2 |
+
|
| 3 |
+
always @ (posedge clk)
|
| 4 |
+
begin
|
| 5 |
+
case (sel_w) inside
|
| 6 |
+
[-4:3] : out <= 1'b1;
|
| 7 |
+
[4:5] : out <= 1'b0;
|
| 8 |
+
endcase
|
| 9 |
+
end
|
| 10 |
+
|
| 11 |
+
endmodule
|
chips/yosys/tests/verific/range_case.ys
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -cfg db_abstract_case_statement_synthesis 0
|
| 2 |
+
read -sv range_case.sv
|
| 3 |
+
verific -import top
|
| 4 |
+
proc
|
| 5 |
+
rename top gold
|
| 6 |
+
|
| 7 |
+
verific -cfg db_abstract_case_statement_synthesis 1
|
| 8 |
+
read -sv range_case.sv
|
| 9 |
+
verific -import top
|
| 10 |
+
proc
|
| 11 |
+
rename top gate
|
| 12 |
+
|
| 13 |
+
miter -equiv -flatten -make_assert gold gate miter
|
| 14 |
+
prep -top miter
|
| 15 |
+
clk2fflogic
|
| 16 |
+
sat -set-init-zero -tempinduct -prove-asserts -verify
|
chips/yosys/tests/verific/rom_case.ys
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -sv <<EOF
|
| 2 |
+
module rom(input clk, input [2:0] addr, (* ram_style = "block" *) output reg [7:0] data);
|
| 3 |
+
|
| 4 |
+
always @(posedge clk) begin
|
| 5 |
+
case (addr)
|
| 6 |
+
3'b000: data <= 8'h12;
|
| 7 |
+
3'b001: data <= 8'hAB;
|
| 8 |
+
3'b010: data <= 8'h42;
|
| 9 |
+
3'b011: data <= 8'h23;
|
| 10 |
+
3'b100: data <= 8'h66;
|
| 11 |
+
3'b101: data <= 8'hC0;
|
| 12 |
+
3'b110: data <= 8'h3F;
|
| 13 |
+
3'b111: data <= 8'h95;
|
| 14 |
+
endcase
|
| 15 |
+
end
|
| 16 |
+
|
| 17 |
+
endmodule
|
| 18 |
+
EOF
|
| 19 |
+
hierarchy -top rom
|
| 20 |
+
proc
|
| 21 |
+
opt
|
| 22 |
+
opt -full
|
| 23 |
+
memory -nomap
|
| 24 |
+
dump
|
| 25 |
+
memory_libmap -lib ../memlib/memlib_block_sdp.txt
|
| 26 |
+
memory_map
|
| 27 |
+
stat
|
| 28 |
+
select -assert-count 1 t:RAM_BLOCK_SDP
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
design -reset
|
| 32 |
+
|
| 33 |
+
verific -vhdl <<EOF
|
| 34 |
+
library IEEE;
|
| 35 |
+
use IEEE.std_logic_1164.all;
|
| 36 |
+
use ieee.std_logic_unsigned.all;
|
| 37 |
+
|
| 38 |
+
entity rom_example is
|
| 39 |
+
port (
|
| 40 |
+
clk : in std_logic;
|
| 41 |
+
addr : in std_logic_vector(2 downto 0);
|
| 42 |
+
data : out std_logic_vector (7 downto 0)
|
| 43 |
+
);
|
| 44 |
+
end entity rom_example;
|
| 45 |
+
|
| 46 |
+
architecture rtl of rom_example is
|
| 47 |
+
attribute rom_style : string;
|
| 48 |
+
attribute rom_style of data : signal is "block";
|
| 49 |
+
begin
|
| 50 |
+
|
| 51 |
+
p_rom : process(clk)
|
| 52 |
+
begin
|
| 53 |
+
if rising_edge(clk) then
|
| 54 |
+
case addr is
|
| 55 |
+
when "000" => data <= X"12";
|
| 56 |
+
when "001" => data <= X"AB";
|
| 57 |
+
when "010" => data <= X"42";
|
| 58 |
+
when "011" => data <= X"23";
|
| 59 |
+
when "100" => data <= X"66";
|
| 60 |
+
when "101" => data <= X"C0";
|
| 61 |
+
when "110" => data <= X"3F";
|
| 62 |
+
when others => data <= X"95";
|
| 63 |
+
end case;
|
| 64 |
+
end if;
|
| 65 |
+
end process p_rom;
|
| 66 |
+
|
| 67 |
+
end architecture rtl;
|
| 68 |
+
EOF
|
| 69 |
+
hierarchy -top rom_example
|
| 70 |
+
proc
|
| 71 |
+
opt
|
| 72 |
+
opt -full
|
| 73 |
+
memory -nomap
|
| 74 |
+
dump
|
| 75 |
+
memory_libmap -lib ../memlib/memlib_block_sdp.txt
|
| 76 |
+
memory_map
|
| 77 |
+
stat
|
| 78 |
+
select -assert-count 1 t:RAM_BLOCK_SDP
|
chips/yosys/tests/verific/setenv.flist
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
${filename}
|
chips/yosys/tests/verific/setenv.ys
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
setenv filename case.sv
|
| 2 |
+
verific -f -sv setenv.flist
|
| 3 |
+
verific -import top
|
| 4 |
+
select -assert-mod-count 1 top
|
chips/yosys/tests/verific/sva_continue_on_err.ys
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -sv <<EOF
|
| 2 |
+
module top(input clk, input a, input b);
|
| 3 |
+
|
| 4 |
+
prop_supported: assert property (@(posedge clk) a ##1 b |=> b);
|
| 5 |
+
prop_unsupported1: assert property (@(posedge clk) a ##1 b #=# b);
|
| 6 |
+
prop_unsupported2: assert property (@(posedge clk) a ##1 @(posedge b) ##1 a);
|
| 7 |
+
|
| 8 |
+
sequence local_var_seq;
|
| 9 |
+
logic v;
|
| 10 |
+
(1, v = a) ##1 b ##1 (v == a);
|
| 11 |
+
endsequence
|
| 12 |
+
|
| 13 |
+
prop_unsupported3: assert property (@(posedge clk) local_var_seq);
|
| 14 |
+
|
| 15 |
+
endmodule
|
| 16 |
+
EOF
|
| 17 |
+
|
| 18 |
+
logger -expect warning "Mixed clocking is currently not supported" 1
|
| 19 |
+
logger -expect warning "Verific SVA primitive sva_non_overlapped_followed_by .* is currently unsupported in this context" 1
|
| 20 |
+
logger -expect warning "SVA sequences with local variable assignments are currently not supported" 1
|
| 21 |
+
logger -expect warning "Encountered 3 items containing unsupported SVA" 1
|
| 22 |
+
verific -import -sva-continue-on-err top
|
| 23 |
+
logger -check-expected
|
| 24 |
+
|
| 25 |
+
select -assert-count 4 top/t:$assert
|
| 26 |
+
select -assert-count 4 top/a:unsupported_sva top/prop_supported %% top/t:$assert %i
|
| 27 |
+
|
| 28 |
+
select -assert-count 3 top/a:unsupported_sva
|
| 29 |
+
select -assert-count 3 top/a:unsupported_sva top/prop_unsupported* %i
|
| 30 |
+
select -assert-count 1 top/a:unsupported_sva top/prop_unsupported1 %i
|
| 31 |
+
select -assert-count 1 top/a:unsupported_sva top/prop_unsupported2 %i
|
| 32 |
+
select -assert-count 1 top/a:unsupported_sva top/prop_unsupported3 %i
|
| 33 |
+
select -assert-count 0 top/a:unsupported_sva top/prop_supported %i
|
| 34 |
+
select -assert-count 1 top/prop_supported
|
| 35 |
+
|
| 36 |
+
logger -expect error "uses unsupported SVA constructs." 1
|
| 37 |
+
hierarchy -smtcheck -top top
|
| 38 |
+
logger -check-expected
|
chips/yosys/tests/verific/sva_continue_on_err_explosion.ys
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -sv <<EOF
|
| 2 |
+
module top(input clk, input a, input b);
|
| 3 |
+
|
| 4 |
+
prop_supported1: assert property (@(posedge clk) a ##1 b |=> b);
|
| 5 |
+
|
| 6 |
+
prop_exploding: assert property (@(posedge clk)
|
| 7 |
+
((a [*7] ##1 b) [*11]) and
|
| 8 |
+
((a [*11] ##1 b) [*7]) and
|
| 9 |
+
((a [*13] ##1 b) [*5]) and
|
| 10 |
+
((a [*5] ##1 b) [*13])
|
| 11 |
+
);
|
| 12 |
+
|
| 13 |
+
prop_supported2: assert property (@(posedge clk) a [*5] ##1 b |=> b);
|
| 14 |
+
|
| 15 |
+
endmodule
|
| 16 |
+
EOF
|
| 17 |
+
|
| 18 |
+
logger -expect warning "Stopping to prevent exponential design size explosion." 1
|
| 19 |
+
verific -import -sva-continue-on-err top
|
| 20 |
+
logger -check-expected
|
| 21 |
+
|
| 22 |
+
select -assert-count 3 top/t:$assert
|
| 23 |
+
select -assert-count 1 top/a:unsupported_sva top/prop_exploding %% top/t:$assert %i
|
| 24 |
+
|
| 25 |
+
select -assert-count 0 top/a:unsupported_sva top/prop_supported1 %i
|
| 26 |
+
select -assert-count 0 top/a:unsupported_sva top/prop_supported2 %i
|
| 27 |
+
select -assert-count 2 top/prop_supported*
|
| 28 |
+
|
| 29 |
+
logger -expect error "uses unsupported SVA constructs." 1
|
| 30 |
+
hierarchy -smtcheck -top top
|
| 31 |
+
logger -check-expected
|
chips/yosys/tests/verific/sva_eventually.sv
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module cover_immediate (input clk, rst);
|
| 2 |
+
cover property (@(posedge clk) disable iff (rst) s_eventually 1'b0);
|
| 3 |
+
endmodule
|
| 4 |
+
|
| 5 |
+
module cover_mixed (input clk, rst);
|
| 6 |
+
always @(posedge clk)
|
| 7 |
+
cover property (disable iff (rst) s_eventually 1'b0);
|
| 8 |
+
endmodule
|
| 9 |
+
|
| 10 |
+
module cover_sequential (input clk, rst);
|
| 11 |
+
always @(posedge clk)
|
| 12 |
+
if (!rst)
|
| 13 |
+
cover property (s_eventually 1'b0);
|
| 14 |
+
endmodule
|
| 15 |
+
|
| 16 |
+
module assert_immediate (input clk, rst);
|
| 17 |
+
assert property (@(posedge clk) disable iff (rst) s_eventually 1'b0);
|
| 18 |
+
endmodule
|
| 19 |
+
|
| 20 |
+
module assert_sequential (input clk, rst);
|
| 21 |
+
always @(posedge clk)
|
| 22 |
+
if (!rst)
|
| 23 |
+
assert property (s_eventually 1'b0);
|
| 24 |
+
endmodule
|
| 25 |
+
|
| 26 |
+
module assert_bounded (input clk);
|
| 27 |
+
assert property (@(posedge clk) s_eventually [1:4] 1'b0);
|
| 28 |
+
endmodule
|
| 29 |
+
|
| 30 |
+
module cover_sequential_disable (input clk, rst, en);
|
| 31 |
+
always @(posedge clk)
|
| 32 |
+
if (en)
|
| 33 |
+
cover property (disable iff (rst) s_eventually 1'b0);
|
| 34 |
+
endmodule
|
| 35 |
+
|
| 36 |
+
module assert_sequential_disable (input clk, rst, en);
|
| 37 |
+
always @(posedge clk)
|
| 38 |
+
if (en)
|
| 39 |
+
assert property (disable iff (rst) s_eventually 1'b0);
|
| 40 |
+
endmodule
|
| 41 |
+
|
| 42 |
+
module cover_implication_disable (input clk, rst, en);
|
| 43 |
+
always @(posedge clk)
|
| 44 |
+
cover property (disable iff (rst) en |-> s_eventually 1'b0);
|
| 45 |
+
endmodule
|
| 46 |
+
|
| 47 |
+
module cover_and (input clk, rst, en);
|
| 48 |
+
always @(posedge clk)
|
| 49 |
+
cover property (en and s_eventually 1'b0);
|
| 50 |
+
endmodule
|
| 51 |
+
|
| 52 |
+
module cover_if (input clk, rst, en);
|
| 53 |
+
always @(posedge clk)
|
| 54 |
+
cover property (if (en) s_eventually 1'b0);
|
| 55 |
+
endmodule
|
| 56 |
+
|
| 57 |
+
module assert_bounded_implication (input clk, en, a);
|
| 58 |
+
assert property (@(posedge clk) en |-> s_eventually [1:4] a);
|
| 59 |
+
endmodule
|
| 60 |
+
|
| 61 |
+
module cover_clock_enable (input clk, ce, en, rst);
|
| 62 |
+
always @(posedge clk iff ce)
|
| 63 |
+
if (en)
|
| 64 |
+
cover property (disable iff (rst) s_eventually 1'b0);
|
| 65 |
+
endmodule
|
| 66 |
+
|
| 67 |
+
module assert_clock_enable (input clk, ce, en, rst);
|
| 68 |
+
always @(posedge clk iff ce)
|
| 69 |
+
if (en)
|
| 70 |
+
assert property (disable iff (rst) s_eventually 1'b0);
|
| 71 |
+
endmodule
|
| 72 |
+
|
| 73 |
+
module assert_nested_disable (input clk, en, rst, a);
|
| 74 |
+
property p;
|
| 75 |
+
@(posedge clk) disable iff (rst) s_eventually a;
|
| 76 |
+
endproperty
|
| 77 |
+
assert property (p);
|
| 78 |
+
endmodule
|
| 79 |
+
|
| 80 |
+
module assert_nested_disable_outer (input clk, en, rst, a);
|
| 81 |
+
property p;
|
| 82 |
+
@(posedge clk) s_eventually a;
|
| 83 |
+
endproperty
|
| 84 |
+
assert property (disable iff (rst) p);
|
| 85 |
+
endmodule
|
chips/yosys/tests/verific/sva_eventually.ys
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# cover statements are not currently compatible with eventually properties
|
| 2 |
+
verific -formal sva_eventually.sv
|
| 3 |
+
|
| 4 |
+
logger -expect warning "Unsupported eventually cover" 1
|
| 5 |
+
verific -import -sva-continue-on-err cover_immediate
|
| 6 |
+
logger -check-expected
|
| 7 |
+
|
| 8 |
+
design -reset
|
| 9 |
+
verific -formal sva_eventually.sv
|
| 10 |
+
|
| 11 |
+
logger -expect warning "Unsupported eventually cover" 1
|
| 12 |
+
verific -import -sva-continue-on-err cover_mixed
|
| 13 |
+
logger -check-expected
|
| 14 |
+
|
| 15 |
+
# even if there is a mux or disable in the way
|
| 16 |
+
design -reset
|
| 17 |
+
verific -formal sva_eventually.sv
|
| 18 |
+
|
| 19 |
+
logger -expect warning "Unsupported eventually cover" 1
|
| 20 |
+
verific -import -sva-continue-on-err cover_sequential
|
| 21 |
+
logger -check-expected
|
| 22 |
+
|
| 23 |
+
design -reset
|
| 24 |
+
verific -formal sva_eventually.sv
|
| 25 |
+
|
| 26 |
+
logger -expect warning "Unsupported eventually cover" 1
|
| 27 |
+
verific -import -sva-continue-on-err cover_sequential_disable
|
| 28 |
+
logger -check-expected
|
| 29 |
+
|
| 30 |
+
design -reset
|
| 31 |
+
verific -formal sva_eventually.sv
|
| 32 |
+
|
| 33 |
+
logger -expect warning "Unsupported eventually cover" 1
|
| 34 |
+
verific -import -sva-continue-on-err cover_implication_disable
|
| 35 |
+
logger -check-expected
|
| 36 |
+
|
| 37 |
+
design -reset
|
| 38 |
+
verific -formal sva_eventually.sv
|
| 39 |
+
|
| 40 |
+
logger -expect warning "Unsupported eventually cover" 1
|
| 41 |
+
verific -import -sva-continue-on-err cover_clock_enable
|
| 42 |
+
logger -check-expected
|
| 43 |
+
|
| 44 |
+
# other kinds of nesting, e.g. and, are also unsupported (though here it is
|
| 45 |
+
# generally unsupported not just because of the cover)
|
| 46 |
+
design -reset
|
| 47 |
+
verific -formal sva_eventually.sv
|
| 48 |
+
|
| 49 |
+
logger -expect warning "currently unsupported" 1
|
| 50 |
+
verific -import -sva-continue-on-err cover_and
|
| 51 |
+
logger -check-expected
|
| 52 |
+
|
| 53 |
+
design -reset
|
| 54 |
+
verific -formal sva_eventually.sv
|
| 55 |
+
|
| 56 |
+
logger -expect warning "currently unsupported" 1
|
| 57 |
+
verific -import -sva-continue-on-err cover_if
|
| 58 |
+
logger -check-expected
|
| 59 |
+
|
| 60 |
+
# asserts import fine, regardless of nesting
|
| 61 |
+
design -reset
|
| 62 |
+
verific -formal sva_eventually.sv
|
| 63 |
+
verific -import assert_immediate
|
| 64 |
+
|
| 65 |
+
design -reset
|
| 66 |
+
verific -formal sva_eventually.sv
|
| 67 |
+
verific -import assert_sequential
|
| 68 |
+
|
| 69 |
+
design -reset
|
| 70 |
+
verific -formal sva_eventually.sv
|
| 71 |
+
verific -import assert_sequential_disable
|
| 72 |
+
|
| 73 |
+
design -reset
|
| 74 |
+
verific -formal sva_eventually.sv
|
| 75 |
+
verific -import assert_clock_enable
|
| 76 |
+
|
| 77 |
+
design -reset
|
| 78 |
+
verific -formal sva_eventually.sv
|
| 79 |
+
verific -import assert_nested_disable
|
| 80 |
+
logger -check-expected
|
| 81 |
+
|
| 82 |
+
# bounded eventually properties are not currently supported
|
| 83 |
+
design -reset
|
| 84 |
+
verific -formal sva_eventually.sv
|
| 85 |
+
|
| 86 |
+
logger -expect warning "Unsupported bounded eventually" 1
|
| 87 |
+
verific -import -sva-continue-on-err assert_bounded
|
| 88 |
+
logger -check-expected
|
| 89 |
+
|
| 90 |
+
design -reset
|
| 91 |
+
verific -formal sva_eventually.sv
|
| 92 |
+
|
| 93 |
+
logger -expect warning "Unsupported bounded eventually" 1
|
| 94 |
+
verific -import -sva-continue-on-err assert_bounded_implication
|
| 95 |
+
logger -check-expected
|
| 96 |
+
|
| 97 |
+
design -reset
|
| 98 |
+
verific -formal sva_eventually.sv
|
| 99 |
+
|
| 100 |
+
# disabling a clocked property is currently not supported
|
| 101 |
+
logger -expect warning "sva_disable_iff" 1
|
| 102 |
+
verific -import -sva-continue-on-err assert_nested_disable_outer
|
| 103 |
+
logger -check-expected
|
chips/yosys/tests/verific/sva_expect.ys
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -formal << EOT
|
| 2 |
+
module top (input clk, a);
|
| 3 |
+
always @(posedge clk)
|
| 4 |
+
expect (a);
|
| 5 |
+
endmodule
|
| 6 |
+
EOT
|
| 7 |
+
|
| 8 |
+
logger -expect warning "Unsupported Verific primitive .* of type sva_expect" 1
|
| 9 |
+
verific -import -k top
|
| 10 |
+
logger -check-expected
|
chips/yosys/tests/verific/sva_muxing.ys
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
verific -sv << EOT
|
| 2 |
+
module top (input clk, en, a, b);
|
| 3 |
+
always @(posedge clk) if (en) assert property (a ##1 b);
|
| 4 |
+
endmodule
|
| 5 |
+
EOT
|
| 6 |
+
verific -import top
|
| 7 |
+
select -assert-any t:$assert %ci* i:a %i
|
| 8 |
+
select -assert-any t:$assert %ci* i:en %i
|
| 9 |
+
|
| 10 |
+
design -reset
|
| 11 |
+
verific -sv << EOT
|
| 12 |
+
module top (input clk, rst, en, a);
|
| 13 |
+
always @(posedge clk) if (en) assert property (disable iff (rst) a);
|
| 14 |
+
endmodule
|
| 15 |
+
EOT
|
| 16 |
+
verific -import top
|
| 17 |
+
select -assert-any t:$assert %ci* i:a %i
|
| 18 |
+
select -assert-any t:$assert %ci* i:en %i
|
| 19 |
+
|
| 20 |
+
design -reset
|
| 21 |
+
verific -sv << EOT
|
| 22 |
+
module top (input clk, en, a);
|
| 23 |
+
assert property (@(posedge clk iff en) a);
|
| 24 |
+
endmodule
|
| 25 |
+
EOT
|
| 26 |
+
verific -import top
|
| 27 |
+
select -assert-any t:$assert %ci* i:a %i
|
| 28 |
+
select -assert-any t:$assert %ci* i:en %i
|
| 29 |
+
|
| 30 |
+
design -reset
|
| 31 |
+
verific -sv << EOT
|
| 32 |
+
module top (input clk, en, a, b);
|
| 33 |
+
always @(posedge clk) if (en) cover property (a ##1 b);
|
| 34 |
+
endmodule
|
| 35 |
+
EOT
|
| 36 |
+
verific -import top
|
| 37 |
+
select -assert-any t:$cover %ci* i:a %i
|
| 38 |
+
select -assert-any t:$cover %ci* i:en %i
|
| 39 |
+
|
| 40 |
+
design -reset
|
| 41 |
+
verific -sv << EOT
|
| 42 |
+
module top (input clk, rst, en, a);
|
| 43 |
+
always @(posedge clk) if (en) cover property (disable iff (rst) a);
|
| 44 |
+
endmodule
|
| 45 |
+
EOT
|
| 46 |
+
verific -import top
|
| 47 |
+
select -assert-any t:$cover %ci* i:a %i
|
| 48 |
+
select -assert-any t:$cover %ci* i:en %i
|
| 49 |
+
|
| 50 |
+
design -reset
|
| 51 |
+
verific -sv << EOT
|
| 52 |
+
module top (input clk, en, a);
|
| 53 |
+
always @(posedge clk iff en) cover property (a);
|
| 54 |
+
endmodule
|
| 55 |
+
EOT
|
| 56 |
+
verific -import top
|
| 57 |
+
select -assert-any t:$cover %ci* i:a %i
|
| 58 |
+
select -assert-any t:$cover %ci* i:en %i
|
| 59 |
+
|
| 60 |
+
design -reset
|
| 61 |
+
verific -sv << EOT
|
| 62 |
+
module top (input clk, en, a);
|
| 63 |
+
cover property (@(posedge clk iff en) a);
|
| 64 |
+
endmodule
|
| 65 |
+
EOT
|
| 66 |
+
verific -import top
|
| 67 |
+
select -assert-any t:$cover %ci* i:a %i
|
| 68 |
+
select -assert-any t:$cover %ci* i:en %i
|
| 69 |
+
|
| 70 |
+
design -reset
|
| 71 |
+
verific -sv << EOT
|
| 72 |
+
module top (input clk, ce, en, rst, a);
|
| 73 |
+
always @(posedge clk iff ce) if (en) cover property (disable iff (rst) a);
|
| 74 |
+
endmodule
|
| 75 |
+
EOT
|
| 76 |
+
verific -import top
|
| 77 |
+
select -assert-any t:$cover %ci* i:a %i
|
| 78 |
+
select -assert-any t:$cover %ci* i:en %i
|
| 79 |
+
select -assert-any t:$cover %ci* i:rst %i
|
| 80 |
+
select -assert-any t:$cover %ci* i:clk %i
|
| 81 |
+
select -assert-any t:$cover %ci* i:ce %i
|
chips/yosys/tests/verific/sva_no_continue_on_err.ys
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
verific -sv <<EOF
|
| 3 |
+
module top(input clk, input a, input b);
|
| 4 |
+
prop_unsupported: assert property (@(posedge clk) a ##1 @(posedge b) ##1 a);
|
| 5 |
+
endmodule;
|
| 6 |
+
EOF
|
| 7 |
+
|
| 8 |
+
logger -expect error "Mixed clocking is currently not supported" 1
|
| 9 |
+
verific -import top
|
chips/yosys/tests/verilog/.gitignore
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/bug5572.v
|
| 2 |
+
/const_arst.v
|
| 3 |
+
/const_sr.v
|
| 4 |
+
/doubleslash.v
|
| 5 |
+
/reset_auto_counter.v
|
| 6 |
+
/roundtrip_proc_1.v
|
| 7 |
+
/roundtrip_proc_2.v
|
| 8 |
+
/assign_to_reg.v
|
| 9 |
+
/subdir
|
| 10 |
+
/temp_foo.v
|
| 11 |
+
/temp
|
chips/yosys/tests/verilog/absurd_width.ys
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Expression width 1073741824 exceeds implementation limit of 16777216!" 1
|
| 2 |
+
read_verilog <<EOF
|
| 3 |
+
module top(
|
| 4 |
+
input inp,
|
| 5 |
+
output out
|
| 6 |
+
);
|
| 7 |
+
assign out =
|
| 8 |
+
{1024 {
|
| 9 |
+
{1024 {
|
| 10 |
+
{1024 {
|
| 11 |
+
inp
|
| 12 |
+
}}
|
| 13 |
+
}}
|
| 14 |
+
}}
|
| 15 |
+
;
|
| 16 |
+
endmodule
|
| 17 |
+
EOF
|
chips/yosys/tests/verilog/absurd_width_const.ys
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Expression width 1073741824 exceeds implementation limit of 16777216!" 1
|
| 2 |
+
read_verilog <<EOF
|
| 3 |
+
module top(
|
| 4 |
+
output out
|
| 5 |
+
);
|
| 6 |
+
assign out =
|
| 7 |
+
{1024 {
|
| 8 |
+
{1024 {
|
| 9 |
+
{1024 {
|
| 10 |
+
1'b1
|
| 11 |
+
}}
|
| 12 |
+
}}
|
| 13 |
+
}}
|
| 14 |
+
;
|
| 15 |
+
endmodule
|
| 16 |
+
EOF
|
chips/yosys/tests/verilog/always_comb_latch_1.ys
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic x;
|
| 4 |
+
always_comb begin
|
| 5 |
+
logic y;
|
| 6 |
+
if (x)
|
| 7 |
+
y = 1;
|
| 8 |
+
x = y;
|
| 9 |
+
end
|
| 10 |
+
endmodule
|
| 11 |
+
EOF
|
| 12 |
+
logger -expect error "^Latch inferred for signal `\\top\.\$unnamed_block\$1\.y' from always_comb process" 1
|
| 13 |
+
proc
|
chips/yosys/tests/verilog/always_comb_latch_2.ys
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic x;
|
| 4 |
+
always_comb begin
|
| 5 |
+
logic y;
|
| 6 |
+
if (x)
|
| 7 |
+
x = 1;
|
| 8 |
+
else
|
| 9 |
+
y = 1;
|
| 10 |
+
x = y;
|
| 11 |
+
end
|
| 12 |
+
endmodule
|
| 13 |
+
EOF
|
| 14 |
+
logger -expect error "^Latch inferred for signal `\\top\.\$unnamed_block\$1\.y' from always_comb process" 1
|
| 15 |
+
proc
|
chips/yosys/tests/verilog/always_comb_latch_3.ys
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic x;
|
| 4 |
+
logic z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin
|
| 7 |
+
logic y;
|
| 8 |
+
case (x)
|
| 9 |
+
1'b0:
|
| 10 |
+
y = 1;
|
| 11 |
+
endcase
|
| 12 |
+
if (z)
|
| 13 |
+
x = y;
|
| 14 |
+
else
|
| 15 |
+
x = 1'b0;
|
| 16 |
+
end
|
| 17 |
+
endmodule
|
| 18 |
+
EOF
|
| 19 |
+
logger -expect error "^Latch inferred for signal `\\top\.\$unnamed_block\$1\.y' from always_comb process" 1
|
| 20 |
+
proc
|
chips/yosys/tests/verilog/always_comb_latch_4.ys
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
parameter AVOID_LATCH = 0;
|
| 4 |
+
logic x, z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin
|
| 7 |
+
logic y;
|
| 8 |
+
if (z)
|
| 9 |
+
y = 0;
|
| 10 |
+
for (int i = 1; i == AVOID_LATCH; i++)
|
| 11 |
+
y = 1;
|
| 12 |
+
x = z ? y : 1'b0;
|
| 13 |
+
end
|
| 14 |
+
endmodule
|
| 15 |
+
EOF
|
| 16 |
+
logger -expect error "^Latch inferred for signal `\\top\.\$unnamed_block\$3\.y' from always_comb process" 1
|
| 17 |
+
proc
|
chips/yosys/tests/verilog/always_comb_nolatch_1.ys
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic [4:0] x;
|
| 4 |
+
logic z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin
|
| 7 |
+
x = '0;
|
| 8 |
+
if (z) begin
|
| 9 |
+
for (int i = 0; i < 5; i++) begin
|
| 10 |
+
x[i] = 1'b1;
|
| 11 |
+
end
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
endmodule
|
| 15 |
+
EOF
|
| 16 |
+
proc
|
chips/yosys/tests/verilog/always_comb_nolatch_2.ys
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic [4:0] x;
|
| 4 |
+
logic z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin
|
| 7 |
+
x = '0;
|
| 8 |
+
if (z) begin
|
| 9 |
+
int i;
|
| 10 |
+
for (i = 0; i < 5; i++) begin
|
| 11 |
+
x[i] = 1'b1;
|
| 12 |
+
end
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
endmodule
|
| 16 |
+
EOF
|
| 17 |
+
proc
|
chips/yosys/tests/verilog/always_comb_nolatch_3.ys
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic x;
|
| 4 |
+
logic z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin
|
| 7 |
+
logic y;
|
| 8 |
+
case (x)
|
| 9 |
+
1'b0:
|
| 10 |
+
y = 1;
|
| 11 |
+
default:
|
| 12 |
+
y = 0;
|
| 13 |
+
endcase
|
| 14 |
+
if (z)
|
| 15 |
+
x = y;
|
| 16 |
+
else
|
| 17 |
+
x = 1'b0;
|
| 18 |
+
end
|
| 19 |
+
endmodule
|
| 20 |
+
EOF
|
| 21 |
+
proc
|
chips/yosys/tests/verilog/always_comb_nolatch_4.ys
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
parameter AVOID_LATCH = 1;
|
| 4 |
+
logic x, z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin
|
| 7 |
+
logic y;
|
| 8 |
+
if (z)
|
| 9 |
+
y = 0;
|
| 10 |
+
for (int i = 1; i == AVOID_LATCH; i++)
|
| 11 |
+
y = 1;
|
| 12 |
+
x = z ? y : 1'b0;
|
| 13 |
+
end
|
| 14 |
+
endmodule
|
| 15 |
+
EOF
|
| 16 |
+
proc
|
chips/yosys/tests/verilog/always_comb_nolatch_5.ys
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
logic [4:0] x;
|
| 4 |
+
logic z;
|
| 5 |
+
assign z = 1'b1;
|
| 6 |
+
always_comb begin : foo
|
| 7 |
+
x = '0;
|
| 8 |
+
if (z) begin : bar
|
| 9 |
+
for (int i = 0; i < 5; i++)
|
| 10 |
+
x[i] = 1'b1;
|
| 11 |
+
end
|
| 12 |
+
end
|
| 13 |
+
endmodule
|
| 14 |
+
EOF
|
| 15 |
+
proc
|
chips/yosys/tests/verilog/always_comb_nolatch_6.ys
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top(input wire x, y, output reg z);
|
| 3 |
+
function automatic f;
|
| 4 |
+
input inp;
|
| 5 |
+
for (int i = 0; i < 1; i++)
|
| 6 |
+
f = inp + 0;
|
| 7 |
+
endfunction
|
| 8 |
+
always_comb
|
| 9 |
+
if (y)
|
| 10 |
+
z = f(x);
|
| 11 |
+
else
|
| 12 |
+
z = 0;
|
| 13 |
+
endmodule
|
| 14 |
+
EOF
|
| 15 |
+
proc
|
chips/yosys/tests/verilog/asgn_expr.sv
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
module top;
|
| 2 |
+
integer x, y, z;
|
| 3 |
+
task check;
|
| 4 |
+
input integer a, b, c;
|
| 5 |
+
assert (x == a);
|
| 6 |
+
assert (y == b);
|
| 7 |
+
assert (z == c);
|
| 8 |
+
endtask
|
| 9 |
+
always_comb begin
|
| 10 |
+
x = 0; y = 0; z = 0;
|
| 11 |
+
check(0, 0, 0);
|
| 12 |
+
|
| 13 |
+
// post-increment/decrement statements
|
| 14 |
+
x++;
|
| 15 |
+
check(1, 0, 0);
|
| 16 |
+
(* bar *) y (* foo *) ++;
|
| 17 |
+
check(1, 1, 0);
|
| 18 |
+
z--;
|
| 19 |
+
check(1, 1, -1);
|
| 20 |
+
(* bar *) z (* foo *) --;
|
| 21 |
+
check(1, 1, -2);
|
| 22 |
+
|
| 23 |
+
// pre-increment/decrement statements are equivalent
|
| 24 |
+
++z;
|
| 25 |
+
check(1, 1, -1);
|
| 26 |
+
(* bar *) ++ (* foo *) z;
|
| 27 |
+
check(1, 1, 0);
|
| 28 |
+
--x;
|
| 29 |
+
check(0, 1, 0);
|
| 30 |
+
(* bar *) -- (* foo *) y;
|
| 31 |
+
check(0, 0, 0);
|
| 32 |
+
|
| 33 |
+
// procedural pre-increment/decrement expressions
|
| 34 |
+
z = ++x;
|
| 35 |
+
check(1, 0, 1);
|
| 36 |
+
z = ++ (* foo *) x;
|
| 37 |
+
check(2, 0, 2);
|
| 38 |
+
y = --x;
|
| 39 |
+
check(1, 1, 2);
|
| 40 |
+
y = -- (* foo *) x;
|
| 41 |
+
|
| 42 |
+
// procedural post-increment/decrement expressions
|
| 43 |
+
// TODO: support attributes on post-increment/decrement
|
| 44 |
+
check(0, 0, 2);
|
| 45 |
+
y = x++;
|
| 46 |
+
check(1, 0, 2);
|
| 47 |
+
y = x--;
|
| 48 |
+
check(0, 1, 2);
|
| 49 |
+
|
| 50 |
+
// procedural assignment expressions
|
| 51 |
+
x = (y = (z = 99) + 1) + 1;
|
| 52 |
+
check(101, 100, 99);
|
| 53 |
+
x = (y *= 2);
|
| 54 |
+
check(200, 200, 99);
|
| 55 |
+
x = (z >>= 2) * 4;
|
| 56 |
+
check(96, 200, 24);
|
| 57 |
+
y = (z >>= 1'sb1) * 2; // shift is implicitly cast to unsigned
|
| 58 |
+
check(96, 24, 12);
|
| 59 |
+
|
| 60 |
+
// check width of post-increment expressions
|
| 61 |
+
z = (y = 0);
|
| 62 |
+
begin
|
| 63 |
+
byte w;
|
| 64 |
+
w = 0;
|
| 65 |
+
x = {1'b1, ++w};
|
| 66 |
+
check(257, 0, 0);
|
| 67 |
+
assert (w == 1);
|
| 68 |
+
x = {2'b10, w++};
|
| 69 |
+
check(513, 0, 0);
|
| 70 |
+
assert (w == 2);
|
| 71 |
+
end
|
| 72 |
+
end
|
| 73 |
+
endmodule
|
chips/yosys/tests/verilog/asgn_expr.ys
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv asgn_expr.sv
|
| 2 |
+
proc
|
| 3 |
+
async2sync
|
| 4 |
+
sat -verify -prove-asserts -show-all
|
chips/yosys/tests/verilog/asgn_expr_not_proc_1.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only permitted within procedures." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x, y;
|
| 5 |
+
assign x = y++;
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_proc_2.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only permitted within procedures." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x;
|
| 5 |
+
wire [++x:0] y;
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_proc_3.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only permitted within procedures." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x;
|
| 5 |
+
integer y = --x;
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_proc_4.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only permitted within procedures." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x, y;
|
| 5 |
+
assign x = (y = 1);
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_proc_5.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only permitted within procedures." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x, y;
|
| 5 |
+
assign x = (y += 2);
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_sv_1.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only supported in SystemVerilog mode." 1
|
| 2 |
+
read_verilog <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x, y;
|
| 5 |
+
initial y = ++x;
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_sv_2.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only supported in SystemVerilog mode." 1
|
| 2 |
+
read_verilog <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x, y;
|
| 5 |
+
initial y = x++;
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_sv_3.ys
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Assignments within expressions are only supported in SystemVerilog mode." 1
|
| 2 |
+
read_verilog <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
integer x, y;
|
| 5 |
+
initial y = (x = 1);
|
| 6 |
+
endmodule
|
| 7 |
+
EOF
|
chips/yosys/tests/verilog/asgn_expr_not_sv_4.ys
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOF
|
| 2 |
+
module top;
|
| 3 |
+
integer x, y;
|
| 4 |
+
initial y = (x += 1);
|
| 5 |
+
endmodule
|
| 6 |
+
EOF
|
| 7 |
+
design -reset
|
| 8 |
+
|
| 9 |
+
logger -expect error "syntax error, unexpected TOK_ID" 1
|
| 10 |
+
read_verilog <<EOF
|
| 11 |
+
module top;
|
| 12 |
+
integer x, y;
|
| 13 |
+
initial y = (x += 1);
|
| 14 |
+
endmodule
|
| 15 |
+
EOF
|
chips/yosys/tests/verilog/assign_to_reg.ys
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# https://github.com/yosyshq/yosys/issues/2035
|
| 2 |
+
|
| 3 |
+
read_rtlil <<END
|
| 4 |
+
module \top
|
| 5 |
+
wire width 1 input 0 \halfbrite
|
| 6 |
+
wire width 2 output 1 \r_on
|
| 7 |
+
process $1
|
| 8 |
+
assign \r_on [1:0] 2'00
|
| 9 |
+
assign \r_on [1:0] 2'11
|
| 10 |
+
switch \halfbrite [0]
|
| 11 |
+
case 1'1
|
| 12 |
+
assign \r_on [1] 1'0
|
| 13 |
+
end
|
| 14 |
+
end
|
| 15 |
+
end
|
| 16 |
+
END
|
| 17 |
+
proc_prune
|
| 18 |
+
write_verilog assign_to_reg.v
|
| 19 |
+
design -reset
|
| 20 |
+
|
| 21 |
+
logger -expect-no-warnings
|
| 22 |
+
read_verilog assign_to_reg.v
|
chips/yosys/tests/verilog/atom_type_signedness.ys
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -dump_ast1 -dump_ast2 -sv <<EOT
|
| 2 |
+
module dut();
|
| 3 |
+
|
| 4 |
+
enum integer { uInteger = -10 } a;
|
| 5 |
+
enum int { uInt = -11 } b;
|
| 6 |
+
enum shortint { uShortInt = -12 } c;
|
| 7 |
+
enum byte { uByte = -13 } d;
|
| 8 |
+
|
| 9 |
+
always_comb begin
|
| 10 |
+
assert(-10 == uInteger);
|
| 11 |
+
assert(-11 == uInt);
|
| 12 |
+
assert(-12 == uShortInt);
|
| 13 |
+
assert(-13 == uByte);
|
| 14 |
+
end
|
| 15 |
+
endmodule
|
| 16 |
+
EOT
|
| 17 |
+
hierarchy; proc; opt; async2sync
|
| 18 |
+
select -module dut
|
| 19 |
+
sat -verify -tempinduct -prove-asserts -show-all
|
chips/yosys/tests/verilog/attr_signed.ys
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
! mkdir -p temp
|
| 2 |
+
|
| 3 |
+
read_verilog <<EOT
|
| 4 |
+
module top;
|
| 5 |
+
(* a = -5 *) wire a;
|
| 6 |
+
(* b = 32'sd1 *) wire b;
|
| 7 |
+
(* c = 32'd1 *) wire c;
|
| 8 |
+
(* d = 1 *) wire d;
|
| 9 |
+
(* e = 8'sd3 *) wire e;
|
| 10 |
+
endmodule
|
| 11 |
+
EOT
|
| 12 |
+
|
| 13 |
+
write_verilog -nodec_attr temp/attr_signed.v
|
| 14 |
+
! grep -qF "(* a = -32'sd5 *)" temp/attr_signed.v
|
| 15 |
+
! grep -qF "(* b = 32'sd1 *)" temp/attr_signed.v
|
| 16 |
+
! grep -qF "(* c = 32'd1 *)" temp/attr_signed.v
|
| 17 |
+
! grep -qF "(* d = 32'sd1 *)" temp/attr_signed.v
|
| 18 |
+
! grep -qF "(* e = 8'sh03 *)" temp/attr_signed.v
|
| 19 |
+
|
| 20 |
+
write_verilog temp/attr_signed_default.v
|
| 21 |
+
! grep -qF "(* a = -5 *)" temp/attr_signed_default.v
|
chips/yosys/tests/verilog/automatic_lifetime.ys
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Automatic reg as intermediate value in always @(*)
|
| 2 |
+
# The result must be provably equivalent to the direct expression.
|
| 3 |
+
# No latch or DFF must be created for tmp.
|
| 4 |
+
design -reset
|
| 5 |
+
read_verilog -sv <<EOF
|
| 6 |
+
module t1(input a, b, c, output reg y);
|
| 7 |
+
always @(*) begin : blk
|
| 8 |
+
automatic reg tmp;
|
| 9 |
+
tmp = a ^ b;
|
| 10 |
+
if (c) tmp = tmp & a;
|
| 11 |
+
y = tmp;
|
| 12 |
+
end
|
| 13 |
+
// equivalent to: y = c ? ((a^b)&a) : (a^b)
|
| 14 |
+
assert property (y === (c ? ((a ^ b) & a) : (a ^ b)));
|
| 15 |
+
endmodule
|
| 16 |
+
EOF
|
| 17 |
+
proc
|
| 18 |
+
opt_clean
|
| 19 |
+
async2sync
|
| 20 |
+
# no state elements for tmp
|
| 21 |
+
select -assert-none t:$dff t:$dlatch %%
|
| 22 |
+
sat -verify -prove-asserts -show-all
|
| 23 |
+
|
| 24 |
+
# automatic logic in always_comb with chained computation
|
| 25 |
+
# Two automatic intermediates used in sequence; result must match
|
| 26 |
+
# the direct expression. No latch/DFF.
|
| 27 |
+
design -reset
|
| 28 |
+
read_verilog -sv <<EOF
|
| 29 |
+
module t2(input [3:0] a, b, input sel, output reg [3:0] y, output reg co);
|
| 30 |
+
always_comb begin : blk
|
| 31 |
+
automatic reg [4:0] sum;
|
| 32 |
+
automatic reg [3:0] pick;
|
| 33 |
+
sum = {1'b0, a} + {1'b0, b};
|
| 34 |
+
pick = sel ? sum[3:0] : (a & b);
|
| 35 |
+
y = pick;
|
| 36 |
+
co = sum[4];
|
| 37 |
+
end
|
| 38 |
+
assert property (y === (sel ? ((a + b) & 4'hf) : (a & b)));
|
| 39 |
+
assert property (co === (((5'(a) + 5'(b)) >> 4) & 1'b1));
|
| 40 |
+
endmodule
|
| 41 |
+
EOF
|
| 42 |
+
proc
|
| 43 |
+
opt_clean
|
| 44 |
+
async2sync
|
| 45 |
+
select -assert-none t:$dff t:$dlatch %%
|
| 46 |
+
sat -verify -prove-asserts -show-all
|
| 47 |
+
|
| 48 |
+
# automatic in a clocked block — only the explicitly registered
|
| 49 |
+
# output (result) must get a DFF; the automatic temp must not.
|
| 50 |
+
design -reset
|
| 51 |
+
read_verilog -sv <<EOF
|
| 52 |
+
module t3(input clk, rst, input [7:0] data, output reg [7:0] result);
|
| 53 |
+
always @(posedge clk) begin : compute
|
| 54 |
+
automatic reg [7:0] tmp;
|
| 55 |
+
tmp = data ^ 8'hA5;
|
| 56 |
+
if (rst)
|
| 57 |
+
result <= 8'h00;
|
| 58 |
+
else
|
| 59 |
+
result <= tmp;
|
| 60 |
+
end
|
| 61 |
+
endmodule
|
| 62 |
+
EOF
|
| 63 |
+
proc
|
| 64 |
+
opt_clean
|
| 65 |
+
# Exactly one DFF (for result), zero latches, no DFF for tmp
|
| 66 |
+
select -assert-count 1 t:$dff %%
|
| 67 |
+
select -assert-none t:$dlatch %%
|
| 68 |
+
|
| 69 |
+
# automatic integer in named block — ensure integer-width
|
| 70 |
+
# automatic variables work and produce no state elements.
|
| 71 |
+
design -reset
|
| 72 |
+
read_verilog -sv <<EOF
|
| 73 |
+
module t4(input [7:0] a, b, input sub, output reg [7:0] y);
|
| 74 |
+
always @(*) begin : arith
|
| 75 |
+
automatic integer acc;
|
| 76 |
+
if (sub)
|
| 77 |
+
acc = $signed(a) - $signed(b);
|
| 78 |
+
else
|
| 79 |
+
acc = $signed(a) + $signed(b);
|
| 80 |
+
y = acc[7:0];
|
| 81 |
+
end
|
| 82 |
+
assert property (y === (sub ? (a - b) : (a + b)));
|
| 83 |
+
endmodule
|
| 84 |
+
EOF
|
| 85 |
+
proc
|
| 86 |
+
opt_clean
|
| 87 |
+
async2sync
|
| 88 |
+
select -assert-none t:$dff t:$dlatch %%
|
| 89 |
+
sat -verify -prove-asserts -show-all
|
| 90 |
+
|
| 91 |
+
# automatic variable not assigned on all paths (X semantics)
|
| 92 |
+
# With 'automatic', tmp holds no previous state; the undriven path
|
| 93 |
+
# produces X, not the old register value. After proc, no latch may be
|
| 94 |
+
# inferred for tmp.
|
| 95 |
+
design -reset
|
| 96 |
+
read_verilog -sv <<EOF
|
| 97 |
+
module t5(input en, d, output reg q);
|
| 98 |
+
always @(*) begin : blk
|
| 99 |
+
automatic reg tmp;
|
| 100 |
+
if (en) tmp = d;
|
| 101 |
+
// tmp is X when en==0: automatic means no state retention
|
| 102 |
+
q = tmp;
|
| 103 |
+
end
|
| 104 |
+
endmodule
|
| 105 |
+
EOF
|
| 106 |
+
proc
|
| 107 |
+
opt_clean
|
| 108 |
+
# No latch for tmp — X propagates instead of old value
|
| 109 |
+
select -assert-none t:$dff t:$dlatch %%
|
chips/yosys/tests/verilog/block_end_label_only.ys
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Begin label missing where end label \(incorrect_name\) was given\." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
initial
|
| 5 |
+
begin
|
| 6 |
+
$display("HI");
|
| 7 |
+
end : incorrect_name
|
| 8 |
+
endmodule
|
| 9 |
+
EOF
|
chips/yosys/tests/verilog/block_end_label_wrong.ys
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect error "Begin label \(correct_name\) and end label \(incorrect_name\) don't match\." 1
|
| 2 |
+
read_verilog -sv <<EOF
|
| 3 |
+
module top;
|
| 4 |
+
initial
|
| 5 |
+
begin : correct_name
|
| 6 |
+
$display("HI");
|
| 7 |
+
end : incorrect_name
|
| 8 |
+
endmodule
|
| 9 |
+
EOF
|
chips/yosys/tests/verilog/block_labels.ys
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog <<EOT
|
| 2 |
+
module foo;
|
| 3 |
+
|
| 4 |
+
genvar a;
|
| 5 |
+
for (a = 0; a < 10; a++) begin : a
|
| 6 |
+
end : a
|
| 7 |
+
endmodule
|
| 8 |
+
EOT
|
| 9 |
+
read_verilog <<EOT
|
| 10 |
+
module foo2;
|
| 11 |
+
|
| 12 |
+
genvar a;
|
| 13 |
+
for (a = 0; a < 10; a++) begin : a
|
| 14 |
+
end
|
| 15 |
+
endmodule
|
| 16 |
+
EOT
|
| 17 |
+
|
| 18 |
+
logger -expect error "Begin label \(a\) and end label \(b\) don't match\." 1
|
| 19 |
+
read_verilog <<EOT
|
| 20 |
+
module foo3;
|
| 21 |
+
|
| 22 |
+
genvar a;
|
| 23 |
+
for (a = 0; a < 10; a++) begin : a
|
| 24 |
+
end : b
|
| 25 |
+
endmodule
|
| 26 |
+
EOT
|
chips/yosys/tests/verilog/bug2037.ys
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
logger -expect-no-warnings
|
| 2 |
+
read_verilog <<EOT
|
| 3 |
+
module test ();
|
| 4 |
+
localparam y = 1;
|
| 5 |
+
always @(*)
|
| 6 |
+
if (y) (* foo *) ;
|
| 7 |
+
endmodule
|
| 8 |
+
EOT
|
| 9 |
+
select -assert-none a:* a:src %d
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
design -reset
|
| 13 |
+
logger -expect-no-warnings
|
| 14 |
+
read_verilog <<EOT
|
| 15 |
+
module test ();
|
| 16 |
+
localparam y = 1;
|
| 17 |
+
always @(*)
|
| 18 |
+
if (y) (* foo *) ; else (* bar *) ;
|
| 19 |
+
endmodule
|
| 20 |
+
EOT
|
| 21 |
+
select -assert-none a:* a:src %d
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
design -reset
|
| 25 |
+
logger -expect-no-warnings
|
| 26 |
+
read_verilog <<EOT
|
| 27 |
+
module test ();
|
| 28 |
+
localparam y = 1;
|
| 29 |
+
generate if (y) (* foo *) ; endgenerate
|
| 30 |
+
endmodule
|
| 31 |
+
EOT
|
| 32 |
+
select -assert-none a:*
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
design -reset
|
| 36 |
+
logger -expect-no-warnings
|
| 37 |
+
read_verilog <<EOT
|
| 38 |
+
module test ();
|
| 39 |
+
localparam y = 1;
|
| 40 |
+
generate if (y) (* foo *) ; else (* bar *); endgenerate
|
| 41 |
+
endmodule
|
| 42 |
+
EOT
|
| 43 |
+
select -assert-none a:*
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
design -reset
|
| 47 |
+
read_verilog <<EOT
|
| 48 |
+
module test ();
|
| 49 |
+
localparam y = 1;
|
| 50 |
+
reg x = 1'b0;
|
| 51 |
+
always @(*) begin
|
| 52 |
+
if (y)
|
| 53 |
+
(* foo *) x <= 1'b1;
|
| 54 |
+
else
|
| 55 |
+
(* bar *) x = 1'b0;
|
| 56 |
+
end
|
| 57 |
+
endmodule
|
| 58 |
+
EOT
|
chips/yosys/tests/verilog/bug2042-sv.ys
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
read_verilog -sv <<EOT
|
| 2 |
+
module Task_Test_Top
|
| 3 |
+
(
|
| 4 |
+
input a,
|
| 5 |
+
output reg b
|
| 6 |
+
);
|
| 7 |
+
|
| 8 |
+
task SomeTaskName(a);
|
| 9 |
+
b = ~a;
|
| 10 |
+
endtask
|
| 11 |
+
|
| 12 |
+
always @*
|
| 13 |
+
SomeTaskName(a);
|
| 14 |
+
|
| 15 |
+
assert property (b == ~a);
|
| 16 |
+
|
| 17 |
+
endmodule
|
| 18 |
+
EOT
|
| 19 |
+
proc
|
| 20 |
+
async2sync
|
| 21 |
+
sat -verify -prove-asserts
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
design -reset
|
| 25 |
+
read_verilog -sv <<EOT
|
| 26 |
+
module Task_Test_Top
|
| 27 |
+
(
|
| 28 |
+
input a,
|
| 29 |
+
output b, c
|
| 30 |
+
);
|
| 31 |
+
|
| 32 |
+
task SomeTaskName(x, output y, z);
|
| 33 |
+
y = ~x;
|
| 34 |
+
z = x;
|
| 35 |
+
endtask
|
| 36 |
+
|
| 37 |
+
always @*
|
| 38 |
+
SomeTaskName(a, b, c);
|
| 39 |
+
|
| 40 |
+
assert property (b == ~a);
|
| 41 |
+
assert property (c == a);
|
| 42 |
+
|
| 43 |
+
endmodule
|
| 44 |
+
EOT
|
| 45 |
+
proc
|
| 46 |
+
async2sync
|
| 47 |
+
sat -verify -prove-asserts
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
design -reset
|
| 51 |
+
logger -expect error "syntax error, unexpected TOK_ENDTASK, expecting ';'" 1
|
| 52 |
+
read_verilog -sv <<EOT
|
| 53 |
+
module Task_Test_Top
|
| 54 |
+
(
|
| 55 |
+
);
|
| 56 |
+
|
| 57 |
+
task SomeTaskName(a)
|
| 58 |
+
endtask
|
| 59 |
+
|
| 60 |
+
endmodule
|
| 61 |
+
EOT
|