module booth(ready,product,multiplier,multiplicand,start,clk);
input [7:0] multiplier;
input [7:0] multiplicand;
input start,clk;
output product;
output reg ready;
reg [7:0] product;
reg [3:0] Q;
reg [3:0] M;
reg [4:0] A;
reg [2:0] counter;
reg Q_1 = 0;
initial counter =0;
initial ready =1;
always @(posedge clk)
if( ready && start) 
begin 
  ready=0;
  counter=3'b100;
  A=0;
  M=multiplicand;
  Q=multiplier;
end 
else if (counter)
begin
  if( Q[0] == 1'b1 && Q_1 == 1'b0  ) begin
     A = A + M;
     end
  if( Q[0] == 1'b0 && Q_1 == 1'b1  ) begin
     A = A - M;
     end
  Q_1=Q[0];
  {Q,Q_1}= {Q,Q_1}>> 1;
  Q[3]=A[0];
  A = A>> 1;
  counter = counter- 1; 
if (counter == 0) begin
   product={A[3:0],Q};
   end
end 
endmodule 