Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > how to implement variable ports with variable width?

Reply
Thread Tools

how to implement variable ports with variable width?

 
 
weijun
Guest
Posts: n/a
 
      12-12-2005
I need to implement a module that has variable number of ports and the
width of the port is also variable (but same for all ports). Can
someone suggest a way to do that?
Thanks a lot!

 
Reply With Quote
 
 
 
 
Jim Lewis
Guest
Posts: n/a
 
      12-13-2005
weijun,
Use a set of subprograms with unconstrained arrays.

Regards,
Jim

> I need to implement a module that has variable number of ports and the
> width of the port is also variable (but same for all ports). Can
> someone suggest a way to do that?
> Thanks a lot!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training (E-Mail Removed)
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
 
Reply With Quote
 
 
 
 
Robert Reutemann
Guest
Posts: n/a
 
      12-13-2005
weijun wrote:
> I need to implement a module that has variable number of ports and the
> width of the port is also variable (but same for all ports). Can
> someone suggest a way to do that?
> Thanks a lot!
>


If you really need a port, there are (at least) two possibilities:

- use a configuration package where you define an array of arrays
of the proper size. The sizes are best declared as constants
in that package, so they can be accessed by code across entities
(by including the package).

- use a one-dimensional port, e.g. std_logic_vector(M*N-1 downto 0)
for the port. Within the modules you can of course again use
two-dimensional arrays and just assign accordingly. In this case,
M and N can be generics.

I would strongly suggest the second solution, since complex data
structures on ports lead to problems in synthesis/netlists.

The first solution may be OK if the module is only ever used
internally and you never need to work with a (often verilog)
netlist of that module.

Robert
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      12-13-2005
weijun wrote:
> I need to implement a module that has variable number of ports and the
> width of the port is also variable (but same for all ports). Can
> someone suggest a way to do that?


Complex data structures are best left to process variables.
Ports should hide internal registers whenever possible.

-- Mike Treseler
 
Reply With Quote
 
Amal
Guest
Posts: n/a
 
      12-19-2005
Nowadays, most synthesis tools support records. You can define your
ports as record types in a package, one for inputs and one for outputs.
Until the next VHDL-200x defines direction for each record element as
in SystemVerilog interfaces, you can use this method.

-- Amal

Mike Treseler wrote:
> weijun wrote:
> > I need to implement a module that has variable number of ports and the
> > width of the port is also variable (but same for all ports). Can
> > someone suggest a way to do that?

>
> Complex data structures are best left to process variables.
> Ports should hide internal registers whenever possible.
>
> -- Mike Treseler


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Type of actual ports is not compatible with type of ports of entity. mreister VHDL 1 05-25-2010 11:30 AM
implement default variable in C ?? is it possible Tinku C Programming 5 02-27-2009 11:14 PM
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
Recommendations Please for a PCI card w/ two USB 2 Ports and FireWaire Ports Mike Digital Photography 27 02-26-2006 12:54 AM
Procedure Calls with variable number of Input Ports Analog_Guy VHDL 1 10-05-2005 06:34 PM



Advertisments