8bits_multiplier.v
上传用户:xyledys
上传日期:2009-08-08
资源大小:20k
文件大小:0k
源码类别:

VHDL/FPGA/Verilog

开发平台:

Windows_Unix

  1. module _8bits_multiplier(result,opa,opb);
  2. parameter size=8,wordsize=16;
  3. output[wordsize-1:0] result;
  4. input[size-1:0] opa,opb;
  5. reg[wordsize-1:0] result;
  6. always@(opa or opb)
  7.   begin:mult
  8.     reg[wordsize-1:0] shift_opa,shift_opb;
  9.     shift_opa=opa;
  10.     shift_opb=opb;
  11.     result=0;
  12.     repeat(size)
  13.     if(shift_opb[0]==1) result=result+shift_opa;
  14.     shift_opa=shift_opa<<1;
  15.     shift_opb=shift_opb>>1;
  16.   end
  17. endmodule