电子设计自动化(EDA)实验(精选)
- 格式:ppt
- 大小:3.58 MB
- 文档页数:42


library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ctrl isport(clr,clk,sp:in std_logic;en:out std_logic);end ctrl;architecture behave of ctrl istype states is (s0,s1,s2,s3);signal current_state,next_state:states;begincom:process(sp,current_state)begincase current_state iswhen s0=>en<='0';if sp='1' then next_state<=s1;else next_state<=s0;end if;when s1=>en<='1';if sp='1' then next_state<=s1;else next_state<=s2;end if;when s2=>en<='1';if sp='1' then next_state<=s3;else next_state<=s2;end if;when s3=>en<='0';if sp='1' then next_state<=s3;else next_state<=s0;end if;end case;end process;synch:process(clk)beginif clr='1' thencurrent_state<=s0;elsif clk'event and clk='1' thencurrent_state<=next_state;end if;end process;end behave;library ieee;use ieee.std_logic_1164.all;entity cb10 isport(clk: in std_logic;co: buffer std_logic);end cb10;architecture art of cb10 issignal counter:integer range 0 to 49999;beginprocess(clk)beginif (clk='1' and clk'event) thenif counter=49999 thencounter<=0;co<= not co;elsecounter<=counter+1;end if;end if;end process;end art;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cdu10 isport(clk,clr,en: in std_logic;cn: out std_logic;count10: out std_logic_vector(3 downto 0)); end cdu10;architecture art of cdu10 issignal temp:std_logic_vector(3 downto 0); beginprocess(clk,clr)beginif clr='1' thentemp<="0000";cn<='0';elsif (clk'event and clk='1') thenif en='1' thenif temp>="1001" thentemp<="0000";cn<='1';elsetemp<=temp+1;cn<='0';end if;end if;end if;count10<=temp;end process;end art;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cdu6 isport(clk,clr,en: in std_logic;cn: out std_logic;count6: out std_logic_vector(3 downto 0)); end cdu6;architecture art of cdu6 issignal temp:std_logic_vector(3 downto 0);beginprocess(clk,clr)beginif clr='1' thentemp<="0000";cn<='0';elsif (clk'event and clk='1') thenif en='1' thenif temp="0110" thentemp<="0000";cn<='1';elsetemp<=temp+1;cn<='0';end if;end if;end if;count6<=temp;end process;end art;library ieee;use ieee.std_logic_1164.all;entity count isport(clk:in std_logic;clr:in std_logic;en:in std_logic;S_10ms:out std_logic_vector(3 downto 0);S_100ms:out std_logic_vector(3 downto 0);S_1s:out std_logic_vector(3 downto 0);S_10s:out std_logic_vector(3 downto 0);M_1min:out std_logic_vector(3 downto 0);M_10min:out std_logic_vector(3 downto 0)); end count;architecture art of count iscomponent cdu10port(clk,clr,en: in std_logic;cn: out std_logic;count10: out std_logic_vector(3 downto 0)); end component cdu10;component cdu6port(clk,clr,en: in std_logic;cn: out std_logic;count6: out std_logic_vector(3 downto 0)); end component cdu6;signal A,B,C,D,E,F:std_logic;beginU1:cdu10 port map (clk,clr,en,A,S_10ms);U2:cdu10 port map (A,clr,en,B,S_100ms);U3:cdu10 port map (B,clr,en,C,S_1s);U4:cdu6 port map (C,clr,en,D,S_10s);U5:cdu10 port map (D,clr,en,E,M_1min);U6:cdu10 port map (E,clr,en,F,M_10min);end art;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned;entity bcd7 isport(bcd:in std_logic_vector(3 downto 0);led:out std_logic_vector(6 downto 0));end bcd7 ;architecture art of bcd7 isbeginled<= "0111111" when bcd="0000"else"0000110" when bcd="0001"else"1011011" when bcd="0010"else"1001111" when bcd="0011"else"1100110" when bcd="0100"else"1101101" when bcd="0101"else"1111101" when bcd="0110"else"0000111" when bcd="0111"else"1111111" when bcd="1000"else"1101111" when bcd="1001"else"0000000";end art;library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_UNSIGNED.all;entity mulx isport(clk:in std_logic;clr:in std_logic;en:in std_logic;S_10ms:in std_logic_vector(3 downto 0);S_100ms:in std_logic_vector(3 downto 0);S_1s:in std_logic_vector(3 downto 0);S_10s:in std_logic_vector(3 downto 0);M_1min:in std_logic_vector(3 downto 0);M_10min:in std_logic_vector(3 downto 0);outbcd:out std_logic_vector(3 downto 0);seg:out std_logic_vector(2 downto 0)); end mulx;architecture art of mulx issignal count:std_logic_vector(2 downto 0); beginprocess(clk)beginif (clr='1') thencount<="111";elsif (clk='1'and clk'event) thenif en='1' thenif count="101" thencount<="000";else count<=count+1;end if;end if;end if;end process;process(clk)beginif clk'event and clk='1'thencase count iswhen "000"=>outbcd<=S_10ms; seg<="000";when "001"=>outbcd<=S_100ms; seg<="001";when "010"=>outbcd<=S_1s; seg<="010";when "011"=>outbcd<=S_10s; seg<="011";when "100"=>outbcd<=M_1min; seg<="100";when "101"=>outbcd<=M_10min; seg<="101";when others=>null;end case;end if;end process;end art;library ieee;use ieee.std_logic_1164.all;entity stopwatch isport (sp:in std_logic ;clr:in std_logic;clk:in std_logic;led:out std_logic_vector(6 downto 0);seg:out std_logic_vector(2 downto 0));end stopwatch;architecture art of stopwatch iscomponent ctrlport(clr:in std_logic ;clk:in std_logic ;sp:in std_logic ;en:out std_logic );end component;component cb10port(clk:in std_logic;co:out std_logic);end component;component countport (clk:in std_logic;clr:in std_logic;en:in std_logic;S_10ms:out std_logic_vector(3 downto 0);S_100ms:out std_logic_vector(3 downto 0);S_1s:out std_logic_vector(3 downto 0);S_10s:out std_logic_vector(3 downto 0);M_1min:out std_logic_vector(3 downto 0);M_10min:out std_logic_vector(3 downto 0));end component;component bcd7port(bcd:in std_logic_vector(3 downto 0);led:out std_logic_vector(6 downto 0));end component;component mulxport (clr:in std_logic;clk:in std_logic;en:in std_logic;S_10ms:in std_logic_vector(3 downto 0);S_100ms:in std_logic_vector(3 downto 0);S_1s:in std_logic_vector(3 downto 0);S_10s:in std_logic_vector(3 downto 0);M_1min:in std_logic_vector(3 downto 0);M_10min:in std_logic_vector(3 downto 0);outbcd:out std_logic_vector(3 downto 0);seg:out std_logic_vector(2 downto 0));end component;signal c,e:std_logic;signal ms10_s,ms100_s:std_logic_vector(3 downto 0);signal s1_s,s10_s:std_logic_vector(3 downto 0);signal min1_s,min10_s:std_logic_vector(3 downto 0);signal bcd_s,s:std_logic_vector(3 downto 0);beginu0:ctrl port map(clr,clk,sp,e);u1:cb10 port map(clk,c);u2:count port map(c,clr,e,ms10_s,ms100_s,s1_s,s10_s,min1_s,min10_s);u3:mulx port map(clr,clk,e,ms10_s,ms100_s,s1_s,s10_s,min1_s,min10_s,bcd_s,seg); u4:bcd7 port map (bcd_s,led);end art;。
实验一五人表决器设计一、实验目的1 加深对电路理论概念的理解3 加深计算机辅助分析及设计的概念4 了解及初步掌握对电路进行计算机辅助分析的过程二、实验要求制作一个五人表决器,共五个输入信号,一个输出信号。
若输入信号高电平数目多于低电平数目,则输出为高,否则为低。
三、实验原理根据设计要求可知,输入信号共有2^5=32种可能,然而输出为高则有15种可能。
对于本设计,只需一个模块就能完成任务,并采用列写真值表是最简单易懂的方法。
四、计算机辅助设计设A,B,C,D,E引脚为输入引脚,F为输出引脚。
则原理图如1所示图1.1 五人表决器原理图实验程序清单如下:MODULE VOTEA,B,C,D,E PIN;F PIN ISTYPE 'COM';TRUTH_TABLE([A,B,C,D,E]->[F])[0,0,1,1,1]->[1];[0,1,1,1,0]->[1];[0,1,0,1,1]->[1];[0,1,1,0,1]->[1];[1,0,1,1,1]->[1];[1,1,0,1,1]->[1];[1,1,1,0,1]->[1];[1,1,1,1,0]->[1];[1,1,1,0,0]->[1];[1,1,0,1,0]->[1];[1,1,1,1,1]->[1];[1,1,0,0,1]->[1];[1,0,0,1,1]->[1];[1,0,1,0,1]->[1];[1,0,1,1,0]->[1];END五、实验测试与仿真根据题目要求,可设输入分别为:0,0,0,0,0;1,1,1,1,1;1,0,1,0,0;0,1,0,1,1。
其测试程序如下所示:MODULE fivevoteA,B,C,D,E,F PIN;X=.X.;TEST_VECTORS([A,B,C,D,E]->[F])[0,0,0,0,0]->[X];[1,1,1,1,1]->[X];[1,0,1,0,0]->[X];[0,1,0,1,1]->[X];END测试仿真结果如图1.2所示:图1.2 五人表决器设计仿真图可知,设计基本符合题目要求。
电子设计自动化(EDA)实验指引书前言近些年来,电子设计自动化(EDA)技术发展迅速。
一方面,各种大容量、高性能、低功耗可编程逻辑器件不断推出,使得专用集成电路(ASIC)生产商感受到空前竞争压力。
另一方面,浮现了许多EDA设计辅助工具,这些工具大大提高了新型集成电路设计效率,使更低成本、更短周期复杂数字系统开发成为也许。
于是一场ASIC 与FPGA/CPLD之争在所难免。
然而PLD器件具备先天竞争优势,那就是可以重复编程,在线调试。
EDA技术正是这场较劲推动引擎之一。
普通来说,EDA技术就是以计算机为平台,以EDA软件工具为开发环境,以HDL为设计语言,以可编程器件为载体,以ASIC、SOC芯片为目的器件,以电子系统设计为应用方向电子产品自动化设计过程。
设计者只需编写硬件描述语言代码,然后选取目的器件,在集成开发环境里进行编译,仿真,综合,最后在线下载调试。
整个过程,大某些工作由EDA软件完毕。
全球许多知名可编程器件提供商都推出了自己集成开发工具软件,如Altera公司MAX+PLUSⅡ、Quartus Ⅱ软件;Xilinx公司Foundation 、ISE软件,Lattice公司ispExpert 软件,Actel公司Libero软件等。
这些软件推出,极大地增进了集算法设计、芯片编程、电路板设计于一体EDA技术发展。
此外,在以SOC芯片为目的器件电子系统设计规定下,可编程器件内部开始集成高速解决器硬核、解决器软核、DSP模块、大量存储资源、高速串行收发模块、系统时钟管理器、多原则I/O接口模块,亦使得设计者更加得心应手,新一轮数字革命由此引起。
EDA技术是一门实践性很强学科,要培养出具备竞争力一流IC 设计人才,动手能力是核心。
只有通过理论学习,加上现场实验,在使用软件编程加硬件调试过程中真正获得锻炼,增长技能。
ZY11EDA13BE型实验系统采用主板加适配板加扩展板灵活构造,可以便进行基于不同PLD芯片实验开发,并易于升级,符合当前高校在此方面对人才培养规定。