VHDL port inout problem

M

mkumar

Hi

I have an entity with inout port and instantiated this entity in the
test bench to send some test waveforms to it. Even though I assign a
value to this port in the test bench it always gets "U". The debugger
shows that the assignment istatement s getting executed but the value
remains "U". When I change the port type to "in" in the inner entity
and leave the port type as inout in the top level entity (test bench)
it works fine. Why? I would really appreciate if anyone could clarify
this behaviour.

Thanks
MKumar
www.onchiptech.com
 
M

Mike Treseler

I have an entity with inout port and instantiated this entity in the
test bench to send some test waveforms to it. Even though I assign a
value to this port in the test bench it always gets "U". The debugger
shows that the assignment istatement s getting executed but the value
remains "U". When I change the port type to "in" in the inner entity
and leave the port type as inout in the top level entity (test bench)
it works fine.

If this is an internal port,
or if there are pins to spare,
consider separate input and output ports.
If the port really does need to time share
the a tri-buf pin, then direction control
logic must be added to the design.

For example, see the signals OE and READY
in the Bi-Directional Port example here:

http://home.comcast.net/~mike_treseler/

-- Mike Treseler
 
B

bhavanireddy

If this is an internal port,
or if there are pins to spare,
consider separate input and output ports.
If the port really does need to time share
the a tri-buf pin, then direction control
logic must be added to the design.

For example, see the signals OE and READY
in the Bi-Directional Port example here:

http://home.comcast.net/~mike_treseler/

-- Mike Treseler

Mike, Thanks
Its a bi-directional data bus with directional logic provided by Read
and Write control signals. When Read is active data is read from the
port and when write is active data is written to the port. I looked at
your eaxmple, thanks for the link, but I don't see reading from data
or data_s in the oe_demo.

MKumar
ONCHIP Technologies (P) Ltd
(OTUSB - embedded USB Software)
www.onchiptech.com
 
A

Account1

Mike Treseler said:
Hmmm. If the port works "fine" as IN, that implies
that bidirectional data is not required there.

Is there a good documentation about using inout ports? What the simulator
exactly does when evaluating design containing inout ports? What say LRM?


Thanks
 
A

Andy

The unit under test has a driver for that signal too...

If not explicitly defined, it is driven as 'U'. You need an explicit
driver to 'Z' in there if you are not otherwise driving it. That way
the testbench driven value will win.

The only reason I use inouts for otherwise input only ports is if they
are part of a record type port, which usually ends up being mode inout
to handle different elements of the record being inputs and outputs.
Gets confusing after a bit, but synthesis figures out when you have a
continuous assignment to 'Z', and just gets rid of the driver
altogether. I usually define a default constant of all 'Z's for each
record type to make specifying a default driver easier. Unfortunately,
this means I cannot use integers, booleans, enums, etc. in those
record ports.

We really need user-defined modes for record types on ports, that can
individually define different modes for different elements of the same
record port.

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top