02-28-2014 01:22 AM
Following are the relevant lines of code
03-01-2014 09:40 AM
03-02-2014 08:32 PM
"The expression passed to if is converted boolean by a non-zero check ie (exp != 0). This has a value of 1 if all bits of the expression are zero and a value of zero if any of the bits are set. It is also similar to a 'reduction or'" .
I checked in simulation that if demux_timeout is 24'h800000 in a clock pulse then demux_timeout <= 0; is executed the next clock pulse and then onwards demux_timeout gets incremented by 1 until it again becomes 24'h800000 and the process repeats. So demux_timeout behaves as a counter whose last value is 24'h800000 after which it again goes to 0 and repeats counting incrementing by 1 each clock pulse.So the if condition is getting a value of 1 when demux_timeout is 24'h800000 that is the result of the '&' operation in the if condition is 24'h800000 so MSB is set when if is getting a 1 unlike you said that all bits need to be zero for the if expression to get a value of 1
03-02-2014 09:05 PM