lljlljlzh1

使用fort循环语句及加法和移位操作实现应该乘法器

0
阅读(2478)

module fpgaceshi (opa or opb or result);

parameter size = 8; longsize = 16;

input [size:1] opa, opb;

output [longsize:1] result;

 

reg [size:1] opa, opb;

reg [longsize:1] result;

 

begin: mult

integer bindex;

result = 0;

for (bindex = 1; bindex <= size; bindex = bindex + 1)

if (opb[bindex])

result = result + (opa << (bindex - 1));

end

 

endmodule

编译??