Guest
Jason Zheng wrote:
by the various blocking assignments to the same reg. You could view
the situation such that the assignments to comb_v are combinatorial to
temporary variables and comb_v as seen in a simulator's VCD file
updates in zero time on the upclock of clk. In real life, there are
setup/hold constraints so comb_v (or some prelatched copy) needs to be
ready before the upclock, otherwise q2's d pin wouldn't be happy.
For kicks I just ran that verilog of Mike's through a synthesizer for a
cycle simulator I wrote many years ago. In order to preserve the
rising edge semantics of that block, comb_v is the output of a dflop
that is equivalent to q2 (but both are fed by the same combinatorial
temporary variable). Nothing uses comb_v's value from the upclock, so
setting the synthesizer up to strip out unused latches generates pretty
much exactly the same circuit in Mike's PDF file with the exception
that comb_v vaporizes and in its place is a temp variable.
Nice example, Mike. If you also make comb_v an output, does your
synthesizer simply wire it to q2 in order to save the extra latch? It
doesn't seem like it can legally remain combinatorial when you qualify
it with @(posedge clk) if you use it outside of that block.
-t
There has to be combinatorial logic for intermediate results generatedBut I'm not sure what the RTL behavior is to start with. Aside from
mixing the blocking and non-blocking assignments, I thought anything
assigned in clock-triggered always blocks are automatically sequential.
Show me a page in Verilog language manual that says blocking assignments
in sequential blocks gives you combinational logic?
by the various blocking assignments to the same reg. You could view
the situation such that the assignments to comb_v are combinatorial to
temporary variables and comb_v as seen in a simulator's VCD file
updates in zero time on the upclock of clk. In real life, there are
setup/hold constraints so comb_v (or some prelatched copy) needs to be
ready before the upclock, otherwise q2's d pin wouldn't be happy.
For kicks I just ran that verilog of Mike's through a synthesizer for a
cycle simulator I wrote many years ago. In order to preserve the
rising edge semantics of that block, comb_v is the output of a dflop
that is equivalent to q2 (but both are fed by the same combinatorial
temporary variable). Nothing uses comb_v's value from the upclock, so
setting the synthesizer up to strip out unused latches generates pretty
much exactly the same circuit in Mike's PDF file with the exception
that comb_v vaporizes and in its place is a temp variable.
Nice example, Mike. If you also make comb_v an output, does your
synthesizer simply wire it to q2 in order to save the extra latch? It
doesn't seem like it can legally remain combinatorial when you qualify
it with @(posedge clk) if you use it outside of that block.
-t