Moore Model in Verilog in Sequential Circuits

Field-Programmable Gate Arrays
Post Reply
User avatar
Magneto
Major
Major
Posts: 430
Joined: Wed Jul 15, 2009 1:52 pm
Location: London

Moore Model in Verilog in Sequential Circuits

Post by Magneto » Sat Nov 14, 2009 10:00 pm

m0_1.JPG
m0_1.JPG (18.36 KiB) Viewed 8051 times
m0_2.JPG
m0_2.JPG (8.61 KiB) Viewed 8051 times
//Moore state diagram (Fig. 5-19)
module Moore_mdl (x,AB,CLK,RST);
input x,CLK,RST;
output [1:0]AB;
reg [1:0] state;
parameter S0 = 2'b00, S1 = 2'b01, S2 = 2'b10, S3 = 2'b11;
always @ (posedge CLK or negedge RST)
if (~RST) state = S0; //Initialize to state S0
else
case (state)
S0: if (~x) state = S1;
S1: if (x) state = S2; else state = S3;
S2: if (~x) state = S3;
S3: if (~x) state = S0;
endcase
assign AB = state; //Output of flip-flops
endmodule
Post Reply

Return to “FPGA”