4 bit Booth Multiplier Verilog Code

4 bit Booth Multiplier Verilog Code
Verilog Code
module BoothMulti(X, Y, Z
    );

      input signed [3:0] X, Y;
       output signed [7:0] Z;
       reg signed [7:0] Z;
       reg [1:0] temp;
       integer i;
       reg E1;
       reg [3:0] Y1;
       always @ (X, Y)
       begin
       Z = 8'd0;
       E1 = 1'd0;
       for (i = 0; i < 4; i = i + 1)
       begin
       temp = {X[i], E1};
       Y1 = - Y;
  case (temp)
       2'd2 : Z [7 : 4] = Z [7 : 4] + Y1;
       2'd1 : Z [7 : 4] = Z [7 : 4] + Y;
       default : begin end
       endcase
       Z = Z >> 1;
      
       Z[7] = Z[6];
      
     
       E1 = X[i];
           end
       if (Y == 4'd8)
     
     
           begin
               Z = - Z;
           end
     
       end
     
      
endmodule

Test Bench
module BoothTB;

    // Inputs
    reg [3:0] X;
    reg [3:0] Y;

    // Outputs
    wire [7:0] Z;

    // Instantiate the Unit Under Test (UUT)
    BoothMulti uut (
        .X(X),
        .Y(Y),
        .Z(Z)
    );

    initial begin
        // Initialize Inputs
        X = 0;
        Y = 0;

        // Wait 100 ns for global reset to finish
        #100;
        X=-5;
          Y=7;
        // Add stimulus here

    end
     
endmodule

 
 
Soon We will Provide Output Pics also

3 comments:

  1. Hey post 8 bit Booth Multiplier also & Sequential Multiplier

    ReplyDelete
    Replies
    1. By Tomorrow evening, you will get both codes with verified output.✌

      Delete
    2. https://codesexplorer.blogspot.in/2017/02/8-bit-booth-multiplier-Verilog-Code.html

      Delete

Powered by Blogger.