J
Jonathan Bromley
Guest
On Tue, 20 May 2008 11:40:23 -0800, glen herrmannsfeldt wrote:
this one is _guaranteed_ to be broken in any single-threaded
simulator, but gives correct simulation results if nonblocking
assignment is used.
module broken_ring_counter (
input clock,
input reset,
output [1:0] q
);
reg a, b;
always @(posedge clock)
if (reset)
a = 1'b0;
else
a = b;
always @(posedge clock)
if (reset)
b = 1'b0;
else
b = ~a;
assign q = {a, b};
endmodule
Why, oh why, does this argument rage on endlessly?
Why can't people just do it right, and move on to the
real problems?
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Aaaaaarggggh. Another one to pulp.Looking at Sternheim & Singh, all the example code uses blocking
assignment. I don't see any discussion that this could be
a problem.
Plenty. I don't even need to appeal to nondeterminism;Do you have any examples of legal verilog code with multiple
clocked always blocks that evaluate in the wrong order?
this one is _guaranteed_ to be broken in any single-threaded
simulator, but gives correct simulation results if nonblocking
assignment is used.
module broken_ring_counter (
input clock,
input reset,
output [1:0] q
);
reg a, b;
always @(posedge clock)
if (reset)
a = 1'b0;
else
a = b;
always @(posedge clock)
if (reset)
b = 1'b0;
else
b = ~a;
assign q = {a, b};
endmodule
Why, oh why, does this argument rage on endlessly?
Why can't people just do it right, and move on to the
real problems?
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.