Forum Discussion
Altera_Forum
Honored Contributor
15 years agoSimulation
My testbench couldn't generate clock wave. The code is : //-------------------------- always //@ (SYS_RST, SYS_CLK) // optional sensitivity list // @(event1 or event2 or .... eventn) ...
Altera_Forum
Honored Contributor
15 years agoHi, AndrewS6:
Thanks. But there's another bug~ code 1: --- Quote Start --- initial begin SYS_CLK <= 0; $display($time, "SYS_CLK = 0"); forever# (SYS_CLK_PERIOD/2) SYS_CLK <= ~ SYS_CLK; $display($time, "SYS_CLK reverse"); CD_PULSE <= 0; $display($time, "CD_PULSE = 0"); forever# (CD_PULSE_PERIOD/2) CD_PULSE <= ~ CD_PULSE; $display($time, "CD_PULSE reverse"); end --- Quote End --- http://www.alteraforum.com/forum/attachment.php?attachmentid=3821&stc=1&d=1300376027 code 2: --- Quote Start --- initial begin SYS_CLK <= 0; $display($time, "SYS_CLK = 0"); forever# (SYS_CLK_PERIOD/2) SYS_CLK <= ~ SYS_CLK; $display($time, "SYS_CLK reverse"); end initial begin CD_PULSE <= 0; $display($time, "CD_PULSE = 0"); forever# (CD_PULSE_PERIOD/2) CD_PULSE <= ~ CD_PULSE; $display($time, "CD_PULSE reverse"); end --- Quote End --- http://www.alteraforum.com/forum/attachment.php?attachmentid=3822&stc=1&d=1300376034 I just put the CD_PULSE and SYS_CLK assignment in different initial block and the result is right. I am still confused about that. Hope you can help me with this.