8bits_multiplier.v
Upload User: xyledys
Upload Date: 2009-08-08
Package Size: 20k
Code Size: 0k
Development Platform:

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