Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

using VHDL record type as port

Hi

In order to improve readability I want to use record types for buses so when I have a bus traversing across hierarchies, instead of declaring and mapping all of the signals, I will do it once for the bus.

Let's say I have an SPI master wrapped inside my top level entity (or even further down the hierarchy).

So I define an SPI bus

--- Quote Start ---

type SPI_bus is record

clk : STD_LOGIC;

cs: STD_LOGIC;

master_data: STD_LOGIC;

slave_data: STD_LOGIC;

end record;

--- Quote End ---

I want to avoid declaring separately clk cs master_data as outputs and slave_data as input, for my top level entity. is there a way to do it, other the defining a type for outputs and a type for inputs? maybe adding something to my type declaration?

Thanks in advance.

14 Replies