aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various/reg_wire_error.sv
diff options
context:
space:
mode:
authorUdi Finkelstein <github@udifink.com>2018-06-05 12:15:59 +0300
committerUnknown <github@udifink.com>2018-06-05 18:00:06 +0300
commit80d9d15f1c4b73ee73172b06fd2c8c55703aea54 (patch)
tree68d7f6d234399e075af592d16d4f9120c714be25 /tests/various/reg_wire_error.sv
parent2b9c75f8e372f6886e073743d1df11bcd1c58281 (diff)
downloadyosys-80d9d15f1c4b73ee73172b06fd2c8c55703aea54.tar.gz
yosys-80d9d15f1c4b73ee73172b06fd2c8c55703aea54.tar.bz2
yosys-80d9d15f1c4b73ee73172b06fd2c8c55703aea54.zip
reg_wire_error test needs the -sv flag so it is run via a script so it had to be moved out of the tests/simple dir that only runs Verilog files
Diffstat (limited to 'tests/various/reg_wire_error.sv')
-rw-r--r--tests/various/reg_wire_error.sv40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/various/reg_wire_error.sv b/tests/various/reg_wire_error.sv
new file mode 100644
index 000000000..ab461b95a
--- /dev/null
+++ b/tests/various/reg_wire_error.sv
@@ -0,0 +1,40 @@
+module sub_mod(input i_in, output o_out);
+assign o_out = i_in;
+endmodule
+
+module test(i_clk, i_reg, o_reg, o_wire);
+input i_clk;
+input i_reg;
+output o_reg;
+output o_wire;
+
+// Enable this to see how it doesn't fail on yosys although it should
+//reg o_wire;
+// Enable this instead of the above to see how logic can be mapped to a wire
+logic o_wire;
+// Enable this to see how it doesn't fail on yosys although it should
+//reg i_reg;
+// Disable this to see how it doesn't fail on yosys although it should
+reg o_reg;
+
+logic l_reg;
+
+// Enable this to tst if logic-turne-reg will catch assignments even if done before it turned into a reg
+//assign l_reg = !o_reg;
+initial o_reg = 1'b0;
+always @(posedge i_clk)
+begin
+ o_reg <= !o_reg;
+ l_reg <= !o_reg;
+end
+
+assign o_wire = !o_reg;
+// Uncomment this to see how a logic already turned intoa reg can be freely assigned on yosys
+//assign l_reg = !o_reg;
+
+sub_mod sm_inst (
+ .i_in(1'b1),
+ .o_out(o_reg)
+);
+endmodule
+