这是我的有限状态机的代码
//
`timescale 1ns / 1ps
//Moore Finite State Machine Lab 3
//
// WORKING, needs Screen output
module moore(
input BTNC, //manual clk
input SW0, //clr
input SW1,
input SW2,
input SW3,
input SW4,
output reg [3:0] LED, //z
reg [2:0] y,Y
);
localparam S_00=3'b000, S_01=3'b001, S_02=3'b010,
S_03=3'b011, S_04=3'b100;
//Define next state
always @(y,SW0,SW1,SW2,SW3,SW4)
begin
case (y)
S_00: if (SW1) Y <= S_01;
else Y <= S_00;
S_01: if (SW1) Y <= S_02;
else if (SW3) Y <= S_03;
else Y <= S_01;
S_02: if (SW1) Y <= S_04;
else Y <= S_02;
S_03: if (SW2) Y <= S_04;
else if (SW3) Y <= S_02;
else Y <= S_03;
S_04: if (SW2) Y <= S_02;
else if (SW4) Y <= S_00;
else Y <= S_04;
default: Y <= 3'bxxx;
endcase
end
//Define state update
always @(SW0, BTNC)
begin
if (!SW0) y <= S_00;
else y <= Y;
end
//Define output
always @(y)
if (y==S_00)
begin
assign LED = 3'b000;
end
else if (y==S_01)
begin
assign LED = 3'b001;
end
else if (y==S_02)
begin
assign LED = 3'b010;
end
else if (y==S_03)
begin
assign LED = 3'b011;
end
else if (y==S_04)
begin
assign LED = 3'b100;
end
else
begin
assign LED = 3'b000; //not used
end
endmodule // lab3ht codename moore
当试图在 vivado 2015.3 中合成时,这就是它告诉我的
[Common 17-69] Command failed: Vivado Synthesis failed
[Synth 8-285] failed synthesizing module 'moore' ["C:/Users/C/Desktop/moore3h/moore3/moore3.srcs/sources_1/new/moore.v":6]
[Synth 8-27] procedural assign not supported ["C:/Users/C/Desktop/moore3h/moore3/moore3.srcs/sources_1/new/moore.v":51]
[Synth 8-567] referenced signal 'Y' should be on the sensitivity list ["C:/Users/C/Desktop/moore3h/moore3/moore3.srcs/sources_1/new/moore.v":41]
我知道延迟无法合成,我尝试通过摆脱 always @(negedge BTNC) 并仅使用按钮来解决此问题,但这就是我对 verilog 的了解。我不知道为什么不能合成,所以我以后可以生成一个比特流并将其上传到 basys3 板并在那里使用它非常感谢任何见解,代码在模拟过程中运行良好