4X4 BOOTH MULTIPLIER
4X4 BOOTH MULTIPLIER
module BOOTH_Multiplier(RESULT, X, Y);
RESULT reg signed [7:0] RESULT;
input signed [3:0] X,Y;
reg [1:0] State;
reg [5:0] K;
reg e;
reg [3:0] Z;
always @(X,Y)
begin
RESULT = 8'd0;
e = 1'b0;
Z = -Y;
for (K=0; K<4; K=K+1)
begin
State = { X[K], e };
case(State)
2'd2 : RESULT[7:4] = RESULT[7:4] + Z;
2'd1 : RESULT[7:4] = RESULT[7:4] + Y;
endcase
RESULT = RESULT >> 1;
RESULT[7] = RESULT[6];
e=X[K];
end
end
endmodule
Comments
Post a Comment