对半加器的结构描述: ARCHITECTURE Struct ha of half adder s COMPONENT and gate port(al, a2: IN Bit; a3: OUT Bit); 元件说明语句。 END COMPONENT COMPONENT Xor gate PORT(Xl, X2: IN Bit; X3: OUT Bit); END COMPONENT BEGIN gl: and gate PORT MAP(a, b, c) 元件例化语句 g2: xor gate PORT MAP(a, b, s) END struct ha:
21 对半加器的结构描述: ARCHITECTURE struct_ha OF half_adder IS COMPONENT and_gate PORT(a1,a2:IN Bit;a3:OUT Bit); --元件说明语句。 END COMPONENT; COMPONENT xor_gate PORT(x1,x2:IN Bit;x3:OUT Bit); END COMPONENT; BEGIN g1:and_gate PORT MAP(a,b,c); --元件例化语句 g2:xor_gate PORT MAP(a,b,s); END struct_ha;
COMPONENT语句一般格式 COMPONENT元件名-实体名 GENERIC(类属关联表);]-参数说明 PoRT(端口关联表);-端口说明 END COMPONENT. 例如: COMPONENT and2 PORT(a, b: IN BIT; C: OUT BIT END COMPONENT
22 COMPONENT 语句一般格式 COMPONENT 元件名 -- 实体名 [GENERIC(类属关联表);] -- 参数说明 PORT(端口关联表); -- 端口说明 END COMPONENT; 例如: COMPONENT and2 PORT (a,b:IN BIT; c :OUT BIT); END COMPONENT;
COMPONENT INSTANT语句一般格式: 标号名:元件名 PORT MAP(信号,…; 例如:ut: iny PORT MAP( sel, nse); 1位置映射方法 PORT(a,b:|NBT;c: OUT BIT-and2端口定义 u2 and2 PORT MAP(nsel, d1, ab); 2名称映射方法 PORT(a,b:NBT;c: OUT BIT;-and2端口定义 u2 and2 PORT MAP(a=>nsel, b=>d1, c=>ab)
23 COMPONENT_INSTANT 语句一般格式: 标号名:元件名 PORT MAP (信号,…); 例如:u1:inv PORT MAP (sel,nsel); 1.位置映射方法 PORT (a,b:IN BIT; c :OUT BIT);--and2端口定义 u2:and2 PORT MAP (nsel,d1,ab); 2.名称映射方法 PORT (a,b:IN BIT; c :OUT BIT);--and2端口定义 u2:and2 PORT MAP (a=>nsel,b=>d1,c=>ab);
例:分析下列VDL语言描述的逻辑功能。 ENTITY mux2 Is PORT(do, d1, sel: IN BIT; q: OUT BIT) END mux2 ARCHITECTURE Struct oF mux2 S COMPONENT and2 PORT(a, b: N BIT, C: OUT BIT); END COMPONENT COMPONENT or2 PORT(a, b: IN BIT; C: OUT BIT); END COMPONENT. 24
24 ENTITY mux2 IS PORT(d0,d1,sel:IN BIT; q:OUT BIT); END mux2; ARCHITECTURE struct OF mux2 IS COMPONENT and2 PORT (a,b:IN BIT; c :OUT BIT); END COMPONENT; COMPONENT or2 PORT (a,b:IN BIT; c :OUT BIT); END COMPONENT; 例: 分析下列VHDL语言描述的逻辑功能
CoMPONENT iny PORT (a: IN BIT; C: OUT BIT); END COMPONENT SIGNAL aa, ab, nsel: BIT; BEGIN u1: inV PORT MAP(sel, nsel) u2: and2 PORT MAP (nsel, d1, ab); u3: and2 PORT MAP(do, sel, aa); u4: or2 PORT MAP (aa, ab, q); END Struct:
25 BEGIN u1:inv PORT MAP (sel,nsel); SIGNAL aa,ab,nsel:BIT; COMPONENT inv PORT (a:IN BIT; c :OUT BIT); END COMPONENT; u2:and2 PORT MAP (nsel,d1,ab); u3:and2 PORT MAP (d0,sel,aa); u4:or2 PORT MAP (aa,ab,q); END struct;