data/full_repos/permissive/520452389/source_codes/Booth_multiplier.v
data/verilator_xmls/e694a601-fb30-4320-949a-1b785b9654fd.xml
module booth_multiplier(PRODUCT, A, B);
  parameter N=16;
  output reg signed [2*N-1:0] PRODUCT;
  input signed [N-1:0] A, B;
  
  reg [1:0] temp;
  integer i;
  reg e;
  reg [N-1:0] B1;

  always @(A,B)
  begin
    
    PRODUCT = 32'd0;
    e = 1'b0;
    B1 = -B;
    
    for (i=0; i<N; i=i+1)
    begin
      temp = { A[i], e };
      case(temp)
        2'd2 : PRODUCT[2*N-1:N] = PRODUCT[2*N-1:N] + B1;
        2'd1 : PRODUCT[2*N-1:N] = PRODUCT[2*N-1:N] + B;
      endcase

      PRODUCT = PRODUCT >> 1;
      PRODUCT[2*N-1] = PRODUCT[2*N-2];
      e=A[i];     
    end
  end
  
endmodule
module booth_multiplier(PRODUCT, A, B);

  parameter N=16;
  output reg signed [2*N-1:0] PRODUCT;
  input signed [N-1:0] A, B;
  
  reg [1:0] temp;
  integer i;
  reg e;
  reg [N-1:0] B1;

  always @(A,B)
  begin
    
    PRODUCT = 32'd0;
    e = 1'b0;
    B1 = -B;
    
    for (i=0; i<N; i=i+1)
    begin
      temp = { A[i], e };
      case(temp)
        2'd2 : PRODUCT[2*N-1:N] = PRODUCT[2*N-1:N] + B1;
        2'd1 : PRODUCT[2*N-1:N] = PRODUCT[2*N-1:N] + B;
      endcase

      PRODUCT = PRODUCT >> 1;
      PRODUCT[2*N-1] = PRODUCT[2*N-2];
      e=A[i];     
    end
  end
  
endmodule