Looking to understand intra assignment delays

Guest #4082994
Rate this post
• ▲ useful
▼ not useful
Hi,

I'm learning verilog and looking to understand intra assignment delays. 
I read some books and I think I have the basics covered. I was looking 
online for some questions and came across this which I cant seem to 
understand:


Q: Using the given, draw the waveforms for the following
versions of a (each version is separate, i.e. not in the same run):



reg clk;
reg a;

always #10 clk = ~clk;

(1) always @(clk) a = #5  clk;
(2) always @(clk) a = #10 clk;
(3) always @(clk) a = #15 clk;

Now, change a to wire, and draw for:

(4) assign #5  a = clk;
(5) assign #10 a = clk;
(6) assign #15 a = clk;

A:


       10      30      50      70      90     110     130
        __     ___     ___     ___     ___     ___     __
clk ___|   |___|   |___|   |___|   |___|   |___|   |___|   |___

          __     ___     ___     ___     ___     ___     __
(1)a ____|   |___|   |___|   |___|   |___|   |___|   |___|   |_

            __     ___     ___     ___     ___     ___     __
(2)a ______|   |___|   |___|   |___|   |___|   |___|   |___|


(3)a ________________________________________________________

Since the #delay cancels future events when it activates, any delay
over the actual 1/2 period time of the clk flatlines...

With changing a to a wire and using assign, we
just accomplish the same thing...

       10      30      50      70      90     110     130
        __     ___     ___     ___     ___     ___     __
clk ___|   |___|   |___|   |___|   |___|   |___|   |___|   |___

          __     ___     ___     ___     ___     ___     __
(4)a ____|   |___|   |___|   |___|   |___|   |___|   |___|   |_

            __     ___     ___     ___     ___     ___     __
(5)a ______|   |___|   |___|   |___|   |___|   |___|   |___|


(6)a ________________________________________________________




For each of the #15 delays, how is the output a always 0? The text 
states the #delay cancels future events when it activates. What does 
this mean? Shouldnt a be assigned 1 #15 after the clock every time?

Thanks

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.