File size: 426 Bytes
035592e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module multi_8bit (
  input [7:0] A,
  input [7:0] B,
  output reg [15:0] product
);

  reg [7:0] multiplicand;
  reg [3:0] shift_count;

  always @* begin
    product = 16'b0; 
    multiplicand = A; 
    shift_count = 0;  

    for (int i = 0; i < 8; i = i + 1) begin
      if (B[i] == 1) begin
        product = product + (multiplicand << shift_count);
      end
      shift_count = shift_count + 1;
    end
  end

endmodule