《电子设计自动化技术》EDA实训指导书.doc_第1页
《电子设计自动化技术》EDA实训指导书.doc_第2页
《电子设计自动化技术》EDA实训指导书.doc_第3页
《电子设计自动化技术》EDA实训指导书.doc_第4页
《电子设计自动化技术》EDA实训指导书.doc_第5页
已阅读5页,还剩23页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

28电子设计自动化技术实训 csh csh 前 言eda是电子设计自动化(electronic design automation)的缩写,在20世纪90年代初从计算机辅助 设计(cad)、计算机辅助制造(cam)、计算机辅助测试(cat)和计算机辅助工程(cae)的概念发展而来的。eda技术就是以计算机为工具,设计者在eda软件平台上,用硬件描述语言hdl完成设计文件,然后由计算机自动地完成逻辑编译、化简、分割、综合、优化、布局、布线和仿真,直至对于特定目标芯片的适配编译、逻辑映射和编程下载等工作。eda技术的出现,极大地提高了电路设计的效率和可靠性,减轻了设计者的劳动强度。vhdl是一门非常重要的、是目前标准化程度最高的硬件描述语言。它在1987年就被ieee采纳为ieee#1076标准。用其书写的源文件既是程序又是文档,既是工程技术员之间交换信息的文件,以可作为合同签约者之间的文件。 在电子设计自动化技术课程的理论学习中,我们已仔细地介绍了基本数字电路的vhdl描述,为进一步掌握vhdl的综合应用,通过专门实训周以加强实践操作能力。本次实训现提供以上几个数字系统综合课题供大家进行分析 练习 修改与矿。为了提高分析 实践效果,在此只提供简单的课题框图与注释作为提示。同时将vhdl源代码给出以便对照调试之用。 课题1 带数字显示的秒表一、 设计任务及要求1、 设计一块用数码管显示的秒表。2、 能够准确的计时并显示。3、 开机显示00.00.00。4、 用户可随时清零、暂停、计时。5、 最大计时59分钟,最小精确到0.01秒。二、 可选器件epm130208-2、共阴极七段数码管、发光二极管、按键开关、电阻、电容。三、 设计总体框图 数字显示器的秒表总体框图如图1所示。译码显示时分复用分频电路时钟输入计时模块 图1带数字显示的秒表总体框图四、 源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity watch isport (sel:out std_logic_vector(6downto1); 信号。seg:out std_logic_vector(7downto 0); 管的输出信号。beginstop:in std_logic;、停止计数。reset:in std_logic; 复位 cp2:in std_logic);end watch; architecture behave of watch is signal numl:std_logic_vector(3downto0); signal num2:std_logic_vector(3downto 0); signal num3:std_logic_vector (3 downto 0); signal num4:std_logic_vector (3 downto 0); signal num5:std_logic_vector(3 downto 0); signal num6:std_logic_vector(3 downto 0); signal num: std_logic_vector(3 downto 0); signal numlet:std_logic_vector(2 downto 0); signal count:std_logic_vector( 17 downto 1); signal selsig:std_logic_vector(6 downto 1); signal segsig:std_logic_vector(7 downto 0);signal cp1:std_logic;signal cp3:std_logic;beginprocess(cp2)分频。beginif(cp2event and cp2=1)thenif(count=”11000011010011111”)then count=”00000000000000000”;cp1=not cp1; else count=count+1;end if;end if; cp3=count(10);end process;process(cp1)计数控制。beginif reset=1 then num1(3downto 0)=”0000”; num2(3downto 0)=”0000”; num3(3downto 0)=”0000”; num4(3downto 0)=”0000”; num5(3downto 0)=”0000”; num6(3downto 0)=”0000”; else if cp1event and cp1=1 thenif biginstop=1 then num1=num1+1;if num1(3downto 0)=”1001” thennum1 (3downto 0)=”0000”;num2=num2+1;if num2(3downto 0)=”1001” thennum2(3 downto 0)=”0000”;num3=num3+1;if num3(3downto 0)=”1001” thennum3(3downto 0)=”0000”;unm4=num4+1;if num4(3downto 0)=”0101”thennum4(3downto0)=”0000”;num5=num5+1;if num5(3downto 0)=”1001” thennum5(3downto 0)=”0000” ;num6=num6+1;if num6(3downto 0)=”0101”thennum6(3downto0)=”0000”;end if ;end if; end if; end if; end if;end if;end if;end if;end if;end process;process(cp3)显示控制。begin if(cp3event and cp3=1)thenif(numlet(2downto0)=”000”)thennum=numl;selsig(6downto1)=”111110”;end if;if(numlet(2downto0)=”001”)thennum=num2;selsig(6downto1)=”111101”;end if;if(numlet(2downto0)=”010”thennum=num3;selsig(6downto1)=”111011”;end if;if(numlet(2downto 0)=”100”;thennum=num4;selsig(6downto1)=”110111”;end if;if(numlet(2downto0)=”100” thennum=num5;selsig(6downto1)=”101111”;end if;numlet(2downto 0)=numlet(2downto 0)+1;if(numlet(2downto0)=”101”thennumlet(2downto 0)=”000”;num=num6;selsig(6downto1)=”011111”;end if;end if;if(num(3downto0)=”0000”)thensegsig(7downto 0)=”01111111”;end if;end if;if(num(3downto0)=”0001”)thensegsig(7downto0)=”00001101”;end if;if(num(3downto0)=”0010”)thensegsig(7downto 0)=”10011111”;end if;if(num(3downto0)=”0100”)thensegsig(7downto0)=”10011111”;end if;if(num(3downto0)=”0100”)thensegsig(7downto0)=”11001101”;end if;if(num(3downto)=”0101”)then segsig(7downto0)=”11011011”;end if;if(num(3downto0)=”0110”)thensegsig(7downto0)=”11111011”;end if;if(num(3downto0)=”0111”;)thensegsig(7downto0)=”00001111”;end if;if(num(3downto0)=”1000”)thensegsig(7downto0)=”11111111”;end if;if(num(3downto0)=”1001”)thensegsig(7downto0)=”11011111”;end if;end process;sel=selsig;seg(7downto0)=segsig(7downto0);end behave;五、 程序说明1、 此程序包括分频、计数控制、显示控制部分。2、 开机显示00.00.00,用户可随时计时、暂停、清零,最大计时可到59分59.99秒。3、 计数时钟为100hz。4、 采用时分复用的方法控制4个数码管的显示,可节约资源。 课题2 88光点阵逐点扫描显示装置一、 设计任务要求1. 使用88矩阵显示屏设计一个扫描控制电路。2. 光点从屏左上角像素点开始逐点扫描,终止与右下角像素点,然后周而复始的运行下去。3. 扫描一桢所需时间为13s。二、 可选器件epm130208-2、8x8矩阵显示屏、电阻。三、 设计总体框图8x8发光点阵逐点扫描显示装置总体框图如图2所示。时钟输 入列控制电 路分频电 路行控制电 路8x8矩阵显示屏图2 8x8发光点阵逐点扫描显示装置总体框图四、 参考源程序 library ieee; use ieee.std_logic_1164.all;use ieee.std_logicsigned.all;entity zlx2 isport( clk:in std_logic;q:out std_logic_vector(21 downto0);路输出。t:out std_logic_vector(0to7); 列选通。y:out std_logic_vector(0to7); 行选通。 ebd zkx2larchitecture a of zlx2 is signal b:std_logic_vector(21downto 0):=”0000000000000000000000”; signal a:std_logic_vector(0to 2); signal e:std_logic_vector(0to2); signal c:std_logic_vector(0to7); signal d:std_logic_vector(0to7);beginprocess (clk) 分频电路。begin if(clkevent and clk =1)then b(21downto 0)=b(21downto)+1;end if;q=b; 输出扫描频率。end process;process 以下两个进程控制行、列选通线实现点扫描。begina(0)=b(16);a(1)=b(17);a(2)=b(18);if a=”000”then c=”10000000”;elsif a=”001”then c=”01000000”;elsif a=”010”then c=”00100000”;elsif a=”011”then c=”00010000”;elsif a=”100”then c=”00001000”;elseif a=”101”then c=”00000100”;elseif a=”110”then c=”00000010”;elseif a=”111”then c=00000001”;end if;y=c;end process;processbegine(0)=b(19);e(1)=b(20);e(2)=b(21);if e=”000”then d=”01111111”;elsif e=”001”then d=”10111111”;elsif e=”010”then d=”11011111”;elsif e=”011”then d=”11101111”;elsif e=”100”then d=”11110111”;elsif e=”101”then d=”11111011”;elsif e=”110”then d=”11111101”;elsif e=”111”then d=”11111110”;end if;t=d;end process;end a;五、 说明1. 程序主要由分频电路和扫描控制电路组成。2. 扫描控制电路可用3线-8线译码器的设计思路来实现。课题3 彩灯闪烁装置一、 设计任务及要求1. 使用8x8矩阵显示屏设计一个彩灯闪烁装置。2. 第一侦以1个光点为1个像素点从屏左上角开始逐点扫描,终止于右下角。3. 第二侦以2个光点为1个像素从左上角开始逐点扫描,终止于右下角。4. 第三侦重复第一侦,第四侦重复第二侦,周而复始的运行下去。二、 可选器件epm130208-2、8x8矩阵显示屏、电阻。控制 奇 偶 侦8x8矩阵显示屏三、 设计总体框图时钟输入分频电路列控制电路行控制电路彩灯闪烁装置总体框图如图3所示。图3 彩灯闪烁装置总体框图四、 源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_signed.all;-for+operation.entity scan2 isport(cp1:in std_logic;输入时钟20mhz。 ho:out std_logic_vector(7downto0);行控制信号。 vo:out std_logic_vector(7downto0);列控制信号。end scan2;architecture scanpixel of scan2 issignal count1:std_logic_vector(2downto0):=”000”;扫描哪一个点的计数器。signal cuont2:std_logic_vector(3downto0):=”0000”;扫描哪一个行的计数器。signal v:std_logic_vector(7downto0):=”10000000”;signal h:std_logic_vector(7downto0):=”10000000”;输出信号.signal cp2:std_logic;signal cp:std_logic;signal cnt:std_logic_vector(15downto0):=”0000000000000000”signal cnt2:std_logic_vector(5downto0):=”000000”;分频用的计数器。beginprocess(cp1)begin if (cp1eventand cp1=1)thencnt=cnt+1;end if;cp2=cnt(15);end process;process(cp2)beginif(cp2event and cp2=1)thencnt2=cnt2+1;end if;cp=cnt2+1;end if;cphhhhhhhhh=”00000000”;end case;if count2=”0111”then 如果扫描的是前8行,则逐行扫描。 count1vvvvvvvvv=”11111111”; end case;if count2=”111”then count2=count2+1;end if;扫描完一行行计数器加1。else 若扫描的是后8行,则2点到扫描。 if count1=”010”then count1=”111”;else count1vvvvv=”11111111”;end case;if count1(1downto0)=”11”then count2=count2+1;end if;扫描完一行,行计数器加1。end if;end if;ho=h;vo=v;end process;end scanpixel;五、 程序说明 此程序主要由分频电路,行,列控制电路组成。 课题4 抢答器一、 设计任务及要求 设计2人抢答器。要求如下:1. 两人抢答,先抢为有效,用发光二极管显示是否抢到优先答题权。2. 每人2为计分显示,答错了不加分,答对了可加10、20、30分。3. 每题结束后,裁判按复位,可重新抢答下一题。4. 累计加分可由裁判随时清零。二、 可选器件epm130208-2、共阴极七段数码管,按键开关、电阻、电容。三、 设计总体框图抢答器总体框图如图4所示。显示抢答指示灯加分电路抢答者1输入抢答者2输入显示加分结 果裁判复位重新抢答裁判加 分抢 答判 断裁判清 零 图4 抢答器总体框四、 源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_signed.all;entity qb isport(i1,i2:in bit;抢答器两输入端。 reset: in bit;抢答器复位端。g10,g10,g30:in bit;加分输入端10分、20分、30分。light1,light2:out bit:=0;抢答标志灯。tll:out std_logic_vector(6downto0):=”0111111”;“tl1、tl2”,显示第一个人得分。tl2:out std_logic_vector(6downto0):=”0111111”;t21:out std_logic_vector(6downto0):=”0111111”;“t21t22”显示第二个人得分。clk:in bit;时钟输入端。cong:in bit 清零控制端。); end qb;architecture stru of qb issignal cs1:integer range0to9;sitgnal cs2:integer range 0to9:signal a,b:bit:=0;signall1,l2:bit:=0;begin process(clk)beginif clkevent and clk =1 thenif(cong=1)thenif(reset=1)thenif(i1=0and a=0)then l1=1;a=1;抢答。elsif (i2=”0and a=0) then l2=1; a=1;end if; if(g10=0and l1=1and b=0)then cs1=cs1+1;b=1;elsif(g20=0and l1=1and b=0)then cs1=cs1+2;b=1;elsif(g30=0and l1=1and b=0)then cs1=cs1+2;b=1; end if 完成第一人的加分。 if(cs1=0)then tl1=”0111111”;显示。 elsif (cs1=1)then t11=”0000110”; elsif (cs1=2)then t11=”1011011”; elsif (cs1=3)then t11=”100111”;elsif (cs1=4)then t11=”1100110”;elsif (cs1=5)then t11=”1101101”;elsif(cs1=6)then t11=”1111101”;elsif (cs1=7)then t11=”0000111”;elsif (cs1=8)then t11=”1111111”;elsif (cs1=9)then t11=”1101111”;end if;if (cs20)then t21=”0111111”;elsif (cs2=1)then t21=”0000110”;elsif(cs2=2)then t21=”1011011”;elsif(cs2=3)then t21=”1001111”;elsif(cs2=4)then t21=”1100110”;elsif(cs2=5)then t21=”1101101”;elsif(cs2=6)then t21=”1111101”;elsif(cs2=7)then t21=”0000111”;elsif(cs2=8)then t21=”1111111”;elsif(cs2=9)then t21=”1101111”;end if;else l1=0;l2=0;a=0;b=0;end if;elde cs1=0;cs2=0;l1=0;l2=0;end if;end process;end stru;五、 程序说明1. 此程序由3部分组成,即抢答、加分、显示。2. 当一人抢到优先答题权,发光二极管亮,另一人再按按键无效。答题结束后,裁判按复位键,可再次抢答。3. 每人有两个数码管显示累加计分情况,分数分为3档,用按键来区别。课题5 密码锁一、 设计任务及要求设计一个两位的密码锁,要求如下:1. 开锁代码为2位十进制并行码。2. 当输入的密码与锁内的密码一致时,绿灯亮,开锁;当输入的密码与锁内的密码不一致时,红灯亮,不能开锁。3. 密码可由用户自行设置。二、 可选器件epm130208-2、共阴极七段数码管、发光二极管、按键开关、电阻、电容。三、 设计总体框图密码锁总体框图如图5所示ccn密 码检 测数 据输 入译 码显 示数 据寄 存密 码存储仪判 断开 锁指 示 灯指 示 灯 图5 密码锁总体框图四、 源程序 library ieee; use ieee.std_logic_signed.all;entity lock isport(a:in std_logic_vector(9downto0);十位输入端。 b:in std_logic_vector(9downto0);个位输入端。en,clk:in std_logic;en为密码确认开关。 en1:in std_logic;en1为密码检验开关。c,d:out std_logic_vector(6downto0):=”0111111”;输出七段数码管的控制。k,m:out std_logic);k为绿灯,m为红灯。end lock;architecture behave of lock issignal e:std_logic_vector(3downto0);signal f: std_logic_vector (3downto0);signal g:std_logic_vector(3downto0);signal h:std_logic_vector(3downto0);signal count1,count2,:std_logic:=0signal s:std_logic:=0;begin if (a(9downto0)=”0000000000”)then c(6downto0)=”0111111”;elsif (a(1)=1) thene=”0000”;c(6downto0)=”0111111”;elsif(a(1)=1)thene=”0001”;c(6downto0)=”0000110”;elsif(a(2)=1)thene=”0010”;c(6downto0)=”1011011”;elsif(a(3)=1)thene=”0011”;c(6downto0)=”1001111”;elsif (a(4)=1) thene=”0100”;c(6downto0)=”1100110”;elsif (a(5)=1) thene=”0101”;c(6downto0)=”1101101”;elsif(a(6)=1) thene=”0110”;c(6downto0)=”1111100”;elsif(a(7)=1) thene=”0111”;c(6downto0)=”0000111”;elsif(a(8)=1) thene=”1000”;c(6downto0)=”1111111”;elsif(a(9)=1) thene=”1001”;c(6downto0)=”1100111”;end if;end process;process(b,f)个位的数据转换。beginif(b(9downto0)=”00000000000” thend(6downto0)=”0111111”;elsif(b(0)=1) thenf=”0000”;d(6downto0)=”0111111”;elsif(b(1)=1)thenf=”0001”;d(6downto0)=0000100”;elsif(b(2)=1;thenf=”0010”;d(6downto0)=”1011011”;elsif(b(3)=1) thenf=”0011”;d(6downto0)=”1001111”;elsif(b(4)=1) thenf=”0100”;d(6downto0)=”1100110”;elsif(b(5)=1) thenf=”0101”;d(6downto0)=”1101101”;elsif(b(6)=1) thenf=”0110”; d(downto0)=”1111100”;elsif(b(7)=1)thenf=”0111”;d(6downto0)=”0000111”;elsif(b(8)=1) thenf=”1000”;d(6downto0)=”1111111”;elsif(b(9)=1) thenf=”1001”;d(6downto0)=”1100111”;end if;end process;process(clk)判断密码是否正确,可否开锁。beginif(s=1)and(en=1)and(count=0) theng(3downto0)=e(3downto0);h(3downto0)=f(3downto0);count1=not(count1);end if;if(en1=1)and(count2=0) thenif(e(3downto0)=g(3downto0)andf(3downto0)=h(3downto0) thenk=1;s=1;elsek=0;m=1;end if;if (en=0)and(en1=0) thencount1=0;count2=0;k=0;s=0;m=0;end if;if(en=0 and s=1) thencount1=0;end if;end process;end behave;五、 程序说明1. 此程序由解码、译码、数码管显示部分组成。2. 此程序是一个并行密码锁,用户开锁密码为00。当使用开锁密码后,指示灯亮(绿灯),表示锁被打开。用户可自行设置密码。用户可用2个dip开关(110)设置099的2位十进制数密码。 课题6 数字频率计一、 设计任务及要求设计一个4位十进制数字显示的数字式频率计。要求如下:1 4位十进制数字显示的数字显示的数字式频率计,其频率测量范围为109999khz,测量单位为khz。2 要求量程能够自动转换。(即测几十到几百千赫兹(khz)时,有小数点显示,前者显示小数点后两位,后者显示小数点后一位。)3 当输入的信号小于10khz时,输出显示全0;当输入的信号大于9999khz时,输出显示全h。二、 可选器件epm130208-2、共阴极七段数码管、按键开关、电阻、电容。三、 设计总体框图数字频率计总体框图如图6所示。复位译码显 示复位被测信号计数电路锁存器时分复用时钟输 入分频电 路图6 数字频率计总体框图四、 源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_signed.all;entity total isport (cp_20m:in std_logic; enable:in std_logic; input:in std_logic; reset:in std_logic; sel:out std_logic_vector( 3 downto 0); show:out std_logic_vector(6 downto 0); decimal:out std_logic_vector(2 downto 0);end total;architecture content of total issignal cp_1,cp_2,cp_3:std_logic;signal reset_1:std_logic;signal overflow_1,low_1:std_logic;signal play0_1,play1_1,play2_1,play3_1:integer range 0 to 9;signal overlatch_1,lowlatch_1:std_logic;signal p0latch_1,p1latch_1,p2latch_1:integer range 0 to 9;signal decimal_1:std_logic_vector(2 downto 0);component dividefre4 isport(cp_20m:in std_logic; cp1:out std_logic; cp2:out std_logic; cp3:out std_logic);end component;component debounce isport(key:in std_logic; cp:in std_logic; imp:out std_logic);end component;component fretest isport(enable,cp3,input,reset:in std_logic; overflow,low:out integer range 0 to 9; decimal:out std_logic_vector(2 downto 0) );end component;component frelatch isport( reset:in std_logic; cp3:in std_logic; overflow:in std_logic; low:in std_logic; play0,play1,play2,play3:in integer range 0 to 9; decimal:in std_logic_vector(2 downto 0); overlatch:out std_logic; lowlatch:out std_logic; p0latch,p1latch,p2latch,p3latch:out integer range 0 to 9; delatch:out std_logic_vector(2 downto 0) );end component;component display isport(cp1:in std_logic; low:in std_logic; overflow:in std_logic; p0,p1,p2,p3:in integer range 0 to 9; show:out std_logic_vector(6 downto 0); sel:out std_logic_vector(3 downto 0) );end component;beginu1:dividefre4 port map(cp_20m,cp_1,cp_2,cp_3);u2:debounce port map(reset,cp_2,reset_1);u3:fretest port map(enable,cp_3,input,reset_1,overflow_1,low_1,play0_1,play1_1,play2_1,play3_1,decimal_1);u4:frelatch port map(reset_1,cp_3,overflow_1,low_1,play0_1,play1_1,play2_1,play3_1,decimal_1,overlatch_1,lowlatch_1,p0latch_1,platch_1,p2latch_1p3latch_1decimal);u5:display port map(cp_1,lowlatch_1,overlatch_1,p0latch_1,p1latch_1,p2latch_1,p3latch_1,show,sel);end content;library ieee;use ieee.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论