V
Vikas Mishra
Guest
Hello Folks,
I am having some trouble understanding the operation of verilog
simulators w.r.t the design I want to implement below.
(I have drawn the diagram such that this should look ok with a fixed
width font - can't verify it looks correct using google group - but
basically it is a set of two flops where the first flop has a counter
at the input and flop A is clocked by clk, and flop B is clocked by
clk_by_2.)
+-----------+ +---------+ +---------+
| | | | | |
-----+ Counter +-------+ +-------------------+ |
| | | | | |
| | | Flop A | | Flop B |
+-----------+ | | | |
| /\ | | /\ |
+----+----+ +----+----+
| |
| |
| |
| |
| |
| +----------------+ |
| | | |
--------------+----+ Divide by 2 +-------+
| |
+----------------+
In this design, the flop A is being clocked by clk and Flop B is being
clocked by clk_by_2. I had modeled this using verilog without using
any #1. My observation with modelsim, VCS and NCSim is that Flop B,
latches the data that is launched by Flop A in the same cycle. The
simulator A.E's justify this saying that the Divide by 2, delays the
clock by a delta amount and due to this Flop B will latch the data in
the same clock.
I find this rather strange, since this is one of the cases, in which
not adding a #1 can result in a simulation synthesis mismatch
(simulator being wrong obviously).
Is this something that is expected ? What are the guidelines that you
folks follow in order to make sure that this simulates and synthesizes
correctly. Do you always add an incremental delay to the data to make
sure that this simulates as you would expect ?
I can post the verilog if someone would like to look at that.
Thanks for the help in advance.
Regards,
Vikas
I am having some trouble understanding the operation of verilog
simulators w.r.t the design I want to implement below.
(I have drawn the diagram such that this should look ok with a fixed
width font - can't verify it looks correct using google group - but
basically it is a set of two flops where the first flop has a counter
at the input and flop A is clocked by clk, and flop B is clocked by
clk_by_2.)
+-----------+ +---------+ +---------+
| | | | | |
-----+ Counter +-------+ +-------------------+ |
| | | | | |
| | | Flop A | | Flop B |
+-----------+ | | | |
| /\ | | /\ |
+----+----+ +----+----+
| |
| |
| |
| |
| |
| +----------------+ |
| | | |
--------------+----+ Divide by 2 +-------+
| |
+----------------+
In this design, the flop A is being clocked by clk and Flop B is being
clocked by clk_by_2. I had modeled this using verilog without using
any #1. My observation with modelsim, VCS and NCSim is that Flop B,
latches the data that is launched by Flop A in the same cycle. The
simulator A.E's justify this saying that the Divide by 2, delays the
clock by a delta amount and due to this Flop B will latch the data in
the same clock.
I find this rather strange, since this is one of the cases, in which
not adding a #1 can result in a simulation synthesis mismatch
(simulator being wrong obviously).
Is this something that is expected ? What are the guidelines that you
folks follow in order to make sure that this simulates and synthesizes
correctly. Do you always add an incremental delay to the data to make
sure that this simulates as you would expect ?
I can post the verilog if someone would like to look at that.
Thanks for the help in advance.
Regards,
Vikas