I must say that I do not agree with aqua. What he (and wisemonkey) says about @* is right, but everything else is wrong.
These two lines have nothing to do with the idle state. These statements are good coding practices. They ensure that these two outputs are always assigned when this always block is evaluated. Let's see why this is important:
- Imagine that these two statements are not.
- Further, suppose that
state_reg = S0 and a = b = 0 - When we always calculate a block, we introduce the operator case, s0 half and assign 1
y1 a is zero, so we do not enter an if statement, and we exit it and end the block
At the end of the block, y1 == 1 and y0 == ... erm, hold on to what y0 does? I think he should preserve his old value. This is not new.
This means that perhaps y0 should remember this value from one cycle to another. This would mean that it should have some kind of memory, for example, a register or a latch. In this case, it will be a latch, because it is written in a style that sometimes leads to exit and sometimes holds it.
... but we do not want this. y1 and y0 should have been simple wires. Therefore, we must make sure that each of them is always assigned, no matter what state or source data. We could do this with assignments in all branches of the logic, but it becomes a lot of work. Alternatively, we can have a default assignment, which we will redefine later if necessary.
The reason these instructions do not enter y1 at 0 in s0 or s1 is because everything that happens inside a block always happens without passing time. Mileage between 0 is assigned from above and 1 in s0 or s1 . Everything that is visible is the final state.
You will notice that the code does the same with the state variable. It has a default assignment, the next state of which is the current state, and then overrides its correct conditions.
Nice clean car. Nothing wrong with that.
source share