[Benchmark] Add pipelined multiplier benchmark to test DSP block with registers

This commit is contained in:
tangxifan 2022-01-02 20:16:59 -08:00
parent 55da99f4ca
commit 48355d1fc3
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
//-------------------------------------------------------
// Functionality: A 2-bit multiply circuit with pipelines
// Author: Xifan Tang
//-------------------------------------------------------
module mult_2_pipelined(clk, a, b, out);
parameter DATA_WIDTH = 2; /* declare a parameter. default required */
input [DATA_WIDTH - 1 : 0] a, b;
input clk;
output [DATA_WIDTH - 1 : 0] out;
reg [DATA_WIDTH - 1 : 0] a_reg;
reg [DATA_WIDTH - 1 : 0] b_reg;
reg [DATA_WIDTH - 1 : 0] out_reg;
always @(posedge clk) begin
a_reg <= a;
b_reg <= b;
out_reg <= a_reg * b_reg;
out = out_reg;
end
endmodule