3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-11 21:50:54 +00:00

Add more complicated macc testcase

This commit is contained in:
Eddie Hung 2019-09-19 22:39:15 -07:00
parent 1b88211ec6
commit 4100825b81
2 changed files with 40 additions and 6 deletions

View file

@ -23,3 +23,25 @@ begin
end
end
endmodule
module top2(clk,a,b,c,hold);
parameter A_WIDTH = 6 /*4*/;
parameter B_WIDTH = 6 /*3*/;
input hold;
input clk;
input signed [(A_WIDTH - 1):0] a;
input signed [(B_WIDTH - 1):0] b;
output signed [(A_WIDTH + B_WIDTH - 1):0] c;
reg signed [A_WIDTH-1:0] reg_a;
reg signed [B_WIDTH-1:0] reg_b;
reg [(A_WIDTH + B_WIDTH - 1):0] reg_tmp_c;
assign c = reg_tmp_c;
always @(posedge clk)
begin
if (!hold) begin
reg_a <= a;
reg_b <= b;
reg_tmp_c <= reg_a * reg_b + c;
end
end
endmodule