This question is better to ask on comp.lang.verilog.
1. Yep, very confusing. Thus why with System Verilog, you have new rules
that don't care about where and what is assigned. type "logic" can be
assigned in both flows.
2. That is the point of text book examples. It is supposed to be
confusing. It is an example of what not to do. there are better ways to code
this and know exactly what the result would be. In this case if reset
changed value at the same time that clock had a posedge the final result
would depend on the order that the TOOL executed the blocks. There is no
defined garantee of which value would be written.
3. Logically the initial forever and always blocks appear to be similar. But
you would be hard pressed to find a synthesis tool that will turn a initial
forever construct into logic gates. For emulation there are some synthesis
tools that can map an initial forever block to gates. Another gotcha is when
is the block evaluated. The simulator must schedule events to happen. Based
on the LRM and the tool nvendors interpretation of the LRM the order I which
the initial blocks are evaluated and the always blocks are evaluated will
change the behavior of the simulation.
"Fei Liu" <
[email protected]> wrote in message
news:
[email protected]...
> 1. In verilog, for continuous assignment, the assignee must be scalar
> or vector net; for procedure assignment, the assignee cannot be scalar
> or vector net; then for procedure continuous assignment, the assignee
> can only be scalar or vector of registers. This is very confusing. I
> can't quite see the logic behind such language design.
>
> 2. multiple event triggered always block updating same register
> causing race condition or undefined behavior. e.g.
>
> always @(posedge clock)
> a = 1'b1;
> always @(reset)
> a = 1'b0;
> If both reset turns high and clock turns high at the same time, what's
> the result? I see code like this in text books which confuses me.
>
> 3. my understanding is that always statements is similar to
> initial
> forever statements
>
> other than the practical reason always is preferred for looping
> statements, any catch I don't see?
>
> Thanks a lot!
>
> Fei