module Prob_7_18_Control_Unit (output reg Ld_AR_BR, Div_AR_x2_CR, Mul_BR_x2_CR, Clr_CR, output
done, input start, AR_gt_0, AR_lt_0, clock, reset_b);
reg state, next_state;
parameter S0 = 0, S1 = 1;
assign done = (state == S0);
always @(posedge clock, negedge reset_b)
if (reset_b == 0) state <= S0;
else state <= next_state;
S1: begin
next_state = S0;
if (AR_lt_0)Div_AR_x2_CR = 1;
else if (AR_gt_0 > 0) Mul_BR_x2_CR = 1;
else Clr_CR = 1;
end
endcase
end
endmodule
CR <= 0;
end
else begin
if (Ld_AR_BR) begin AR <= data_AR; BR <= data_BR; end
//if (Div_AR_x2_CR) CR <= (AR >>> 1);
if (Div_AR_x2_CR) CR <= {AR[15], AR[15: 1]};
//if (Div_AR_x2_CR) CR <= AR / 2;
if (Mul_BR_x2_CR) CR <= (BR << 1);
if (Clr_CR) CR <= 0;
end
endmodule