简体   繁体   中英

ModelSim Altera 10.1d - verilog I can't get wave forms

I have a basic bistable code, i compile it without any errors, but when i whant to add waveforms after i hit run(f9), my altera program doesn't do anything... Here is my code:

module bistable(input a, 
            input rst, 
            input ck,
            output reg out);
always@(posedge ck) 
if(!rst) out<=0; 
   else out<=a;         
endmodule

Test module:

module test();
reg a; 
reg ck; 
reg rst; 
wire out; 
bistable bis(.a(a),.ck(ck),.rst(rst),.out(out));

initial begin
ck=0;
forever ck=~ck;
end
initial begin
a=1;
rst=0;
#14 rst=1;
#20 rst=0;
#10;
$stop;
end
endmodule

I did programs without clock and my waveforms appeared very well, but that's not what I think is the cause of my problem.

Thanks in advance for any help!

forever ck=~ck; is a zero time infinite loop. The simulation will not move to the next time step until all operations on the current time step is completed (which is impossible when there is a zero time infinite loop).

Adding time delay to your clock will help. For example: forever #5 ck=~ck;

Check your log file. Some simulators will report errors or warnings when they encounter an infinite loop.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM