Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

verilog always empty sensitivity list

always clk <= #5 !clk;

Seems this doesn`t work and get a "out-of-memory" errors with VCS

What's the reason behind this? I have the feeling the VCS can't get out of the event it scheduled for clk. but don't know why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are getting an "out-of-memory" error because it is an non-blocking infinite loop adding future events to the scheduler.

always is functionally equivalent to initial while(1) (an infinite loop). <= #5 doesn't consume time, it schedules an update in the future. There is no time blocking delays in the loop.

Without a time blocking delay the simulator keeps executing the same loop in the same time step. The simulate will not move to the next time step until all operations in the current time step are complete or suspended. Eventually the simulator will run out of memory and error out. Some simulators may exit out early if an infinite loop is detected.

Typically, clocks are generated with LHS delays and with blocking statements. Examples:

reg clk = 1'b1; // or 1'b0
always #5 clk = !clk;

or

reg clk;
initial begin
  clk = 1'b1; // or 1'b0
  forever #5 clk = !clk;
end

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...