endmodule
module Control_Unit #(parameter L_word = 4)(
output reg Load_words, Shift, Add_shift,
output Ready,
input m0, empty_multiplier, Empty, Start, clock, reset
);
always @ (state, Start, m0, Empty) begin // Next state and control logic
Load_words = 0; Shift = 0; Add_shift = 0;
case (state)
S_idle: if (Start && Empty) next_state = S_5;
else if (Start) begin Load_words = 1; next_state = S_1; end
else next_state = S_idle;
S_1: begin if (m0) Add_shift = 1; else Shift = 1; next_state = S_2; end
module Datapath_Unit #(parameter L_word = 4)(
output reg [2*L_word -1: 0] product,
output m0, empty_multiplier, Empty,
input [L_word -1: 0] word1, word2,
input Ready, Start, Load_words, Shift,
input Add_shift, clock, reset
);