diff options
author | clairexen <claire@symbioticeda.com> | 2020-08-20 16:24:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 16:24:53 +0200 |
commit | a96df40814244830cd0f2b5404507fadb23b2d9a (patch) | |
tree | 40f58497b611dff6f4582d53a3086f9c1d3d8152 /tests/opt | |
parent | 1d0d9d5c86f722fbfe60e530225d28ed4be93e13 (diff) | |
parent | 2b777bbda8ec46033244230e4e0d6bcea2822fa7 (diff) | |
download | yosys-a96df40814244830cd0f2b5404507fadb23b2d9a.tar.gz yosys-a96df40814244830cd0f2b5404507fadb23b2d9a.tar.bz2 yosys-a96df40814244830cd0f2b5404507fadb23b2d9a.zip |
Merge pull request #2344 from YosysHQ/mwk/opt_share-fixes
opt_share: Refactor, fix some bugs.
Diffstat (limited to 'tests/opt')
-rw-r--r-- | tests/opt/opt_share_bug2334.ys | 13 | ||||
-rw-r--r-- | tests/opt/opt_share_bug2335.ys | 27 | ||||
-rw-r--r-- | tests/opt/opt_share_bug2336.ys | 14 |
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/opt/opt_share_bug2334.ys b/tests/opt/opt_share_bug2334.ys new file mode 100644 index 000000000..004d98349 --- /dev/null +++ b/tests/opt/opt_share_bug2334.ys @@ -0,0 +1,13 @@ +read_verilog <<EOT + +module t(input [3:0] A, input [3:0] B, input [3:0] C, input S, output [3:0] Y); + +wire [3:0] t = A + C; + +assign Y = S ? A + B : {4{t[0]}}; + +endmodule + +EOT + +equiv_opt -assert opt_share diff --git a/tests/opt/opt_share_bug2335.ys b/tests/opt/opt_share_bug2335.ys new file mode 100644 index 000000000..0846a9ec3 --- /dev/null +++ b/tests/opt/opt_share_bug2335.ys @@ -0,0 +1,27 @@ +read_verilog <<EOT + +module top(...); + +input [3:0] A, B, C; +input S; +input [1:0] T; +output [3:0] X; +output reg [3:0] Y; + +wire [3:0] D = A + B; + +assign X = S ? D : A + C; +always @* begin + case(T) + 2'b01: Y <= A; + 2'b10: Y <= B; + default: Y <= D; + endcase +end + +endmodule + +EOT + +proc +equiv_opt -assert opt_share diff --git a/tests/opt/opt_share_bug2336.ys b/tests/opt/opt_share_bug2336.ys new file mode 100644 index 000000000..cd472ef46 --- /dev/null +++ b/tests/opt/opt_share_bug2336.ys @@ -0,0 +1,14 @@ +read_verilog <<EOT + +module top(input [3:0] A, B, C, input S, output [2:0] O); + +wire [3:0] tb = A + B; +wire [3:0] tc = A + C; + +assign O = S ? tb[3:1] : tc[3:1]; + +endmodule + +EOT + +equiv_opt -assert opt_share |