文档详情

第6章VHDL设计进阶报告.ppt

发布:2017-01-14约7.92千字共53页下载文档
文本预览下载声明
第6章VHDL设计进阶 山东师范大学传播学院 秦绍华 数据对象 常数 变量 信号 常数 为了使程序易于阅读和修改 全局性 Constant 常数名:数据类型:=表达式; 定义位置: 实体、结构体、程序包、块、进程和子程序 可视性原则 变量 暂存数据 局部量 Variable 变量名:数据类型:=表达式; 定义位置: 进程和子程序 综合器不支持初值 不可以列入敏感信号表 赋值无延时 信号 连接线作用,并行模块间的信息传递 全局性 Signal 信号名:数据类型:=初值 定义位置: 实体、结构体、程序包 综合器不支持初值 可以列入敏感信号表 赋值有延时 多个驱动源 并行赋值语句中不允许同一个信号有多个驱动源 进程中允许同一个信号有多个驱动源,但只有最后一个被启动 Signal a,b,c,y,z: integer; …… Process(a,b,c) Begin Y=a+b; Z=c-a; Y=b; End process 进程中的信号和变量 信号 变量 基本用法 电路中的连线 进程中的数据存储 适用范围 结构体内 进程 行为特征 延时 立即 例6-1,6-2 Library ieee; Use ieee.std_logic_1164.all; Entity dff3 is Port(clk,d1: in std_logic; q1:out std_logic); End entity dff3; Architecture bhv of dff3 is Signal qq: std_logic; Begin Process(clk) Variable qq: std_logic; Begin If clk’event and clk=‘1’ then qq=d1; End if; q1=qq; End process; End bhv; 例6-3,6-4 Signal a ,b :std_logic; Begin Process(clk) Begin If clk’event and clk=‘1’ then a=d1; b=a; q1=b; End if; End process; Begin Process(clk) Variable a, b :std_logic; Begin If clk’event and clk=‘1’ then a:=d1; b:=a; q1=b; End if; End process; 例6-3,6-4 例6-5 Signal in1,in2:std_logic; Signal e1 :std_logic_vector(3 downto 0); Process(in1,in2) Variable c1:std_logic_vector(3 downto 0); Begin If in1=‘1’ then e1=“1010”; ….. If in2=‘1’ then c1:=“0011”; …….. End if; End process; 例6-6 Library ieee; Use ieee.std_logic_1164.all; Entity mux4 is Port(i0,i1,i2,i3,a,b: in std_logic q: out std_logic); End mux4; Architecture body of mux4 is Signal muxval:integer range 7 downto 0; Begin Rpocess(i0,i1,i2,i3,a,b) begin Muxval=0; If (a=‘1’) then mucval=muxval+1; end if; If (b=‘1’) then mucval=muxval+2; end if; Case muxval is When 0 =q=i0; When 1 =q=i1; When 2 =q=i2; When 3 =q=i3; When others =null; End …….. 例6-7 Library ieee; Use ieee.std_logic_1164.all; Entity mux4 is Port(i0,i1,i2,i3,a,b: in std_logic
显示全部
相似文档