ELEC40006-P1-CW/SM.v

24 lines
445 B
Coq
Raw Normal View History

2020-06-02 19:09:22 +00:00
module SM
(
input CLK,
input E2,
2020-06-07 19:51:33 +00:00
input RST,
2020-06-02 19:09:22 +00:00
output FETCH,
output EXEC1,
output EXEC2
);
reg [2:0]s = 3'b1; //current state initialised to 001
always @(posedge CLK) //Change on rising edge of clock
begin
2020-06-07 19:51:33 +00:00
s[2] <= ~s[2] & s[1] & ~s[0] & E2 & ~RST;
s[1] <= ~s[2] & ~s[1] & s[0] & ~RST;
s[0] <= (~s[2] & s[1] & ~s[0] & ~E2) | (s[2] & ~s[1] & ~s[0]) | RST;
2020-06-02 19:09:22 +00:00
end
assign FETCH = s[0];
assign EXEC1 = s[1];
assign EXEC2 = s[2];
endmodule