always @(clk)
begin
a = 0;
a <= 1; $display(a); end
Q: Given the following snippet of Verilog code, draw out the waveforms for "clk" and "a".
always @(clk)Q: What is the difference between the following two lines of Verilog code?
begin
a = 0;
#5 a = 1;
end
#5 a = b;Q: Write Verilog to provide a divide-by-3 clock from the standard clock.
a = #5 b;
Q: What is the difference between:
c = foo ? a : b;Q: Using the given, draw the waveforms for the following (each version is separate, i.e. not in the same run):
and
if (foo) c = a; else c = b;
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 to a wire, and draw for:
(4) assign #5 a = clk;
(5) assign #10 a = clk;
(6) assign #15 a = clk;
Your comments will be moderated before it can appear here. Win prizes for being an engaged reader.