입니다. 내 systemverilog 코드 용 테스트 벤치를 작성할 때마다 구현이 올바른 경우에도 항상 출력이 X 인 것처럼 보입니다. 내 오류는 어디에 있습니까?출력은 항상 X
`timescale 1ns/1ps
module fsm(input logic clk, input logic reset,
input logic start, clockwise,
output logic [3:0] pattern);
parameter A=4'b1100,
B=4'b0110,
Ab=4'b0011,
Bb=4'b1001;
typedef enum logic [1:0] {S0,S1,S2,S3} statetype;
statetype state, nextstate;
//state register
always@ (posedge clk)
begin
if (reset)
state= S0;
else
state = nextstate;
end
//nextstate logic
always_comb
case(state)
S0: if(start==1 && clockwise==0)
nextstate<= S3;
else if(start==1&&clockwise==1)
nextstate<=S1;
else
nextstate<=S0;
S1: if(start==1 && clockwise==0)
nextstate<= S0;
else if(start==1&&clockwise==1)
nextstate<=S2;
else
nextstate<=S1;
S2: if(start==1 && clockwise==0)
nextstate<= S1;
else if(start==1&&clockwise==1)
nextstate<=S3;
else
nextstate<=S2;
S3: if(start==1 && clockwise==0)
nextstate<= S2;
else if(start==1&&clockwise==1)
nextstate<=S0;
else
nextstate<=S3;
endcase
//output logic
[email protected] (posedge clk)
case(state)
S0: pattern= A;
S1: pattern= B;
S2: pattern= Ab;
S3: pattern= Bb;
endcase
endmodule
여기에 내가 잘못 내 유한 상태 기계입니다 있는지 확실하지 않습니다 또는 내 테스트 벤치
module fsmtest();
logic clk, reset, clockwise, start;
logic [3:0] pattern;
fsm dut(clk, reset, start, clockwise, pattern);
//generate clock
always
begin
clk=0; #5; clk=1; #5;
end
initial
begin
reset=0;
start=1;
clockwise=1;
#10;
start=0;
#10;
end
endmodule
이다는 테스트 벤치가 있다면. 도와 줘서 고마워. 미리 감사해.
차단/차단 해제가 혼합되어 있습니다. 조합 ('always_comb' /'always @ *')은 차단되어야합니다 ('='). 순차적 ('@ (posedge clk)')은 비 차단 ('<=')이어야합니다. – Greg
부끄러움을 느끼지 못했지만 이것에 대해 잘 모르는 덕분에 – John