aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-04-25 18:52:20 -0700
committerEddie Hung <eddie@fpgeh.com>2019-04-25 18:52:20 -0700
commit880652283c5d834af962b5977dd97ef3d3a0cb37 (patch)
tree89d5f8e4cbe84a92c1124898a2dc938d44739b6c /tests
parent3042d5833041021bb45252b0cc862e9eff3d27d3 (diff)
parentece2c49e929cb6f6ac70cccdd84efc2bb1550a39 (diff)
downloadyosys-880652283c5d834af962b5977dd97ef3d3a0cb37.tar.gz
yosys-880652283c5d834af962b5977dd97ef3d3a0cb37.tar.bz2
yosys-880652283c5d834af962b5977dd97ef3d3a0cb37.zip
Merge remote-tracking branch 'origin/eddie/split_shiftx' into xc7mux
Diffstat (limited to 'tests')
-rw-r--r--tests/various/split_shiftx.v118
-rw-r--r--tests/various/split_shiftx.ys21
2 files changed, 139 insertions, 0 deletions
diff --git a/tests/various/split_shiftx.v b/tests/various/split_shiftx.v
new file mode 100644
index 000000000..dfcea3880
--- /dev/null
+++ b/tests/various/split_shiftx.v
@@ -0,0 +1,118 @@
+module split_shiftx_test01(i, s, o);
+ wire [3:0] _0_;
+ input [8:0] i;
+ output [2:0] o;
+ input [1:0] s;
+ \$macc #(
+ .A_WIDTH(32'd4),
+ .B_WIDTH(32'd0),
+ .CONFIG(10'h282),
+ .CONFIG_WIDTH(32'd10),
+ .Y_WIDTH(32'd4)
+ ) _1_ (
+ .A({ 2'h3, s }),
+ .B(),
+ .Y(_0_)
+ );
+ \$shiftx #(
+ .A_SIGNED(32'd0),
+ .A_WIDTH(32'd9),
+ .B_SIGNED(32'd1),
+ .B_WIDTH(32'd5),
+ .Y_WIDTH(32'd3)
+ ) _2_ (
+ .A(i),
+ .B({ 1'h0, _0_ }),
+ .Y(o)
+ );
+endmodule
+
+// Sign bit is 1
+module split_shiftx_test02(i, s, o);
+ wire [3:0] _0_;
+ input [8:0] i;
+ output [2:0] o;
+ input [1:0] s;
+ \$macc #(
+ .A_WIDTH(32'd4),
+ .B_WIDTH(32'd0),
+ .CONFIG(10'h282),
+ .CONFIG_WIDTH(32'd10),
+ .Y_WIDTH(32'd4)
+ ) _1_ (
+ .A({ 2'h3, s }),
+ .B(),
+ .Y(_0_)
+ );
+ \$shiftx #(
+ .A_SIGNED(32'd0),
+ .A_WIDTH(32'd9),
+ .B_SIGNED(32'd1),
+ .B_WIDTH(32'd5),
+ .Y_WIDTH(32'd3)
+ ) _2_ (
+ .A(i),
+ .B({ 1'h1, _0_ }),
+ .Y(o)
+ );
+endmodule
+
+// Non constant $macc
+module split_shiftx_test03(i, s, o);
+ wire [3:0] _0_;
+ input [8:0] i;
+ output [2:0] o;
+ input [1:0] s;
+ \$macc #(
+ .A_WIDTH(32'd4),
+ .B_WIDTH(32'd0),
+ .CONFIG(10'h282),
+ .CONFIG_WIDTH(32'd10),
+ .Y_WIDTH(32'd4)
+ ) _1_ (
+ .A({ s, s }),
+ .B(),
+ .Y(_0_)
+ );
+ \$shiftx #(
+ .A_SIGNED(32'd0),
+ .A_WIDTH(32'd9),
+ .B_SIGNED(32'd1),
+ .B_WIDTH(32'd5),
+ .Y_WIDTH(32'd3)
+ ) _2_ (
+ .A(i),
+ .B({ 1'h0, _0_ }),
+ .Y(o)
+ );
+endmodule
+
+// Wrong constant $macc
+module split_shiftx_test04(i, s, o);
+ wire [3:0] _0_;
+ input [8:0] i;
+ output [2:0] o;
+ input [1:0] s;
+ \$macc #(
+ .A_WIDTH(32'd4),
+ .B_WIDTH(32'd0),
+ .CONFIG(10'h282),
+ .CONFIG_WIDTH(32'd10),
+ .Y_WIDTH(32'd4)
+ ) _1_ (
+ .A({ 2'h2, s }),
+ .B(),
+ .Y(_0_)
+ );
+ \$shiftx #(
+ .A_SIGNED(32'd0),
+ .A_WIDTH(32'd9),
+ .B_SIGNED(32'd1),
+ .B_WIDTH(32'd5),
+ .Y_WIDTH(32'd3)
+ ) _2_ (
+ .A(i),
+ .B({ 1'h0, _0_ }),
+ .Y(o)
+ );
+endmodule
diff --git a/tests/various/split_shiftx.ys b/tests/various/split_shiftx.ys
new file mode 100644
index 000000000..810348aa3
--- /dev/null
+++ b/tests/various/split_shiftx.ys
@@ -0,0 +1,21 @@
+read_verilog -icells split_shiftx.v
+split_shiftx
+
+cd split_shiftx_test01
+select -assert-count 3 t:$shiftx
+select -assert-count 0 t: t:$shiftx %n %i
+
+cd split_shiftx_test02
+select -assert-count 1 t:$shiftx
+select -assert-count 1 t:$macc
+select -assert-count 0 t: t:$shiftx t:$macc %u %n %i
+
+cd split_shiftx_test03
+select -assert-count 1 t:$shiftx
+select -assert-count 1 t:$macc
+select -assert-count 0 t: t:$shiftx t:$macc %u %n %i
+
+cd split_shiftx_test04
+select -assert-count 1 t:$shiftx
+select -assert-count 1 t:$macc
+select -assert-count 0 t: t:$shiftx t:$macc %u %n %i