22 lines
339 B
Systemverilog
22 lines
339 B
Systemverilog
|
module multiplier
|
||
|
(
|
||
|
input wire clk,
|
||
|
input wire signed [7:0] a,
|
||
|
input wire signed [7:0] b,
|
||
|
output reg signed [15:0] product
|
||
|
);
|
||
|
|
||
|
reg signed [7:0] a_reg;
|
||
|
reg signed [7:0] b_reg;
|
||
|
|
||
|
wire [15:0] product_out;
|
||
|
|
||
|
always_ff @(posedge clk) begin
|
||
|
a_reg <= a;
|
||
|
b_reg <= b;
|
||
|
product <= product_out;
|
||
|
end
|
||
|
|
||
|
assign product_out = a_reg * b_reg;
|
||
|
|
||
|
endmodule
|