RemyMartin
Junior Member level 1
It is well known that FSM goes into twos sorts: Moore and Mealy, I have some question about them:
1: Can one of them substitute the other?
2: Which one is better?
3: Mealy FSM can be descripted by two process, one is sequential, the other is combinational. The following is a sample program:
*************************************************************
module samplemealyFsm(clk,reset,Y,Z);
input clk,reset,Y;
output Z;
reg Z;
reg [1:0] CurrentState, NextState;
parameter ST0=2'b00,ST1=2'b01,ST2=2'b10,ST3=2'b11;
// the sequential process
always@(posedge clk or negedge reset)
if (!reset)
CurrentState=ST0;
else
CurrentState=NextState;
//the combinational process
always(CurrentState or Y)
begin
case(CurrentState)
ST0:
begin
NextState=ST1;
Z=decode(CurrentState,Y); // this means Z is the decode
//result of CurrentState and Y
end
ST1:
begin
NextState=ST2;
Z=decode(CurrentState,Y);
end
ST2:
begin
NextState=ST3;
Z=decode(CurrentState,Y);
end
ST3:
begin
NextState=ST0;
Z=decode(CurrentState,Y);
end
endcase
end
endmodule
*************************************************************
From the previous codes, we can get that the output of Mealy FSM Z changes asynchronously with clk; my 3rd question is "is this asynchronously change a good thing, since synchronous design is so popular."
Note: Moore FSM---The outputs depend only on the machine state, thus
synchronous design can be realized easily.
Mealy FSM---The ouputs depend on both the machine state and the
inputs to the machine, thus the outputs may change
asynchronously with the system clock.
Can somebody help me with those three questions? Thanks.
1: Can one of them substitute the other?
2: Which one is better?
3: Mealy FSM can be descripted by two process, one is sequential, the other is combinational. The following is a sample program:
*************************************************************
module samplemealyFsm(clk,reset,Y,Z);
input clk,reset,Y;
output Z;
reg Z;
reg [1:0] CurrentState, NextState;
parameter ST0=2'b00,ST1=2'b01,ST2=2'b10,ST3=2'b11;
// the sequential process
always@(posedge clk or negedge reset)
if (!reset)
CurrentState=ST0;
else
CurrentState=NextState;
//the combinational process
always(CurrentState or Y)
begin
case(CurrentState)
ST0:
begin
NextState=ST1;
Z=decode(CurrentState,Y); // this means Z is the decode
//result of CurrentState and Y
end
ST1:
begin
NextState=ST2;
Z=decode(CurrentState,Y);
end
ST2:
begin
NextState=ST3;
Z=decode(CurrentState,Y);
end
ST3:
begin
NextState=ST0;
Z=decode(CurrentState,Y);
end
endcase
end
endmodule
*************************************************************
From the previous codes, we can get that the output of Mealy FSM Z changes asynchronously with clk; my 3rd question is "is this asynchronously change a good thing, since synchronous design is so popular."
Note: Moore FSM---The outputs depend only on the machine state, thus
synchronous design can be realized easily.
Mealy FSM---The ouputs depend on both the machine state and the
inputs to the machine, thus the outputs may change
asynchronously with the system clock.
Can somebody help me with those three questions? Thanks.