diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-06-06 11:59:41 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-06-06 11:59:41 -0700 |
commit | 5d4eca5a298d2f98de220cfd0efe5452ab4052d8 (patch) | |
tree | 94cdb5dba62367d860917e42b9e4972c6837e2e8 /tests/various/muxpack.v | |
parent | 3e76e3a6fa4355e7223b10bba394f986d6821551 (diff) | |
download | yosys-5d4eca5a298d2f98de220cfd0efe5452ab4052d8.tar.gz yosys-5d4eca5a298d2f98de220cfd0efe5452ab4052d8.tar.bz2 yosys-5d4eca5a298d2f98de220cfd0efe5452ab4052d8.zip |
Add a few more special case tests
Diffstat (limited to 'tests/various/muxpack.v')
-rw-r--r-- | tests/various/muxpack.v | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/various/muxpack.v b/tests/various/muxpack.v index abc87ba44..333908fcb 100644 --- a/tests/various/muxpack.v +++ b/tests/various/muxpack.v @@ -34,3 +34,26 @@ always @* else o <= {W{1'bx}}; endmodule + +module mux_if_unbal_5_3_width_mismatch #(parameter N=5, parameter W=3) (input [N*W-1:0] i, input [$clog2(N)-1:0] s, output reg [W-1:0] o); +always @* begin + o <= {W{1'bx}}; + if (s == 0) o <= i[0*W+:W]; + if (s == 1) o <= i[1*W+:W]; + if (s == 2) o[W-2:0] <= i[2*W+:W-1]; + if (s == 3) o <= i[3*W+:W]; + if (s == 4) o <= i[4*W+:W]; +end + +endmodule + +module mux_if_unbal_5_3_missing #(parameter N=5, parameter W=3) (input [N*W-1:0] i, input [$clog2(N)-1:0] s, output reg [W-1:0] o); +always @* begin + if (s == 0) o <= i[0*W+:W]; +// else if (s == 1) o <= i[1*W+:W]; +// else if (s == 2) o <= i[2*W+:W]; + else if (s == 3) o <= i[3*W+:W]; + else o <= {W{1'bx}}; +end + +endmodule |