|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 1804217364 于 2015-8-20 09:50 编辑
原程序代码如下:
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
请问程序中红色的代码怎么看的出来的,从状态转移图中感觉看不出来红色代码呀? |
|