M
Mark Curry
Guest
For verilog net types (I'm refering to the default "resolved" types: wire,
wor, wand, etc), the net resolution tables from the Verilog standard
define the resolution for multiply driven nets.
(Table 6-2 through 6-4) (IEEE 1800-2012).
What I'm unsure about, however, is how hierarchy plays into the net resolution.
Consider the following:
Top level module with a single net:
wor y;
sub-modules that drive (port is an output wor y):
sub1 sub1( .y( y ) );
sub2 sub2( .y( y ) );
Sub1 drives y = 0;
Sub2 drives y = 1;
If I display "y" at each level of hier,
I can see two alternatives:
Alt 1:
top y = 1
sub1 y = 0
sub2 y = 1
Alt 2:
top y = 1
sub1 y = 1
sub2 y = 1
Alt 1 would be a stricter definition of the net resolution - it happens at
a scope level. (three nets are resolved, one at each level of hierarchy).
Alt 2 would be a looser definition of port direction. Here, the net is one
net, so resolution happens once. But the resolved value travels backwards
through the output port to the sub-level 1.
Modelsim says Alt 2 is correct. Both with and without vopt. ( I'd thought
port collapsing in the optimization could change the behaviour..)
I'm curious as to anywhere in the standard I can point to say this is
unequivocally true. Will all sims / synthesis agree?
I'm actually ok with either solution, I think, as long as it's consistent.
(I've actually used WOR's a lot in my code, but never "resampled", and output
and depended on it's resolved type. I've got a situation where it may be
useful to do so)
Any comments from Verilog standards experts?
Thanks,
Mark
wor, wand, etc), the net resolution tables from the Verilog standard
define the resolution for multiply driven nets.
(Table 6-2 through 6-4) (IEEE 1800-2012).
What I'm unsure about, however, is how hierarchy plays into the net resolution.
Consider the following:
Top level module with a single net:
wor y;
sub-modules that drive (port is an output wor y):
sub1 sub1( .y( y ) );
sub2 sub2( .y( y ) );
Sub1 drives y = 0;
Sub2 drives y = 1;
If I display "y" at each level of hier,
I can see two alternatives:
Alt 1:
top y = 1
sub1 y = 0
sub2 y = 1
Alt 2:
top y = 1
sub1 y = 1
sub2 y = 1
Alt 1 would be a stricter definition of the net resolution - it happens at
a scope level. (three nets are resolved, one at each level of hierarchy).
Alt 2 would be a looser definition of port direction. Here, the net is one
net, so resolution happens once. But the resolved value travels backwards
through the output port to the sub-level 1.
Modelsim says Alt 2 is correct. Both with and without vopt. ( I'd thought
port collapsing in the optimization could change the behaviour..)
I'm curious as to anywhere in the standard I can point to say this is
unequivocally true. Will all sims / synthesis agree?
I'm actually ok with either solution, I think, as long as it's consistent.
(I've actually used WOR's a lot in my code, but never "resampled", and output
and depended on it's resolved type. I've got a situation where it may be
useful to do so)
Any comments from Verilog standards experts?
Thanks,
Mark