LaDissertation.com - Dissertations, fiches de lectures, exemples du BAC
Recherche

Parameterizing Structure

Commentaire d'oeuvre : Parameterizing Structure. Recherche parmi 298 000+ dissertations

Par   •  21 Janvier 2015  •  Commentaire d'oeuvre  •  362 Mots (2 Pages)  •  467 Vues

Page 1 sur 2

The generic map specifies that this instance of the and2 module uses the value

2 ns for the generic constant Tpd; that is, the instance has a propagation delay of 2 ns.

We might include another component instantiation statement using and2 in the same

design but with a different actual value for Tpd in its generic map, for example:

gate2 : entity work.and2(simple)

generic map ( Tpd => 3 ns )

port map ( a => a1, b => b1, y => sig1 );

When the design is elaborated we have two processes, one corresponding to the instance gate1 of and2, which uses the value 2 ns for Tpd, and another corresponding

to the instance gate2 of and2, which uses the value 3 ns.

8.2 Parameterizing Structure

The second main use of generic constants in entities is to parameterize their structure.

We can use the value of a generic constant to specify the size of an array port by using

the generic constant in constraints in the port declarations. To illustrate, here is an

entity declaration for a register:

entity reg is

generic ( width : positive );

Parameterizing Structure 81

port ( d : in bit_vector(0 to width – 1);

q : out bit_vector(0 to width – 1);

… );

end entity reg;

In this declaration we require that the user of the register specify the desired port

width for each instance. The entity then uses the width value as a constraint on both

the input and output ports. A component instantiation using this entity might appear

as follows:

signal in_data, out_data : bit_vector(0 to bus_size – 1);

ok_reg : entity work.reg

generic map ( width => bus_size )

port map ( d => in_data, q => out_data, … );

EXAMPLE

A complete model for the register, including the entity declaration and an architecture body, is shown in Figure 8-1. The generic constant is used to constrain

the widths of the data input and output ports in the entity declaration. It is also

used in the architecture body to determine the size of the constant bit vector zero.

This bit vector is the value assigned to the register output when it is reset, so it

must be of the same size as the register port.

We can create instances of the register entity in a design, each possibly having

different-sized

...

Télécharger au format  txt (2.2 Kb)   pdf (51.3 Kb)   docx (8.6 Kb)  
Voir 1 page de plus »
Uniquement disponible sur LaDissertation.com