定义输入为a,b;输出为outcome;则:
module mult_for(a,b,outcome);
input [size:1] a,b;
output [2*size:1] outcome;
parameter size = 8;
reg [2*size:1] outcome;
integer i;
always @(a or b)
begin
outcome = 0;
for(i=1;i<=size;i=i+1)
begin
if(b[i])
outcome = outcome + (a<<(i-1));
end
end
endmodule