diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-08-30 14:35:05 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-30 14:35:05 -0700 |
commit | 7df0e77565ea9dc46d0eeca536d1be47851326e5 (patch) | |
tree | bfc562a094f83228517fcc66bdbf7b9eb7ecf1c2 /tests | |
parent | 89359b6927c012f5d683dd37401d36566ad0c419 (diff) | |
download | yosys-7df0e77565ea9dc46d0eeca536d1be47851326e5.tar.gz yosys-7df0e77565ea9dc46d0eeca536d1be47851326e5.tar.bz2 yosys-7df0e77565ea9dc46d0eeca536d1be47851326e5.zip |
Add mul_unsigned test
Diffstat (limited to 'tests')
-rw-r--r-- | tests/xilinx/mul_unsigned.v | 30 | ||||
-rw-r--r-- | tests/xilinx/mul_unsigned.ys | 11 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/xilinx/mul_unsigned.v b/tests/xilinx/mul_unsigned.v new file mode 100644 index 000000000..e3713a642 --- /dev/null +++ b/tests/xilinx/mul_unsigned.v @@ -0,0 +1,30 @@ +/* +Example from: https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_1/ug901-vivado-synthesis.pdf [p. 89]. +*/ + +// Unsigned 16x24-bit Multiplier +// 1 latency stage on operands +// 3 latency stage after the multiplication +// File: multipliers2.v +// +module mul_unsigned (clk, A, B, RES); +parameter WIDTHA = /*16*/ 6; +parameter WIDTHB = /*24*/ 9; +input clk; +input [WIDTHA-1:0] A; +input [WIDTHB-1:0] B; +output [WIDTHA+WIDTHB-1:0] RES; +reg [WIDTHA-1:0] rA; +reg [WIDTHB-1:0] rB; +reg [WIDTHA+WIDTHB-1:0] M [3:0]; +integer i; +always @(posedge clk) + begin + rA <= A; + rB <= B; + M[0] <= rA * rB; + for (i = 0; i < 3; i = i+1) + M[i+1] <= M[i]; + end +assign RES = M[3]; +endmodule diff --git a/tests/xilinx/mul_unsigned.ys b/tests/xilinx/mul_unsigned.ys new file mode 100644 index 000000000..72d1f37d7 --- /dev/null +++ b/tests/xilinx/mul_unsigned.ys @@ -0,0 +1,11 @@ +read_verilog mul_unsigned.v +proc +hierarchy -top mul_unsigned +equiv_opt -assert -map +/xilinx/cells_sim.v synth_xilinx # equivalency check +design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design) +cd mul_unsigned # Constrain all select calls below inside the top module +stat +select -assert-count 1 t:BUFG +select -assert-count 1 t:DSP48E1 +select -assert-count 15 t:SRL16E +select -assert-none t:DSP48E1 t:SRL16E t:BUFG %% t:* %D |