-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmac.v.bak
More file actions
21 lines (17 loc) · 678 Bytes
/
Copy pathmac.v.bak
File metadata and controls
21 lines (17 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module mac_element #(parameter dsize = 16)
(input clk, input signed [dsize-1:0] coeffin, datain, input signed [dsize*2-1:0] cascin,
output signed [dsize-1:0] cascdata, output reg signed [2*dsize-1:0] cascout);
reg signed [dsize-1:0] coeff;
reg signed [dsize-1:0] data;
reg signed [dsize-1:0] datatwo;
reg signed [2*dsize-1:0] product;
assign cascdata = datatwo;
always @(posedge clk)
begin
coeff <= coeffin;
data <= datain;
datatwo <= data;
product <= data * coeff;
cascout <= product + cascin;
end
endmodule