Testing bits that are in high impedance

greenspun.com : LUSENET : ece342 : One Thread

Hi, I'm having trouble with this situation. I have an if-statement checking a bit for a logic '0'. If it find it it enters one state, else enter another. The problem arises when there is nothing driving the bit at the moment and is in high impedance. When the bit is high impedance and it checks for the '0', the state-machine completely loses state and executes nothing. It doesn't even bother with the else statement. Is there a way around this problem?


-- Jake Dalton (daltonj@ecf.utoronto.ca), February 19, 1999


Although a signal can have the value 'Z', this doesn't actually correspond to anything very meaningful in a real ciruit. If your logic does not drive anything (i.e. it is 'Z') on a wire then it could be that some other device externally is driving it to some valid logic level. It is also possible that none of the drivers attached to a wire are driving it. In this case there will still be some voltage level on the line. If the level was '1' then over time the charge stored in the line capacitance will slowly leak away and the signal level will fall through the invalid zone and head back to '0'.

For simulation purposes, if an input is 'Z' and it feeds a register, then when the register clocks its output becomes 'X' (undefined). This makes sense, since the register will actually latch some value, either '0' or '1' but it is not possible to predict which.

After all that explanation, the real answer to your question is, why do you have an input that controls state machine behaviour if you cannot be sure that anyone is driving the signal? If you know that this signal *will* actually be driven by some other device at the point in the state machine where you check it, then *you* are responsible in the simulation for drawing in the signal values that would be driven by the external device. (Your logic assumes that certain signals are driven at certain times, but the simulation has no way of knowing this, which is why you have to draw these stimuli yourself.)

So, if your DMA engine has started, and driven /AS and an address, then the slave (memory) will have started driving the /DTACK line (to '1' initially, until the data is ready). In the SCF file, when your controller has started to drive /AS, you have to draw in /DTACK going to '1', then some time later going to '0' with some data.

Hope this clears it up.


-- Robin Grindley (grindley@eecg.toronto.edu), February 23, 1999.

Moderation questions? read the FAQ