Closed ghost closed 8 years ago
You would have to specify the default value before your when
block to get the anticipated behavior (same thing with Verilog). That io.a := Bool(false)
is overwriting any logic that you establish with your when
block., but it should give you the correct behavior if you place it before the when
block.
Right! Thanks!
Hello! I got confused when this code:
gave me this:
Then I changed the code to this:
and now the result is what I expected:
I always thought that I could place "default value" for wire wherever I want and just specify the values with 'when' blocks without explicitly saying 'otherwise' for this wire. Well, not just thought, I use this approach with slightly more complicated dependencies for 'when' expression and it works as expected.
Is Chisel right about these two examples?