Electrical Engineering Question:
Given the following snipet of Verilog code draw out the waveforms for clk?

Answer:
Given the following snipet of Verilog code, draw out the waveforms for clk and a
always @(clk) begin
a = 0;
#5 a = 1;
end
<pre>
10 30 50 70 90 110 130
___ ___ ___ ___ ___ ___ ___
clk ___| |___| |___| |___| |___| |___| |___| |___
a ___________________________________________________________
</pre>This obviously is not what we wanted, so to get closer, you could use
"always @ (posedge clk)" instead, and you'd get<pre>
10 30 50 70 90 110 130
___ ___ ___ ___ ___ ___ ___
clk ___| |___| |___| |___| |___| |___| |___| |___
___ ___
a _______________________| |___________________| |_______
</pre>
always @(clk) begin
a = 0;
#5 a = 1;
end
<pre>
10 30 50 70 90 110 130
___ ___ ___ ___ ___ ___ ___
clk ___| |___| |___| |___| |___| |___| |___| |___
a ___________________________________________________________
</pre>This obviously is not what we wanted, so to get closer, you could use
"always @ (posedge clk)" instead, and you'd get<pre>
10 30 50 70 90 110 130
___ ___ ___ ___ ___ ___ ___
clk ___| |___| |___| |___| |___| |___| |___| |___
___ ___
a _______________________| |___________________| |_______
</pre>
Previous Question | Next Question |
Given the following Verilog code, what value of "a" is displayed? | What is the difference between the following two lines of Verilog code? |