Forum: FPGA, VHDL & Verilog question to generics and ports

von Andreas F. (parafux)

Rate this post
0 useful
not useful
how can is specify with generics how many ports i want and the width of 
each vector port?

von Vipin L. (lal87)

Rate this post
0 useful
not useful

von Fred (Guest)

Rate this post
0 useful
not useful
For defining the number of ports and not only the width of each port, I 
would recommend using an array, which is defined within a package

within the Package:
type tIoArray is array (gNumber -1 downto 0) of std_logic_vector (gWidth - 1 downto 0);

within the entity:
entity myEnt is
  myInput : in tIoArray;


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.