verilog 오류? 상태...?
-
게시물 수정 , 삭제는 로그인 필요
`timescale 1ns / 1ps
module oneshot_fsm(clk, sig, rstb, sig_oneshot);
input clk;
input sig;
input rstb;
output sig_oneshot;
reg q;
assign sig_oneshot = (sig & (~q));
always @(posedge clk or negedge rstb or posedge sig) begin
if(!rstb)
sig = 0;
else q <= sig;
end
endmodule
module tb_oneshot_fsm;
reg clk , sig, rstb;
wire sig_oneshot;
oneshot_fsm u0( clk , sig, rstb , sig_oneshot);
initial clk = 0;
always #5 clk = ~clk;
initial begin
sig = 0; rstb = 0;
#10 rstb =1;
#22 sig = 1;
#20 sig = 0;
#40 sig = 1;
#40 sig = 0;
#10;
$stop;
end
endmodule
//////
idle 상태에서는 sig 신호가 들어오면 wait
wait 상태에서 sig 0이 되기를 기다려 idle
출력신호 sig_oneshot은 idle상태에서 sig신호가 1일때만 1로 출력
뭐가 문제인가요? 오류날 이유는 없어 보이는데요..
![](https://img-api.cboard.net/img_n.php?image_url=https://kin-phinf.pstatic.net/20221105_10/1667611991632bLKGI_PNG/%C1%FA%B9%AE.png)
![](https://img-api.cboard.net/img_n.php?image_url=https://kin-phinf.pstatic.net/20221105_10/1667611991632bLKGI_PNG/%C1%FA%B9%AE.png)