第五讲状态机设计及其指导原则 4/ 38制作人:梁瑞宇 单位:河海大学
//sequential state transition
always @ (posedge clk or negedge nrst)
if (!nrst)
CS <= idle;
else
CS <= NS;
//combinational condition judgment
always @ (CS)
begin
case (CS)
idle: idle_task;NS = dorm;
dorm: dorm_task;NS = diningroom;
diningroom:diningroom_task;NS = classroom;
classroom: classroom_task;NS = dorm;
default: idle_task;NS = dorm;
endcase
end
endmodule