Hmmm... that brings up another question: where are the semantics of
inout ports clearly described?
I'll check the LRM and find the relevant references when I
have a few moments. Somewhere in the discussion of drivers,
I think.
In Verilog, an inout port/connection is treated as if the internal and
external nets are connected with a "tran" object. Makes sense in
Verilog, but VHDL has no such thing.
In Verilog, unidirectional port connections have an implicit
continuous assignment across the port, no? And simulators
can choose to "port-collapse" by making the nets identical.
In VHDL, nets (signals) on either side of a port are effectively the
same net. All drivers are resolved together, on whichever side of
the port they reside; all "receivers" (processes that read the value
of the signal) see the same value at all times, regardless of which
side of the port they reside. This is pretty much the same
as a collapsed port connection in Verilog, I think. Collapsed
inout ports give the simulator less work to do than "tran"
primitives.
[Scenario...]
inout port, connecting nets FOO and BAR, type std_logic.
Initially FOO and BAR are 'Z'.
FOO changes to '1'. Now BAR sees a driver driving '1', and when
resolved with other drivers driving 'Z', works out to '1'.
FOO sees exactly the same.
So far so good.
Now FOO changes back to 'Z', or at least the driver that was driving
the '1' now drives a 'Z'. But in that delta, BAR is still '1', so
is the inout port still driving a '1' onto FOO?
No, certainly not. BAR has its drivers, whose value(s) are controlled
by processes on that side of the port, and those drivers continue
to drive Z just as they always did. The visible value of BAR drops
back to Z at EXACTLY the same time as does the visible value of FOO,
because they're the same.
Of course, if you were to build some kind of "keeper" circuit
on the BAR side, things would be different:
process (BAR)
begin
case BAR is
when '1' | 'H' => BAR <= 'H';
when '0' | 'L' => BAR <= 'L';
when others => BAR <= 'W';
end case;
end process;
In Verilog-speak that's (near enough)
assign (weak0, weak1) BAR = BAR;
You wouldn't expect to get that in Verilog without asking
for it; nor do you get it unexpectedly in VHDL.
The expected result is that everything will return to 'Z'
Just as well, really
Sorry if I sound a bit jaundiced about all of this. I'm
working hard today on getting a clear understanding of
SystemVerilog's scheduling model with its stratified
event queue of ELEVEN regions, and thinking to myself
how much clearer and simpler things are in VHDL.
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * Perl * Tcl/Tk * Verification * Project Services
Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223 mail: (e-mail address removed)
Fax: +44 (0)1425 471573 Web:
http://www.doulos.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.