aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-04-22 08:39:37 +0200
committerGitHub <noreply@github.com>2019-04-22 08:39:37 +0200
commita98b1718142a85f8c66b23494ce5532783f93ac4 (patch)
tree2ab16096e53fdf72677096267b3cd84491c9cd8e /tests/various
parent632a6664484aefa6f9af1ace87ecefccd86d1957 (diff)
parentfc23af170768926e645b6c94c54b4c2e6e8d0808 (diff)
downloadyosys-a98b1718142a85f8c66b23494ce5532783f93ac4.tar.gz
yosys-a98b1718142a85f8c66b23494ce5532783f93ac4.tar.bz2
yosys-a98b1718142a85f8c66b23494ce5532783f93ac4.zip
Merge pull request #944 from YosysHQ/clifford/pmux2shiftx
Add pmux2shiftx command
Diffstat (limited to 'tests/various')
-rw-r--r--tests/various/pmux2shiftx.v34
-rw-r--r--tests/various/pmux2shiftx.ys28
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/various/pmux2shiftx.v b/tests/various/pmux2shiftx.v
new file mode 100644
index 000000000..fec84187b
--- /dev/null
+++ b/tests/various/pmux2shiftx.v
@@ -0,0 +1,34 @@
+module pmux2shiftx_test (
+ input [2:0] S1,
+ input [5:0] S2,
+ input [1:0] S3,
+ input [9:0] A, B, C, D, D, E, F, G, H,
+ input [9:0] I, J, K, L, M, N, O, P, Q,
+ output reg [9:0] X
+);
+ always @* begin
+ case (S1)
+ 3'd 0: X = A;
+ 3'd 1: X = B;
+ 3'd 2: X = C;
+ 3'd 3: X = D;
+ 3'd 4: X = E;
+ 3'd 5: X = F;
+ 3'd 6: X = G;
+ 3'd 7: X = H;
+ endcase
+ case (S2)
+ 6'd 45: X = I;
+ 6'd 47: X = J;
+ 6'd 49: X = K;
+ 6'd 55: X = L;
+ 6'd 57: X = M;
+ 6'd 59: X = N;
+ endcase
+ case (S3)
+ 2'd 1: X = O;
+ 2'd 2: X = P;
+ 2'd 3: X = Q;
+ endcase
+ end
+endmodule
diff --git a/tests/various/pmux2shiftx.ys b/tests/various/pmux2shiftx.ys
new file mode 100644
index 000000000..6bb9626eb
--- /dev/null
+++ b/tests/various/pmux2shiftx.ys
@@ -0,0 +1,28 @@
+read_verilog pmux2shiftx.v
+prep
+design -save gold
+
+pmux2shiftx -min_density 70
+
+opt
+
+stat
+# show -width
+select -assert-count 1 t:$sub
+select -assert-count 2 t:$mux
+select -assert-count 2 t:$shift
+select -assert-count 3 t:$shiftx
+
+design -stash gate
+
+design -import gold -as gold
+design -import gate -as gate
+
+miter -equiv -flatten -make_assert -make_outputs gold gate miter
+sat -verify -prove-asserts -show-ports miter
+
+design -load gold
+stat
+
+design -load gate
+stat