当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

电子科技大学:《电子设计自动化技术》课程教学资源(讲义课件)第十三章 元件类语句:结构描述

资源类别:文库,文档格式:PDF,文档页数:12,文件大小:101.21KB,团购合买
具体描述电路各元件的端口及其连接; 以基本元件为基础逐级构建; 元件:已经定义的电路模块(实体),可以来自标准库中,也 可以是自己或他人以前编译过的实体; 元件的基本要点: 元件名 输入/输出端口特点;
点击下载完整版文档(PDF)

元件类语句:结构描述 具体描述电路各元件的端口及其连接 以基本元件为基础逐级构建; 元件:已经定义的电路模块(实体),可以来自标准库中,也 可以是自己或他人以前编译过的实体 元件的基本要点:元件名输入输出端口特点 设计的要点:建立端口之间的连接 元件语句的一般描述方式 结构体形式: Architecture str of实体名is 元件说明;(电路设计中使用的元件及端口) 类型说明; 信号说明;(电路设计中各中间连接点) 元件使用语句;(端口与信号(中间连接点及输入 /输出端点)的连接关系) end str 元件说明: component元件名 port(信号名:模式信号类型;

元件类语句: 结构描述 具体描述电路各元件的端口及其连接; 以基本元件为基础逐级构建; 元件:已经定义的电路模块(实体),可以来自标准库中,也 可以是自己或他人以前编译过的实体; 元件的基本要点: 元件名 输入/输出端口特点; 设计的要点:建立端口之间的连接; 元件语句的一般描述方式 结构体形式: Architecture str of 实体名 is 元件说明; (电路设计中使用的元件及端口) 类型说明; 信号说明; (电路设计中各中间连接点) begin 元件使用语句; (端口与信号(中间连接点及输入 /输出端点)的连接关系) end str; 元件说明: component 元件名 port(信号名:模式 信号类型;

信号名:模式信号类型); end component, 要点 元件说明与电路实体说明的编写方式非常相似 模块名称和对应端口名称应完全一致:其端口排列顺序也应 该完全一致 所用的电路实体应在work库或已说明的库中; 例:已有元件的程序为 use ieee std logic 1164. all entity kand port(a, b: in std logic y: out std logic) end kand architecture d of kand y<=a and b; end d: 元件说明语句为 component kand port(a, b: in std logic y: out std logic) end component

……. 信号名:模式 信号类型); end component; 要点: 元件说明与电路实体说明的编写方式非常相似; 模块名称和对应端口名称应完全一致;其端口排列顺序也应 该完全一致; 所用的电路实体应在 work 库或已说明的库中; 例:已有元件的程序为 library ieee; use ieee.std_logic_1164.all; entity kand2 is port(a, b: in std_logic; y: out std_logic); end kand2; architecture d of kand2 is begin y <= a and b; end d; 元件说明语句为: component kand2 port(a, b: in std_logic; y: out std_logic); end component;

元件使用语句: 元件编号:元件名 port map(信号对应表); 元件使用语句要点 对每一元件应该指定唯一的编号; 元件名称应该与已经有的元件名称完全一致 信号对应表:将本元件的各端口与外部的信号接点或端口建 立连接;每个连接应该具有一个唯一的名称 顺序关联法:按本元件各端口顺序排列连接点; 名称关联法:将本元件各端口名称逐一与对应的连接点 名称联系起来; 例希望将上述kand输入与data,en连接,输出与out连接 原来的元件:port(a,b: in std logic; y: out std logic 使用的设置:顺序法port( data, en,out); 名称法port(a= data,y=>outb=>en) 结构设计的示例 例1 inhibit I门z=x·y(带有元件说明语句的使用 library ieee use ieee std logic 1164. all; entity butnot is port(x,y: in std logic;

元件使用语句: 元件编号:元件名 port map(信号对应表); 元件使用语句要点: 对每一元件应该指定唯一的编号; 元件名称应该与已经有的元件名称完全一致; 信号对应表:将本元件的各端口与外部的信号接点或端口建 立连接;每个连接应该具有一个唯一的名称; 顺序关联法:按本元件各端口顺序排列连接点; 名称关联法:将本元件各端口名称逐一与对应的连接点 名称联系起来; 例 希望将上述 kand 输入与 data,en 连接,输出与 out 连接 原来的元件:port(a, b: in std_logic; y: out std_logic); 使用的设置: 顺序法 port(data,en,out); 名称法 port(a=>data,y=>out,b=>en); 结构设计的示例: 例 1 inhibit 门 ⋅= yxz (带有元件说明语句的使用) library ieee; use ieee.std_logic_1164.all; entity butnot is port (x,y: in std_logic;

z: out std logic) architecture str of butnot is component kin port(a: in std logic, y: out std logic) component kanda port(a, b: in std logic; y: out std logic); end component ul: kin port map(y, temp); u2:kanda port map(x, temp, z); end str 注意:为了保障使用元件的端口名正确性,需专门设计反相 器kinv和2输入与门kand2的模块存放于work库中; 其他例题质数检测器 p284质数检测器的结构设计p.284表4-43 generate语句相同元件的重复使用 在同一结构体中使用多个相同元件时,为避免反复说明, 可以采用 generate语句 元件语句 编号:for指标in范围 generate 元件编号:元件名 port map(信号1,信号2,…); end generate 在以上语句中,指标为整数,不需要定义,各元件对应 的信号此时成为数组,其下标由指标范围决定 例2p.2858位总线反相器 generate语句的应用

z: out std_logic); end butnot; architecture str of butnot is signal temp: std_logic; component kinv port (a: in std_logic; y: out std_logic); end component; component kand2 port (a,b: in std_logic; y: out std_logic); end component; begin u1: kinv port map(y,temp); u2: kand2 port map(x,temp,z); end str; 注意:为了保障使用元件的端口名正确性,需专门设计反相 器 kinv 和 2 输入与门 kand2 的模块,存放于 work 库中; 其他例题 质数检测器 p.284 质数检测器的结构设计 p.284 表 4-43 generate 语句 相同元件的重复使用 在同一结构体中使用多个相同元件时,为避免反复说明, 可以采用 generate 语句: 元件语句: 编号:for 指标 in 范围 generate 元件编号:元件名 port map(信号 1,信号 2,…); end generate 在以上语句中,指标为整数,不需要定义,各元件对应 的信号此时成为数组,其下标由指标范围决定; 例 2 p.285 8 位总线反相器 generate 语句的应用

use ieee std logic 1164. all; entity inv is port(a, b, c, d: in std logic vector (I downto 0) y: out std logic vector(7 downto 0)); end inv 8 architecture str of iny 8 is signal x std logic vector(7 downto 0); x<=a&b&c& d gl: for b in 7 downto 0 generate ul: kin port map(x(b),y(b)) 也可以采用 if-generate语句的形式控制电路的结构变化: 编号:if关系式 generate 元件语句 end generate: generic语句用于端口的控制 当希望一类元件的端口(或其他参量)可以自由变化时 可以采用 generIc语句(类属语句) 在原有元件中的定义:p285表446

library ieee; use ieee.std_logic_1164.all; entity inv8 is port (a,b,c,d: in std_logic_vector (1 downto 0); y:out std_logic_vector (7 downto 0) ); end inv8; architecture str of inv8 is component kinv port (a: in std_logic; y: out std_logic); end component; signal x:std_logic_vector(7 downto 0); begin x <= a & b & c & d; g1: for b in 7 downto 0 generate u1: kinv port map (x(b),y(b)); end generate; end str; 也可以采用 if-generate 语句的形式控制电路的结构变化: 编号:if 关系式 generate 元件语句; end generate; generic 语句 用于端口的控制 当希望一类元件的端口(或其他参量)可以自由变化时, 可以采用 generic 语句(类属语句); 在原有元件中的定义:p.285 表 4-46 entity …

generic(参量名:参量类型;…); 经过定义后,在程序中,该参量名可作为常量使用 在元件语句中赋值 元件编号:元件名 generic map(参量名→>常量值) port map(信号…); 赋值后,参量名由具体常量值所替代 例p285表447,p.286表448 任意宽度总线反相器 generic语句的应用 带有 generIc语句的实体 generic(width: positive =4 ); y: out std logic vector( width-I downto 0)); end busing architecture s of busing component kin port(a: in std logic, y: out std logic) end component gl: for b in width-l downto 0 generate ((b), y(b)); end generate 16位总线反相器的结构设计 library ieee

generic (参量名:参量类型;….); port ….. 经过定义后,在程序中,该参量名可作为常量使用; 在元件语句中赋值: 元件编号:元件名 generic map(参量名=>常量值) port map(信号…); 赋值后,参量名由具体常量值所替代。 例 p.285 表 4-47,p.286 表 4-48 任意宽度总线反相器 generic 语句的应用 带有 generic 语句的实体 library ieee; use ieee.std_logic_1164.all; entity businv is generic (width:positive:=4); port (x: in std_logic_vector (width-1 downto 0); y:out std_logic_vector (width-1 downto 0) ); end businv; architecture s of businv is component kinv port (a: in std_logic; y: out std_logic); end component; begin g1: for b in width-1 downto 0 generate u1: kinv port map (x(b),y(b)); end generate; end s; 16 位总线反相器的结构设计 library ieee;

use ieeestd logic 1164. all entity inv 16 is port (x: in std logic vector(15 downto 0); nd invi y:out std_logic_vector(15 downto 0)); architecture s of inv 16 is component bu generic(width: positive: =4) ort (x: in std logic vector(width-l downto 0); y:out std logic vector (width-1 downto 0)); end component ul: busin generic map(16) port map(x, y); 元件语句的简化使用一宏调用 只要进行相应的资源说明,可以不在结构体中进行元件说明; 例16位总线反相器的结构设计(work库的使用) library iee use ieee std logic 1164 all use work. all entity inv 16 is port(x: in std logic vector(15 downto 0) y: out std logic vector(15 downto 0)); end inv16. architecture s of inv 16 is ul: busin generic map(16) port map(x,y);

use ieee.std_logic_1164.all; entity inv16 is port (x: in std_logic_vector (15 downto 0); y:out std_logic_vector (15 downto 0) ); end inv16; architecture s of inv16 is component businv is generic (width:positive:=4); port (x: in std_logic_vector (width-1 downto 0); y:out std_logic_vector (width-1 downto 0) ); end component; begin u1: businv generic map(16) port map (x,y); end s; 元件语句的简化使用—宏调用 只要进行相应的资源说明,可以不在结构体中进行元件说明; 例 16 位总线反相器的结构设计 (work 库的使用) library ieee; use ieee.std_logic_1164.all; use work.all; entity inv16 is port (x: in std_logic_vector (15 downto 0); y:out std_logic_vector (15 downto 0) ); end inv16; architecture s of inv16 is begin u1: businv generic map(16) port map (x,y);

nd s 例:8选1数据选择器设计( altera数据库的使用) library ieee use ieee std logic 1164. all library altera use altera. maxplus2. all IS port(a, b, c, gn in std logic; d: in std logic vector(7 downto 0) y, wn: out std logic); end mux 8 alt. architecture str of mux 8 alt mux:a 151b port map(c, b, a, d, gn,y, wn); end str 例24位寄存器的LPM设计(LPM库的使用) library ieee use ieee. std logic 1164. all; library Ipm e lpm Ipm components. all: entity reg24lpm is g: out std logie vector(23 downto 0)); architecture str of reg24lpI

end s; 例:8 选 1 数据选择器设计(altera 数据库的使用) library ieee; use ieee.std_logic_1164.all; library altera; use altera.maxplus2.all; entity mux8_alt is port(a,b,c,gn:in std_logic; d:in std_logic_vector(7 downto 0); y,wn:out std_logic); end mux8_alt; architecture str of mux8_alt is begin mux:a_74151b port map(c,b,a,d,gn,y,wn); end str; 例 24 位寄存器的 LPM 设计(LPM 库的使用) library ieee; use ieee.std_logic_1164.all; library lpm; use lpm.lpm_components.all; entity reg24lpm is port(clk: in std_logic; d:in std_logic_vector(23 downto 0); q: out std_logic_vector(23 downto 0)); end reg24lpm; architecture str of reg24lpm is

reg24: Ipm ff generic map(pm width=>24) port map(data=>d(23 downto 0), clock>clk, >q(23 downto 0)); end str 简化的元件模式:过程 procedure的定义格式 Procedure过程名( 参量:模式类型 参量:模式类型)is 各种说明定义 顺序语句 end子过程名 procedure的调用格式 过程名(信号列表);(并行语句) procedure结构要 1过程依靠参量与主程序交换信息,参量说明紧跟在过程名 后面的括号中; 参量模式为 输入作为常量 out输出作为变量或信号 out输入输出作为变量或信号

begin reg24: lpm_ff generic map (lpm_width =>24) port map (data=>d(23 downto 0),clock=>clk,q=>q(23 downto 0)); end str; 简化的元件模式:过程 procedure 的定义格式 Procedure 过程名( 参量:模式 类型 …… 参量:模式 类型)is 各种说明定义; begin 顺序语句; end 子过程名; procedure 的调用格式 过程名(信号列表); (并行语句) procedure 结构要点: 1 过程依靠参量与主程序交换信息,参量说明紧跟在过程名 后面的括号中; 2 参量模式为 in 输入 作为常量 out 输出 作为变量或信号 inout 输入输出 作为变量或信号

若要作为信号,则应在参量名前加注 signal 3在主程序中,函数调用通常在表达式中,过程调用通常在 语句中:调用结束时,输出量将赋值给调用时指定的信号或 变量 4过程内部可以定义局部使用的类型、常量、变量、函数、 过程,不能定义信号 5过程可以进行并行调用,也可以进行顺序调用:并行过 程的参量应该为信号量:顺序过程的参量为变量,可以利用 顺序赋值语句将输出结果传递给信号」 例 inhibit I门z=x·y(过程的定义和顺序调用 library ieee use ieee std logic 1164. all; entity butnotl port(x,y: in std logic z: out std logic); end butnotl architecture str of butnot l is procedure kinvl(a: in std logic, f: out std logic)is f = not a end kiny l procedure kand21(a, b: in std logic; f: out std logic)is

若要作为信号,则应在参量名前加注 signal 3 在主程序中,函数调用通常在表达式中,过程调用通常在 语句中;调用结束时,输出量将赋值给调用时指定的信号或 变量; 4 过程内部可以定义局部使用的类型、常量、变量、函数、 过程,不能定义信号; 5 过程可以进行并行调用,也可以进行顺序调用;并行过 程的参量应该为信号量;顺序过程的参量为变量,可以利用 顺序赋值语句将输出结果传递给信号量; 例 inhibit 门 ⋅= yxz (过程的定义和顺序调用) library ieee; use ieee.std_logic_1164.all; entity butnot1 is port (x,y: in std_logic; z: out std_logic); end butnot1; architecture str of butnot1 is procedure kinv1(a: in std_logic; f: out std_logic) is begin f := not a; end kinv1; procedure kand21(a,b: in std_logic; f: out std_logic) is begin

点击下载完整版文档(PDF)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共12页,试读已结束,阅读完整版请下载
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有