records in port declarations

I have a design with quite a lot of Xilinx FPGAs on the same bus and I
would like to use records to make the port declarations smaller and
easier to read. The bus consists of some bidirectional and some
unidirectional signals. Now I'm wondering what the synthesis tools (XST
or Synplify) will do if I declare the whole record as inout. Will they
infer tristate buffers all over the designs, even though I'm only
writing or reading to the unidirectional signals?
Is it wise at all to group the different signal types in one record?
Thanks for any comments on this.

Advertisements

"Christian Schleiffer" <> wrote in message
news:...
> Hi,
>
> I have a design with quite a lot of Xilinx FPGAs on the same bus and I
> would like to use records to make the port declarations smaller and
> easier to read. The bus consists of some bidirectional and some
> unidirectional signals. Now I'm wondering what the synthesis tools (XST
> or Synplify) will do if I declare the whole record as inout. Will they
> infer tristate buffers all over the designs, even though I'm only
> writing or reading to the unidirectional signals?

Last time I tried this, that's exactly what happened. Avoid inout like the
plague unless you really do mean a tri-state buffer.
> Is it wise at all to group the different signal types in one record?

Yes - it certainly makes for less typing, and it allows you to easily modify
the set of signal that make up a particular interface without having to
change a million files.

Your best bet is to gang up all the input signals, all the output signals,
and all the bidirectional signals into their own record groups. It's not
ideal, but it's better than nothing - and it does work in XST and Synplify.
For smaller buses with few signals, this is usually overkill though.

Advertisements

"Christian Schleiffer" <> wrote in message
news:...
> Hi,
>
> I have a design with quite a lot of Xilinx FPGAs on the same bus and I
> would like to use records to make the port declarations smaller and
> easier to read. The bus consists of some bidirectional and some
> unidirectional signals. Now I'm wondering what the synthesis tools (XST
> or Synplify) will do if I declare the whole record as inout.

They will be quite happy to oblige (at least Synplify will, I haven't tried
of late with XST).
> Will they
> infer tristate buffers all over the designs, even though I'm only
> writing or reading to the unidirectional signals?

And then they'll selectlively 'optomize' out the tri-state controls when
they see that the inputs are never being driven and that the outputs (not
inouts) are always being driven leaving tri-state controls only on the
inouts. All the record type is doing from a synthesis perspective is giving
a different name to signals. Since the name itself is irrelevant to the
synthesis operation, the tools generally don't care.
> Is it wise at all to group the different signal types in one record?

As Ben pointed out it would be wiser to see if you can group the inputs into
one record, the outputs into another, the inouts into a third. Some reasons
for doing this would be

- Code clarity, declaring an input as an inout leads to headaches for those
picking up the code later on. If I picked up some code and saw use of
inouts everywhere it would probably give me the impression of a bit of
laziness on the part of the original designer unless it was just immediately
obvious why such a grouping was a good thing (and in certain cases, I think
it can be 'good'). In 'most' cases, one guys output is the other guys input
so grouping by mode into a record doesn't cause any readability issues with
the other FPGA designs in the overall board design. If that's not the case
though then using inouts throughout may be appropriate.

- Extra code that would not be needed were it not for grouping everything as
inouts (i.e. All elements of the record that are really only inputs would
also need to have the line of code that sets them to 'Z'). The cleanest way
to handle this would be to define a constant of the record type that is
being used where you set all elements to 'Z' regardless of the intended mode
(i.e. in, out, inout) and then have a line of code that sets the entire
signal to this constant. That way in one fell swoop all inputs will have a
'Z' driving them. The outs and inouts will have the 'Z' driving as well but
then will also have whatever real equations as well so they will be
overridden. Also, if you have to add or subtract elements to the record or
change the intended mode (less likely one would think) you won't have to
worry about forgetting one of these default assignment as long as it
compiles since adding/removing a record element without also updating the
magic constant that has all 'Z' will result in an immediate easy to fix
error when you compile it.

Ben Jones wrote:
> Last time I tried this, that's exactly what happened. Avoid inout like the
> plague unless you really do mean a tri-state buffer.

I was hoping that the optimization process will eliminate the buffers again.
>> Is it wise at all to group the different signal types in one record?
>
> Yes - it certainly makes for less typing, and it allows you to easily modify
> the set of signal that make up a particular interface without having to
> change a million files.

That's what I was thinking of, since the hardware is custom made. The
bus signals might change later, you'll never know...
> Your best bet is to gang up all the input signals, all the output signals,
> and all the bidirectional signals into their own record groups.

Yes, I already thought about that. But still, having only one record for
the bus would look much nicer in the source ;-)

KJ wrote:
>> Will they
>> infer tristate buffers all over the designs, even though I'm only
>> writing or reading to the unidirectional signals?
>
> And then they'll selectlively 'optomize' out the tri-state controls when
> they see that the inputs are never being driven and that the outputs (not
> inouts) are always being driven leaving tri-state controls only on the
> inouts.

Ok, that's what I hoped.
>> Is it wise at all to group the different signal types in one record?
>
> As Ben pointed out it would be wiser to see if you can group the inputs into
> one record, the outputs into another, the inouts into a third.

On Wed, 09 Aug 2006 13:13:53 +0200, Christian Schleiffer
<> wrote:
> having only one record for
>the bus would look much nicer in the source ;-)

Have you looked at the interface construct in SystemVerilog?
It aims to deal with exactly this issue. Personally I think the
jury's still out on whether it's entirely successful, but it's
a very interesting approach. Sadly, synthesis support is
still somewhat limited, although Synopsys DC does a good
job with interfaces and I think Mentor Precision supports
them now. Don't know about Synplify, sorry.
--
Jonathan Bromley, Consultant

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!