EDA信号与变量.ppt
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《EDA信号与变量.ppt》由会员分享,可在线阅读,更多相关《EDA信号与变量.ppt(22页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、物理与电子工程学院物理与电子工程学院信号与变量区别&联系1物理与电子工程学院物理与电子工程学院非静态与静态数据对象n非静态数据处理signal,variablen静态数据处理constant,genericn常量和信号是全局的,用于顺序代码及并行代码n变量是局部的,只用于顺序代码(process,function,procedure)且值不能直接直接向外传递。2物理与电子工程学院物理与电子工程学院常量n常量可以在包集、实体或结构中声明。包集调用包集的所有实体使用实体对该实体的所有结构体可用结构仅在结构体中使用3物理与电子工程学院物理与电子工程学院信号n代表逻辑电路的“硬”连线,用作输入/出端口
2、、内部连接n所有端口默认为信号n定义的地方同常量n当信号用在顺序描述语句(如当信号用在顺序描述语句(如process)内部,)内部,其值不立刻更新,信号值是在相应的进程、函其值不立刻更新,信号值是在相应的进程、函数或过程完成后才进行更新数或过程完成后才进行更新n对同一个信号进行多重赋值:编译器可能给出警告并退出综合过程或仅认为最后一次赋值是有效的。(Maxplus II给出警告)4物理与电子工程学院物理与电子工程学院计数向量中1的个数n信号不立即更新n变量立即更新5library IEEE;use IEEE.STD_LOGIC_1164.ALL;entity count_ones isport
3、(din:in std_logic_vector(7 downto 0);ones:out integer range 0 to 8);end count_ones;architecture not_ok of count_ones issignal temp:integer range 0 to 8;beginprocess(din)begintemp=0;for i in 0 to 7 loopif(din(i)=1)thentemp=temp+1;end if;end loop;ones=temp;end process;end architecture not_ok;6library
4、IEEE;use IEEE.STD_LOGIC_1164.ALL;entity count_ones isport(din:in std_logic_vector(7 downto 0);ones:out integer range 0 to 8);end count_ones;architecture ok of count_ones isbeginprocess(din)variable temp:integer range 0 to 8;begintemp:=0;for i in 0 to 7 loopif(din(i)=1)thentemp:=temp+1;end if;end loo
5、p;ones=temp;end process;end architecture ok;7物理与电子工程学院物理与电子工程学院分频器设计library IEEE;use IEEE.STD_LOGIC_1164.ALL;entity freq_divider isport(clk,clr:in std_logic;out1,out2:buffer std_logic );end freq_divider;architecture Behavioral of freq_divider issignal count1:integer range 0 to 7;begin 8process(clk,c
6、lr)variable count2:integer range 0 to 7;beginif(clr=1)thencount1=0;count2:=0;out1=0;out2=0;elseif(clkevent and clk=1)thencount1=count1+1;count2:=count2+1;if(count1=?)thenout1=not out1;count1=0;end if;if(count2=?)thenout2=not out2;count2:=0;end if;end if;end if;end process;end Behavioral;9物理与电子工程学院物理
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- EDA 信号 变量
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内