Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

module booth(x,y,z);

input signed[3:0]x;
input signed[3:0]y;
output reg signed[7:0]z=8'b0;
reg a;
reg e=0;
integer i=0;
reg [3:0]y1;
always @(x,y)
begin
y1=-y;
for(i=0;i<4;i=i+1)
begin
a = {x[i],e};
case(a)
2'b10 : z= z[7:4]+y1;

2'b01 : z= z[7:4]+y;
default: begin end
endcase
z= z>>>1;
e = x[i];
end
end

endmodule

TESTBENCH

initial begin
// Initialize Inputs
x = 0;
y = 0;
// Wait 100 ns for global reset to finish
#100;

// Add stimulus here


x=4'b0101;
y=4'b0111;
#100;

end
endmodule

You might also like