how to define a type with inputs and outputs like a bus

A

Aiken

I would want to define a bus interface such that I can use it everywhere I need.

I get into a trouble is I need to separate the input and output into two types.

Is there a way to let it only need to declare it one time when I need the bus?


type bus_in_type is record
clk : std_ulogic ;
enb : std_ulogic ;
datain : std_ulogic ;
end record bus_in_type ;

type bus_out_type is record
dataout : std_ulogic ;
douten : std_ulogic ;
end record bus_out_type ;
 
T

Tricky

I would want to define a bus interface such that I can use it everywhere I need.



I get into a trouble is I need to separate the input and output into two types.



Is there a way to let it only need to declare it one time when I need the bus?





type bus_in_type is record

clk : std_ulogic ;

enb : std_ulogic ;

datain : std_ulogic ;

end record bus_in_type ;



type bus_out_type is record

dataout : std_ulogic ;

douten : std_ulogic ;

end record bus_out_type ;

stick it in a package?
 
R

Ralf Hildebrandt

Am 23.7.2012 20:25, schrieb Aiken:
I would want to define a bus interface such that I can use it everywhere I need.
type bus_in_type is record
clk : std_ulogic ;
enb : std_ulogic ;
datain : std_ulogic ;
end record bus_in_type ;

type bus_out_type is record
dataout : std_ulogic ;
douten : std_ulogic ;
end record bus_out_type ;

Put the type declarations into a package and include the package
everywhere you need it.

Take care! Write to the record only in /one/ component. Do not try to
write to one record element in one component and to another record
element in a different component. The declared record type is an
unresolved data type (unless you write a resolution function).
=> Such records are not really a bus. They are more a "tube" or a big
"cable" where a lot of "wires" are included.

Such recored "cables" work fine with synthesis (tested with Xilinx ISE,
synopsys design analyzer).
The biggest advantage of such "cables" is the fact, that they easy can
be fed through several levels of hierarchy while changing one of the
"wires", adding new "wires" and so on is really easy.

Ralf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top