tica, Arial, sans-serif">
原程序代码如下:
module fsm(Clock,Reset,A,K2,K1,state);input Clock,Reset,A;
output K2,K1;
output[1:0]state;
reg K2,K1;
reg[1:0]state;
parameter Idle=2'b00,Start=2'b01,Stop=2'b10,Clear=2'b11;
always@(posedge Clock)
if(!Reset)
begin
state<=Idle;
K2<=0;
K1<=0;
end
else
case(state)
Idle:if(A)
begin
state<=Start;
K1<=0;
end
else
begin
state<=Idle;//
K2<=0;
K1<=0;
end
Start:if(!A)
state<=Stop;
else
state<=Start;
Stop:if(A)
begin
state<=Clear;
K2<=1;
end
else
begin
state<=Stop;
K2<=0;
K1<=0;
end
Clear:if(!A)
begin
state<=Idle;
K2<=0;
K1<=1;
end
else
begin
state<=Clear;;
K2<=0;
K1<=1;
end
default:state<=2'bxx;
endcase
endmodule
请问程序中红 {MOD}的代码怎么看的出来的,从状态转移图中感觉看不出来红 {MOD}代码呀?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>