Download presentation
Presentation is loading. Please wait.
Published byBernice Miller Modified over 9 years ago
1
DSD,USIT,GGSIPU1 Entity declaration –describes the input/output ports of a module entity reg4 is port ( d0, d1, d2, d3, en, clk : in std_logic; q0, q1, q2, q3 : out std_logic ); end entity reg4; entity name port mode (direction) port type reserved words punctuation Port Name
2
DSD,USIT,GGSIPU2 Modeling Behavior Architecture body –describes an implementation of an entity –may be several per entity Behavioral architecture –describes the algorithm performed by the module –contains process statements, Function Statement1 Port interface
3
DSD,USIT,GGSIPU3 Modeling Structure Structural architecture –implements the module as a composition of subsystems –contains signal declarations, for internal interconnections –the entity ports are also treated as signals component declarations –instances of previously declared entity/architecture pairs port maps in component instances –connect signals to component ports
4
DSD,USIT,GGSIPU4 Component Declaration Component Component-name [is] [port (list-of-interface-port);] End component [component-name]; Component-name: may or may not refer to the name of an entity already existing in a library.
5
DSD,USIT,GGSIPU5 Component cont.. List-of-interface-port specifies the name,mode, and type for each port of the component in a manner similar to that specified in an entity declaration. The names of the ports may also be different from the names of the ports in the entity to which it may be bound.
6
DSD,USIT,GGSIPU6 Component declaration Component declaration appear in the declaration part of an architecture body. They may also appear in a package declaration
7
DSD,USIT,GGSIPU7 Signal declaration Are required to connect different types of ports.(mode of ports) Class of the object identifier Signal object should be same data type as it is in component and entity. Signal object can be also be declared as an array
8
DSD,USIT,GGSIPU8 Component Instantiation A Component instantiation statement defines a subcomponent of the entity in which it appears. It associates the signals in the entity with the ports of that subcomponent.
9
DSD,USIT,GGSIPU9 Format of a component Instantiation statement Component-label : component-name [port map (association-list)]; * Component-label: It can be any legal identifier and can be considered as the name of the instance.
10
DSD,USIT,GGSIPU10 Component instantiation The component-name must be the name of a component declared earlier using a component declaration. The association-list associates signals in the entity, called actuals, with the ports of a component, called formals.
11
DSD,USIT,GGSIPU11 Association technique There are two ways to perform the association of formals with actuals: 1. Positional association 2. Named association
12
DSD,USIT,GGSIPU12 Positional association An association-list is of the form: Actual 1,actual 2,actual 3………………………… actual n The first port in the component declaration corresponds to the first actual in the component declaration corresponds to the first actual in the component instantiation, the second with second, and so on.
13
DSD,USIT,GGSIPU13 Named association An association-list is of the form: Formal 1 =>actual 1,formal 2 =>actual 2 ……..formal n =>actual n In named association, the ordering of the association is not important since the mapping between the actuals and formals is explicitly specified. The scope of the formals is restricted to be within the port map part of the instantiation for that component.
14
DSD,USIT,GGSIPU14 Rules of the port map 1.The types of the formal and actual being associated must be the same. 2.The modes of the ports must conform to the rule that if the formal s readable, so must the actual be; and if the formal is considered to be both readable and writeable, such a signal may be associated with a formal of any mode.
15
DSD,USIT,GGSIPU15 1.If an actual is a port of mode in, it may not be associated with a formal of mode out or inout; 2.if the actuals is a port of mode out, it may not be associated with a formal of mode in or inout; 3.if the actual is a port of mode inout, it may be associated with a formal of mode in,out, or inout.
16
DSD,USIT,GGSIPU16 Circuit of Half adder
17
DSD,USIT,GGSIPU17 Circuit of Full adder
18
DSD,USIT,GGSIPU18 Design a 4-bit adder using FA
19
DSD,USIT,GGSIPU19 Example (Full adder using macro of Half adder) library ieee; use ieee.std_logic_1164.all; entity ha is port ( x, y : in std_logic; s, c: out std_logic ); end ha; architecture ha_behave of ha is begin s <= x xor y; c <= x and y; end ha_behave;
20
DSD,USIT,GGSIPU20 library ieee; use ieee.std_logic_1164.all; entity fa is port ( xin, yin, zin : in std_logic; cout, sum: out std_logic ); end fa; architecture fa_struct of fa is component ha is port ( x, y : in std_logic; s, c: out std_logic ); end component ha; signal temp0,temp1,temp2 : std_logic; begin ha1 : ha port map (x=>xin,y=>yin,s=>temp0,c=>temp1); ha2 : ha port map (x=>temp0,y=>zin,s=>sum,c=>temp2); cout <= temp1 or temp2; end fa_struct;
21
DSD,USIT,GGSIPU21 library ieee; use ieee.std_logic_1164.all; entity fa_4bit is port ( a,b : in std_logic_vector (3 downto 0); sum: out std_logic_vector (3 downto 0); carry : out std_logic ); end fa_4bit; architecture fa_4bit_behave of fa_4bit is component fa is port ( xin, yin, zin : in std_logic; cout, sum: out std_logic ); end component fa; signal c : std_logic_vector (3 downto 0); begin c(0) <= '1';
22
DSD,USIT,GGSIPU22 u1 : fa port map (xin=>a(0),yin=>b(0),zin=>c(0),sum=>sum(0),cout=>c(1)); u2 : fa port map (xin=>a(1),yin=>b(1),zin=>c(1),sum=>sum(1),cout=>c(2)); u3 : fa port map (xin=>a(2),yin=>b(2),zin=>c(2),sum=>sum(2),cout=>c(3)); u4 : fa port map (xin=>a(3),yin=>b(3),zin=>c(3),sum=>sum(3),cout=>carry); end fa_4bit_behave;
23
DSD,USIT,GGSIPU23
24
DSD,USIT,GGSIPU24 Adder-Subtractor using Mode control
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.