vhdl
play

VHDL VHDL - Flaxer Eli Ch 8 - 1 VHDL - Flaxer Eli Ch 8 - 2 - PDF document

Chapter 8 Outline Structural Modeling Basic Example Component Declaration Component Instantiation Resolving Signal Value Generate Statement VHDL VHDL - Flaxer Eli Ch 8 - 1 VHDL - Flaxer Eli Ch 8 - 2 Structural Modeling


  1. Chapter 8 Outline Structural Modeling � Basic Example � Component Declaration � Component Instantiation � Resolving Signal Value � Generate Statement VHDL VHDL - Flaxer Eli Ch 8 - 1 VHDL - Flaxer Eli Ch 8 - 2 Structural Modeling Structural Modeling Structural Modeling Basic Example � This chapter describes the structural style of modeling. An entity is MR modeled as a set of components connected by signals, that is, as a netlist. � The behavior of the entity is not explicitly apparent from its model. The S 1 RDY Data D Q component instantiation statement is the primary mechanism used for S 2 describing such a model of an entity. CK CLK QB CTRL � COMPONENT & PORT MAP statements are used to implement structural modeling. Din � The component instantiation statements are concurrent statements, and their order of appearance in the architecture body is therefore not � Three components and2, nor2, and dff are used. important. � The components are instantiated in the architecture body via three � A component can, in general, be instantiated any number of times. component instantiation statements - PORT MAP, and the instantiated � Each instantiation must have a unique component label. components are connected to each other via signals S1 and S2. VHDL - Flaxer Eli Ch 8 - 3 VHDL - Flaxer Eli Ch 8 - 4 Structural Modeling Structural Modeling Basic Example (VHDL Code) Component Declaration ENTITY Gating IS � A component in a structural description must first be declared using PORT (data, ck, mr, din: IN bit; rdy, ctrl: OUT bit); END Gating; a component declaration. ARCHITECTURE Structure_View OF Gating IS � A component declaration declares the name and the interface of a COMPONENT and2 component (similar to the entity). PORT (x, y: IN bit; z: OUT bit); END COMPONENT; � The interface specifies the mode and the type of ports. COMPONENT nor2 � The syntax of a simple form of component declaration is: PORT (x, y: IN bit; z: OUT bit); END COMPONENT; COMPONENT dff COMPONENT Component-Name [IS] PORT (d, clk: IN bit; q, qb: OUT bit); END COMPONENT; [PORT( List-of-Interface-Ports );] END COMPONENT [ Component-Name ]; SIGNAL s1, s2: bit; MR BEGIN S 1 d1: dff PORT MAP (data, ck, s1, s2); RDY Data D Q a1: and2 PORT MAP (s2, din, ctrl); S 2 CK CLK QB CTRL n1: nor2 PORT MAP (s1, mr, rdy); END Structure_View ; Din VHDL - Flaxer Eli Ch 8 - 5 VHDL - Flaxer Eli Ch 8 - 6 Structural Modeling Structural Modeling

  2. Component Declaration (notes) Component & Package � Component declarations appear in the declarations part of an architecture � The component-name may or may not refer to the name of an entity body. already existing in a library. If it does not, it must be explicitly bound to � Alternately, they may also appear in a package declaration. Items declared in an entity. this package can then be made visible within any architecture body by using � The binding information can be specified using a configuration. the library and use clauses. � The List-Of-Interface-Ports specifies the name, mode, and type for each � For example, consider the entity GATING described in the basic example . A port of the component in a manner similar to that specified in an entity package such as shown may be created to hold the component declarations. declaration. � The names of the ports may also be different from the names of the ports PACKAGE MyCOMP IS in the entity to which it may be bound (different port names can be COMPONENT and2 PORT (x, y: IN bit; z: OUT bit); mapped in a configuration). For while, we will assume that an entity of END COMPONENT; the same name as that of the component already exists and that the name, COMPONENT nor2 PORT (x, y: IN bit; z: OUT bit); mode, and type of each port matches the corresponding ones in the END COMPONENT; component. COMPONENT dff PORT (d, clk: IN bit; q, qb: OUT bit); � Configurations are discussed in the next chapter. END COMPONENT; END MyCOMP; VHDL - Flaxer Eli Ch 8 - 7 VHDL - Flaxer Eli Ch 8 - 8 Structural Modeling Structural Modeling Component & Package Library Component Instantiation � If the package MyPackage has been compiled into library MyLib , the � A component instantiation statement defines a sub-component of the entity in architecture body can be as: which it appears. It associates the signals in the entity with the ports of that sub-component. LIBRARY MyLib; � A format of a component instantiation statement : USE MyLib.MyPackage.All; Component-Label : Component-Name PORT MAP ( association-list ); ARCHITECTURE Structure_View OF Gating IS SIGNAL s1, s2: bit; � The Component-Label can be any legal identifier and can be considered as BEGIN d1: dff PORT MAP (data, ck, s1, s2); the name of the instance. a1: and2 PORT MAP (s2, din, ctrl); � The Component-Name must be the name of a component declared earlier n1: nor2 PORT MAP (s1, mr, rdy); using a component declaration. END Structure_View ; � The association-list, associates signals in the entity, called actuals , with the ports of a component, called formals . � More on Library and Package in the next chapters. VHDL - Flaxer Eli Ch 8 - 9 VHDL - Flaxer Eli Ch 8 - 10 Structural Modeling Structural Modeling Actuals and Formals Actuals and Formals � An actual may be a signal. An actual for an input port may also be an � If a port in a component instantiation is not connected to any signal, the expression. keyword OPEN can be used to signify that the port is not connected. � An actual may also be the keyword open to indicate a port that is not � For example: connected . COMPONENT dff � There are two ways to perform the association of formals with actuals: PORT (d, clk: IN bit:=‘0’; q, qb: OUT bit); 1. Positional association END COMPONENT; ----------------------------------------- 2. Named association d1: dff PORT MAP (OPEN, ck, s1, OPEN); � In positional association, each actual in the component instantiation is mapped by position with each port in the component declaration. That is, � The second input port of the dff component is not connected to any signal. the first port in the component declaration corresponds to the first actual in An input port may be left open only if its declaration specifies an initial the component instantiation, the second with the second, and so on. value. For the previous component instantiation statement to be legal, port d of the component declaration for dff must have an initial value expression, COMPONENT dff while the output port qb not. PORT (d, clk: IN bit; q, qb: OUT bit); � A port of any other mode may be left unconnected as long as it is not an END COMPONENT; ----------------------------------------- unconstrained array. d1: dff PORT MAP (data, ck, s1, s2); VHDL - Flaxer Eli Ch 8 - 11 VHDL - Flaxer Eli Ch 8 - 12 Structural Modeling Structural Modeling

  3. Actuals and Formals Actuals / Formals Type and Mode � In named association, an association-list is of the form: � The types of the formal and actual being associated must be the same. � The modes of the ports must conform to the rule that if the formal is – formal 1 => actual 1 , formal 2 => actual 2 , … formal n => actual n readable, so must the actual be; and if the formal is writable, so must the � For example: actual be. � Locally declared signal is considered to be both readable and writable, such COMPONENT dff a signal may be associated with a formal of any mode. PORT (d, clk: IN bit; q, qb: OUT bit); END COMPONENT; � If an actual is a port of mode in , it may not be associated with a formal of ----------------------------------------- d1: dff PORT MAP (clk => ck, d => data, qb => s2, q => s1); mode out or inout ; if the actual is a port of mode out , it may not be associated with a formal of mode in or inout ; if the actual is a port of mode inout , it may be associated with a formal of mode in , out , or inout . � In named association, the ordering of the associations is not important since � It is important to note that an actual of mode out or inout indicates the the mapping between the actuals and formals is explicitly specified. presence of a source for that signal, and therefore, it must be resolved if that � An important point to note is that the scope of the formals is restricted to be signal is multiply driven. within the port map part of the instantiation for that component. � A buffer port can never have more than one source; therefore, the only kind of actual that can be associated with a buffer port is another buffer port or a signal that has at most one source. VHDL - Flaxer Eli Ch 8 - 13 VHDL - Flaxer Eli Ch 8 - 14 Structural Modeling Structural Modeling Component Model Component Example (Package) � Structural models can be simulated and synthesize only after the entities that the components represent are modeled and placed in a design library. � The lowest-level entities must be behavioral models (or dataflow). � Consider the components instantiation A1, N1, and D1 in the basic example . Assume that those instance is bound to an entity with the same name and identical port names. � The library must include the model of those components. � More on Library and Package in the next chapters. VHDL - Flaxer Eli Ch 8 - 15 VHDL - Flaxer Eli Ch 8 - 16 Structural Modeling Structural Modeling Component Example (Entity & Arc) Component Example (Main) VHDL - Flaxer Eli Ch 8 - 17 VHDL - Flaxer Eli Ch 8 - 18 Structural Modeling Structural Modeling

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend