Simulating tri-state busses in Altera

greenspun.com : LUSENET : ece342 : One Thread

Simulating tri-state/bidirectional busses in Altera is a little bit trickier than for regular signals.

If you define a pin as INOUT, when you put it in the simulator there will be two copies of the pin, one an input and one an output. The input version of the pin requires a stimulus from you, and a default of 0 won't work very well, since at some point your circuit will try to drive the output pin to 1, and there will be contention. (Remember that this pin can be driven by your circuit or by some external source represented in the simulation by the input pin.)

The best thing to do is to make the default state of the input pin HiZ, and only draw 0/1 signals in sections where you expect some external device to actually drive the pin.

To set the input pin's default state to HiZ, left click either on the input pin symbol on the left in the SCF window or the Value column right next to it. In either case you should see the rest of the line become highlighted. Now left click to bring up the menu and choose Overwrite->High Impedance. You can now go and put in non-HiZ values where you want data to come in (typically when a write operation happens into your circuit).

For multi-bit signals like DATA(15 DOWNTO 0), you do much the same thing. Click to select the whole signal, then bring up the menu, but this time choose Overwrite->Group Value. This brings up a window where you can put in a value such as ZZZZ, which represents 16 bits of HiZ. (Just as the hexadecimal value '0' represents 4 0 bits, a hexadecimal 'Z' represents 4 Z bits.)

Robin

-- Robin Grindley (grindley@eecg.toronto.edu), January 26, 1999


Moderation questions? read the FAQ