海大 EDA实验1参考答案
- 格式:docx
- 大小:22.54 KB
- 文档页数:12
红外多路遥控系统单片机红外发射红外接收本文介绍了红外多路遥控系统。
红外多路遥控系统可实现16路的红外开关控制。
以码分制多通道红外遥控为设计的基本思路。
通过键盘及代码生成电路、编码、脉冲调制振荡和红外发射构成红外发射电路。
通过红外接收,解码以及由单片机控制的医码控制电路组成红外接收电路。
1.前言1.1序言随着电子技术的飞速发展,尤其是跨入2000年后,红外技术得到了迅猛发展。
红外遥控已渗透到国民经济的各行各业和人们日常生活的方方面面,在工业自动化、生产控制过程、采集和处理、通信、红外制导、激光武器、电子对抗、环境监测、红外育种安全防范、家用电器控制及日常生活各个方面都得到了广泛的应用。
1.2国内外研究概况目前国内外都在进行红外的研究开发,已取得了相当不错的成绩。
红外技术的研究开发是自动化控制的主要方向。
它的研究针对国民经济的各行各业和人们日常生活的方方面面,在工业自动化、生产控制过程、采集和处理、通信、红外制导、激光武器、电子对抗、环境监测、红外育种安全防范、家用电器控制及日常生活各个方面都在进行红外研究开发和控制。
1.3主要工作概述针对国内外的发展情况,可见红外遥控系统是我国未来智能化发展方向。
本课题要设计的红外多路遥控系统,主要红外发射和红外接收这两部分,本设计依托市面上常见的红外发射和红外接收元器件,使设计具有传输距离一般、硬件简单、安装方便、价格便宜的优点。
本文所介绍的红外多路遥控系统,是采用码分制多通道红外遥控系统装置。
早期的码分制的脉冲指令编码多采用分离元器件及小规模数字集成电路,编码、译码电路弄得很复杂,可靠性也差。
但随着大规模数字集成技术的发展和日趋成熟,各种大规模专用集成编、译码集成器件的层出不穷,使外围元器件很少,电路简单,功能完善。
2.系统总体方案设计2.1方案比较方案一:采用频分制多通道红外遥控发射和接收系统。
频分制的频率编码一般采用频道编码开关,通过改变振荡电路的参数来改变振荡电路的振荡参数和频率。
eda课程设计题目答案一、教学目标本课程的教学目标是使学生掌握eda的基本概念、原理和应用方法,培养学生分析问题和解决问题的能力,提高学生的创新意识和实践能力。
具体来说,知识目标包括:了解eda的基本概念、原理和流程;掌握常见的eda工具和软件的使用方法;了解eda在电子设计中的应用领域。
技能目标包括:能够运用eda工具进行基本的电路设计和仿真;能够根据设计需求选择合适的eda工具和软件;能够对设计结果进行分析和评估。
情感态度价值观目标包括:培养学生对eda技术的兴趣和热情;培养学生勇于探索、创新和合作的精神;培养学生关注社会、关注科技发展的意识。
二、教学内容本课程的教学内容主要包括eda的基本概念、原理和应用方法。
具体安排如下:第1章:eda概述,介绍eda的定义、发展历程和应用领域;第2章:eda工具和软件,介绍常见的eda工具和软件的使用方法;第3章:电路设计,介绍电路设计的基本原理和方法;第4章:仿真与验证,介绍仿真与验证的基本原理和方法;第5章:eda应用案例,介绍eda在实际项目中的应用案例。
三、教学方法为了实现本课程的教学目标,我们将采用多种教学方法,包括讲授法、讨论法、案例分析法和实验法等。
具体安排如下:第1章:采用讲授法,介绍eda的基本概念和原理;第2章:采用讨论法,引导学生探讨eda工具和软件的使用方法;第3章:采用案例分析法,分析实际电路设计案例;第4章:采用实验法,让学生动手进行电路设计和仿真;第5章:采用讲授法和讨论法,总结本课程的主要内容和知识点。
四、教学资源为了支持本课程的教学内容和教学方法的实施,我们将准备以下教学资源:教材:《eda技术与应用》;参考书:《电子设计自动化原理与应用》;多媒体资料:教学PPT、视频教程等;实验设备:计算机、eda工具软件、电路实验板等。
以上教学资源将有助于丰富学生的学习体验,提高学生的学习效果。
五、教学评估本课程的教学评估将采用多元化的评估方式,以全面、客观、公正地评价学生的学习成果。
EDA习题第一章1.1 EDA的英文全称是什么?EDA的中文含义是什么?答:EDA即Electronic Design Automation的缩写,直译为:电子设计自动化。
1.2 什么叫EDA技术?答:EDA技术有狭义和广义之分,狭义EDA技术就是以大规模可编程逻辑器件为设计载体,以硬件描述语言为系统逻辑描述的主要表达方式,以计算机、大规模可编程逻辑器件的开发软件及实验开发系统为设计工具,通过有关的开发软件,自动完成用软件的方式设计的电子系统到硬件系统的逻辑编译、逻辑化简、逻辑分割、逻辑综合及优化、逻辑布局布线、逻辑仿真,直至完成对于特定目标芯片的适配编译、逻辑映射、编程下载等工作,最终形成集成电子系统或专用集成芯片的一门新技术,或称为IES/ASIC自动设计技术。
1.3 利用EDA技术进行电子系统的设计有什么特点?答:①用软件的方式设计硬件;②用软件方式设计的系统到硬件系统的转换是由有关的开发软件自动完成的;③设计过程中可用有关软件进行各种仿真;④系统可现场编程,在线升级;⑤整个系统可集成在一个芯片上,体积小、功耗低、可靠性高。
1.4 从使用的角度来讲,EDA技术主要包括几个方面的内容?这几个方面在整个电子系统的设计中分别起什么作用?答:EDA技术的学习主要应掌握四个方面的内容:①大规模可编程逻辑器件;②硬件描述语言;③软件开发工具;④实验开发系统。
其中,硬件描述语言是重点。
对于大规模可编程逻辑器件,主要是了解其分类、基本结构、工作原理、各厂家产品的系列、性能指标以及如何选用,而对于各个产品的具体结构不必研究过细。
对于硬件描述语言,除了掌握基本语法规定外,更重要的是要理解VHDL的三个“精髓”:软件的强数据类型与硬件电路的惟一性、硬件行为的并行性决定了VHDL语言的并行性、软件仿真的顺序性与实际硬件行为的并行性;要掌握系统的分析与建模方法,能够将各种基本语法规定熟练地运用于自己的设计中。
对于软件开发工具,应熟练掌握从源程序的编辑、逻辑综合、逻辑适配以及各种仿真、硬件验证各步骤的使用。
学习使人进步1.1.1(1)什么叫EDA(P1)?EDA技术是一种以计算机为工作平台,结合计算机图形学、拓扑逻辑学、计算方法学及人工智能等多项计算机应用科学的最新成果而开发出来的一套软件工具。
1.1.2(2)EDA技术在硬件硬件方面融合了哪些技术(P1)?大规模集成电路制造技术、IC版图设计技术、ASIC (专用集成电路)测试和封装技术、FPGA和CPLD编程下载技术、自动测试技术等1.1.3(3)EDA技术在计算机辅助工程方面融合了哪些技术(P1)?计算机辅助设计(CAD)、计算机辅助制造(CAM)、计算机辅助测试(CAT)、计算机辅助工程(CAE)技术以及多种计算机语言的设计概念。
1.1.4(4)EDA技术在现代电子学方面融合了哪些内容(P1)?如:电子线路设计理论、数字信号处理技术、嵌入式系统和计算机设计技术、数字系统建模和优化技术及微波技术等1.1.5(5)EDA技术在21世纪的突出表现有哪5个方面(P2)?●使电子设计产品以自主知识产权方式得以明确表达和确认成为可能。
●在仿真验证和设计两方面都支持标准硬件描述语言的功能强大的EDA软件不断推出。
●电子技术全方位进入EDA领域。
●EDA使得电子领域各学科的界限更加模糊,更加互为包容。
●不断推出更大规模的FPGA和CPLD。
●基于EDA工具的用于ASIC设计的标准单元已涵盖大规模电子系统及复杂IP核模块。
●软硬件IP核在电子领域得以进一步确认。
●SoC高效率低成本设计技术日益成熟。
●系统级、行为验证级硬件描述语言使复杂电子系统的设计特别是验证趋于高效和简单。
1.2.1(6)画图说明EDA技术实现目标是什么(P3)?1.3.1(7)目前常用的HDL主要有哪些?其中使用最多的是谁(P4)?VHDL;Verilog HDL;SystemVerilog ;System C 1.3.2(8)与Verilog相比VHDL有哪两方面优势?有哪三方面不足(P5)?优势:1.语法比Verilog更严谨,通过EDA工具自动语法检查,以排除许多设计中的疏忽;2.有很好的行为级描述能力和一定的系统级描述能力,而Verilog建模时,行为与系统级抽象及相关描述能力不及VHDL。
EDA考试题目+标准答案EDA考试题目+答案————————————————————————————————作者:————————————————————————————————日期:简答:1.VHDL中变量与信号的主要区别一、变量是一个局部量,只能在进程和子程序,无延时,立即发生,主要作用是在进程中作为临时的数据存储单元。
二、信号是一个全局量,有延时,进程只对信号敏感,不对变量敏感比较对象信号SIGNAL 变量V ARIABLE基本用法用于作为电路中的信号连线用于作为进程中局部数据存储单元与Verilog对比信号赋值类似于非阻塞式赋值变量赋值类似于阻塞式赋值适用范围在整个结构体内的任何地方都适用只能在所定义的进程中使用行为特性在进程最后才对信号赋值,有延时立即赋值,无延时从VHDL语句功能和行为仿真来看,信号与变量的差异主要表现在接受信息的方式和信息保持与传递的区域大小上。
(1)如:信号可以设置传输延迟量,而变量则不能;(2)如:信号可作为模块间的信息载体,如在结构体中个进程间传递信息;变量只能作为局部的信息载体,如只能在所定义的进程中有效。
(3) 变量的设置有时只是一种过渡,最后的信息传输和界面间的通信都是靠信号来完成综合后的信号将对应更多的硬件结构。
2.ASIC、FPGA、EDA、ISP的含义ASIC:专用集成电路FPGA:可编程逻辑器件EDA:电子设计自动化ISP:因特网服务提供商3.常用的库的名称(IEEE STD WORK VITAL)5.进程语句的特点(1)进程与进程,或其它并行语句之间的并行性,体现硬件电路并行运行特征。
(2)进程内部的顺序语句具有顺序与并行双重性。
顺序行为体现硬件的逻辑功能,并行行为体现硬件特征。
进程内部使用顺序语句,对一个系统进行算法、行为和逻辑功能进行描述,可以具有高抽象性的特点,可以与具体的硬件没有关联。
这种顺序仅是指语句执行上的顺序(针对于HDL的行为仿真),并不意味着PROCESS语句在综合后所对应的硬件逻辑行为也同样具有顺序性。
第一章1.什么叫EDA技术?及狭义定义(书P1)Electronic Design Automation--电子设计自动化。
EDA的广义定义范围包括:半导体工艺设计自动化、可编程器件设计自动化、电子系统设计自动化、印刷电路板设计自动化、仿真与测试、故障诊断自动化、形式验证自动化统称EDA工程。
2.EDA发展历程:CAD- CAE -EDA3 .EDA技术的主要内容实现载体(硬件基础):大规模可编程逻辑器件(PLD_Programmable Logic Device)描述方式:硬件描述语言(HDL_Hard descripation Lauguage,VHDL,Verilog HDL等)设计工具:开发软件、开发系统硬件验证:实验开发系统FPGA 在结构上主要分为三个部分,即可编程逻辑单元,可编程输入/输出单元和可编程连线三个部分。
CPLD在结构上主要包括三个部分,即可编程逻辑宏单元,可编程输入/输出单元和可编程内部连线。
4.硬件描述语言(HDL_Hardware Description Language)VHDL:IEEE标准硬件描述语言,在电子工程领域,已成为事实上的通用硬件描述语言。
系统级抽象描述能力较强。
Verilog:支持的EDA工具较多,适用于RTL级和门电路级的描述,其综合过程较VHDL 稍简单,门级开关电路描述能级较强,但其在高级描述方面不如VHDL。
ABEL:一种支持各种不同输入方式的HDL,系统级抽象描述能力差,适应于门级电路描述。
5. 仿真工具功能仿真(也叫前仿真、系统级仿真、行为仿真)验证系统的功能。
时序仿真(也叫后仿真、电路级仿真):验证系统的时序特性、系统性能。
6. EDA的工程设计流程(P8)第二章1.在系统可编程技术(ISP)定义ISP(In_System Programmability/Programming)是指对器件、电路板、整个电子系统进行逻辑重构和修改功能的能力。
EDA技术试验问答题答案(基本包含)第一章1-1 EDA技术与ASIC设计和FPGA开发有什么关系?FPGA/CPLD 在ASIC设计中有什么用途?答:利用EDA技术进行电子系统设计的最后目标是完成专用集成电路ASIC的设计和实现;FPGA和CPLD是实现这一途径的主流器件。
FPGA和CPLD通常也被称为可编程专用IC,或可编程ASIC。
FPGA 和CPLD的应用是EDA技术有机融合软硬件电子设计技术、SoC(片上系统)和ASIC设计,以及对自动设计与自动实现最典型的诠释。
FPGA/CPLD在ASIC设计中,属于可编程ASIC的逻辑器件;使设计效率大为提高,上市的时间大为缩短。
1-2与软件描述语言相比,VHDL有什么特点? P6答:编译器将软件程序翻译成基于某种特定CPU的机器代码,这种代码仅限于这种CPU而不能移植,并且机器代码不代表硬件结构,更不能改变CPU的硬件结构,只能被动地为其特定的硬件电路结构所利用。
综合器将VHDL程序转化的目标是底层的电路结构网表文件,这种满足VHDL设计程序功能描述的电路结构,不依赖于任何特定硬件环境;具有相对独立性。
综合器在将VHDL(硬件描述语言)表达的电路功能转化成具体的电路结构网表过程中,具有明显的能动性和创造性,它不是机械的一一对应式的“翻译”,而是根据设计库、工艺库以及预先设置的各类约束条件,选择最优的方式完成电路结构的设计。
l-3什么是综合?有哪些类型?综合在电子设计自动化中的地位是什么? P5什么是综合? 答:在电子设计领域中综合的概念可以表示为:将用行为和功能层次表达的电子系统转换为低层次的便于具体实现的模块组合装配的过程。
有哪些类型?答:(1)从自然语言转换到VHDL语言算法表示,即自然语言综合。
(2)从算法表示转换到寄存器传输级(RegisterTransport Level,RTL),即从行为域到结构域的综合,即行为综合。
(3)从RTL级表示转换到逻辑门(包括触发器)的表示,即逻辑综合。
5-14library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity div is port(clk,RESET: in std_logic;outl,out2:out std_logic);end div;architecture div_16 of div issignal ent: std_logic_vector(3 downto 0);beginprocess(clk)beginif reset=T thencnt<=u OOOO n;elsif (clk'event and clk=T) then cnt<=cnt+T;end if;end process;outl<=T when cnt=15 else 'O';--不等out2<=cnt(3); -正负脉宽相等end div_16;5-11library ieee;use ieee.std_logic_l 164.all;entity s_machine is port(clk:in std_logic;din:in std_logic_vector( 1 downto 0); dout:out std_logic_vector( 1 downto 0));end s_machine;architecture a of s_machine istype state is (s0,sl,s2);signal current_state,next_state:state;beginprocess(din,curret_state) -次态译码器与输出译码器描述begincase current_state iswhen sO =>讦(din = "00") then next_state <= sO; doutv="00'';elsif (din = "01") then next_state <= s2; dout<=,,10,?;elsif (din = TO") then next_state <= s2; dout<=,,lF,;end if;when si =>if (din = “00") then next_state <= si; doutv="00''; elsif(din = "01") then next_state <= sO; doutv=''00"; elsif(din = TO") then next_state <= s2; dout<=,,10,?; end if;when s2 =>讦(din = "00") then next_state <= s2; doutv="00''; elsif(din = "01") then next_state <= si; doutv="00''; elsif(din = TO") then next_state <= sO; doutv=''00"; end if;end case;End process;process(clk) -状态寄存器描述beginif (clk?event and clk== '1') then current_state<=next_state;end if;End process;End a;5-10(1)entity h_sub isport (x, y: in BIT ;diff, sub_out: out bit);end h_sub; Architecture A of h_sub isbegindiff <= x xor y; sub_out <= not X and Y;end A;ENTITY F_SUB ISPORT(X, Y, SUB_IN: IN BIT;DIFF, SUB_OUT: OUT BIT);ENDF_SUB;ARCHITECTURE ART OF F_SUB ISCOMPONENT H_SUBPORT(X, Y: IN BIT;DIFF, SUB_OUT: OUT BIT);END COMPONENT;SIGNAL SI, S2, S3: BIT;BEGINUl: H_SUB PORT MAP (X=>X, Y=>Y, DIFF=>S1, SUB_OUT=>S2);U2 : H_SUB PORT MAP (X=>S1 , Y=>SUB_IN ,DIFF=>DIFF, SUB_OUT=>S3);SUB_OUT<=S2 OR S3;END ARCHITECTURE ART;⑵.entity f^sub isport ( x, y, sub_in: in bit;diff, sub_out: out bit);end f_sub;architecture func of 匚sub isbeginprocess(x, y, sub_in)variable con: bit_vector(l downto 0);variable com: bit_vector(2 downto 0);begincom:= x & y & sub_in;if (com = “000") then con := “00";elsif (com = "Oil") then con := "01";elsif (com 二"100") then con :二"10";elsif (com 二"101") then con := "00";elsif (com = T10") then con := “00";else con := T1";end if;diff <= con(l); sub_out <= con(0);end process;end func;⑶entity subtracter isport ( a, b : in bit_vector(7 dowto 0);sub_in : in bit;diff: out bit_vector(7 dowto 0); sub_out: out bit); end subtracter;architecture stru of subtracter iscomponent H_subport ( x, y, sub_in: in bit; diff, sub_out: out bit);end component; signal sub: bit_vector(8 downto 0); begingO: for I in 0 to 7 generateu_inst: H_subbport map(a(i), b(i),sub(i),diff(i), sub(i+l));end generate;sub(0) <= sub_in;sub_out <=sub(8);end stru;5-8library IEEE:use IEEE. Std _logic_ 1164.all:use IEEE. STD_LOGIC _UNSIGNED.all:entity seq_gen isport(CIK, RESET: in STD_LOGIC:Y0: out STD_LOGIC_vector(9 downto 0)):End seq_gen;Architecture rtl of seq_gen isSignal CNT: STD_LOGIC_VECTOR(3 downto 0);beginprocess(CLK, RESET)begin〜 ifRESET=,l,thenCNT v=''0000";Elsif CLK'event and CLK=T thenIfcnt="1001''thenCNTv=”000";elseCNT<=CNT +T;End if;End if;End process ;With CNT SelectY0<=,,000000000F, when ” 0000”,“0000000010” when " 0001”,“0000000100” when ” 0010”,“0000001000” when ” 0011”,“0000010000” when ” 0100”,^^0000100000^^ when ” 0101”,“0001000000” when ” 0110”,“0010000000” when ” 0111”,4<010*******,? when ” 1000”,T 000000000’' when others ;end rtl;5-7library IEEE;use IEEE.Std _logic_ 1164.all;use IEEE.std_logic_unsigned.al 1; entity counter isport(clk,rst,ml,m0:in std_logic;y:out std_logic_vector (4 downto 0));End counter;Architecture rtl of counter isSignal sei: std_logic_vector (1 downto 0);Signal per,ent: std_logic_vector (4 downto 0);beginsel<=ml&mO;With sei Selectperv=”1001(F when “0(F,"OOOll" when “01",,,0100r, when TO","00101" when others;process(reset,clk)beginif reset=T thencnt<=n00000n;elsif (clk'event and clk=r)thenif ent = pre thencnt<=H00000u;elsecnt<=cnt+T;end if;end if;end process;y<=cnt;end rtl;2-1判断下列标示符是否合法,如果有误指出原因:16#OFA#, 10#12F#, 8#7989#, 8#356#, 2#0101010#, 74HC245,\74HC574\, CLR/RESET, \IN, 4/SCLKX, DI00% 16#OFA#10#12F# 8#7989# 8#356# 2#0101010# 以上不合法,不能以数字开头和存在#符号。
1.用原理图输入法设计一位全加器,进行功能仿真,做出仿真波形。
参考实验一2.用原理图输入法设计一位半加器,进行功能仿真,做出仿真波形。
参考课本61页图3-53.用原理图输入法设计一位全加器,进行下载测试,参考实验一4.用原理图输入法设计一位半加器,进行下载测试,参考课本61页图3-55.用文本输入法设计一个分频电路,并进行功能测试。
以25M为信号源,得到一周期为1秒的方波脉冲。
library ieee; --调用库use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fp is -----实体说明(实体名需与文件名一致)port(inclk:in std_logic; ------端口说明outputa:out std_logic);end fp;architecture arch_fp of fp is ------构造体说明signal fp:std_logic_vector(24 downto 0); ------信号定义signal f:std_logic;beginprocess(inclk) ------进程语句描述if (inclk'event and inclk='1') then ------将时钟分频至1Hzif fp=24999999 thenfp<="0000000000000000000000000";f<=not f;else fp<=fp+1;end if;end if;end process;outputa<=f;end arch_fp; -------构造体结束6.用文本输入法设计一个分频电路,并进行功能测试。
以25M为信号源,得到一周期为2秒的方波脉冲。
library ieee; --调用库use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity fp is -----实体说明(实体名需与文件名一致)port(inclk:in std_logic; ------端口说明outputa:out std_logic);end fp;architecture arch_fp of fp is ------构造体说明signal fp:std_logic_vector(24 downto 0); ------信号定义signal f:std_logic;beginprocess(inclk) ------进程语句描述beginif (inclk'event and inclk='1') then ------将时钟分频至1Hzif fp=124999999 thenfp<="0000000000000000000000000";f<=not f;else fp<=fp+1;end if;end if;end process;outputa<=f;end arch_fp; -------构造体结束7.用文本输入法设计一个50倍分频电路,进行功能仿真。
Laboratory Exercise 1Switches, Lights, and Multiplexers ED实验参与答案Part1library ieee;use ieee.std_logic_1164.all;entity part1 isport(SW:in std_logic_vector(17 downto 0);LEDR:out std_logic_vector(17 downto 0));end part1;architecture Behavior of part1 isbeginLEDR <= SW;end Behavior;part2library ieee;use ieee.std_logic_1164.all;--a 2 to 1 multiplexer entityentity mux21 isport(in_x, in_y, in_s:in std_logic;out_m:out std_logic);end mux21;--a 2 to 1 multiplexer architecturearchitecture structural of mux21 issignal u, v:std_logic;beginu <= in_x and (not in_s);v <= in_y and in_s ;out_m <= u or v ;end structural;--a eight-bit wide 2 to 1 multiplexerlibrary ieee;use ieee.std_logic_1164.all;--eight-bit wide 2 to 1 multiplexer entityentity mux21_8bit isport(SW: in std_logic_vector (17 downto 0);--SW: in std_logic_vector (15 downto 8);--SW: in std_logic_vector (17 downto 17);LEDR: out std_logic_vector (7 downto 0));end mux21_8bit;--eight-bit wide 2 to 1 multiplexera rchitecturearchitecture Structural of mux21_8bit iscomponent mux21port(in_x, in_y, in_s:in std_logic;out_m:out std_logic);end component;beginU1:mux21port map (in_x=>SW(0), in_y=>SW(8), in_s=>SW(17), out_m=>LEDR(0));U2:mux21port map (in_x=>SW(1), in_y=>SW(9), in_s=>SW(17), out_m=>LEDR(1));U3:mux21port map (in_x=>SW(2), in_y=>SW(10), in_s=>SW(17), out_m=>LEDR(2));U4:mux21port map (in_x=>SW(3), in_y=>SW(11), in_s=>SW(17), out_m=>LEDR(3));U5:mux21port map (in_x=>SW(4), in_y=>SW(12), in_s=>SW(17), out_m=>LEDR(4));U6:mux21port map (in_x=>SW(5), in_y=>SW(13), in_s=>SW(17), out_m=>LEDR(5));U7:mux21port map (in_x=>SW(6), in_y=>SW(14), in_s=>SW(17), out_m=>LEDR(6));U8:mux21port map (in_x=>SW(7), in_y=>SW(15), in_s=>SW(17), out_m=>LEDR(7));end Structural;part3library ieee;use ieee.std_logic_1164.all;--a 2 to 1 multiplexer entityentity mux21 isport(in_x, in_y, in_s:in std_logic;out_m:out std_logic);end mux21;--a 2 to 1 multiplexer architecturearchitecture structural of mux21 issignal signal_u, signal_v:std_logic;beginsignal_u <= in_x and (not in_s);signal_v <= in_y and in_s ;out_m <= signal_u or signal_v ;end structural;library ieee;use ieee.std_logic_1164.all;--a 5 to 1 multiplexer entityentity mux51 isport(in5_u, in5_v, in5_w, in5_x, in5_y, in5_s1, in5_s2, in5_s0:in std_logic;out5_m:out std_logic);end mux51;--a 5 to 1 multiplexer architecturearchitecture Structural of mux51 iscomponent mux21port (in_x, in_y, in_s:in std_logic;out_m:out std_logic);end component;signal signal_a, signal_b, signal_c:std_logic;beginU1:mux21port map (in_x=>in5_u, in_y=>in5_v, in_s=>in5_s0, out_m=>signal_a);U2:mux21port map (in_x=>in5_w, in_y=>in5_x, in_s=>in5_s0, out_m=>signal_b);U3:mux21port map (in_x=>signal_a, in_y=>signal_b, in_s=>in5_s1, out_m=>signal_c);U4:mux21port map (in_x=>signal_c, in_y=>in5_y, in_s=>in5_s2, out_m=>out5_m);end Structural;library ieee;use ieee.std_logic_1164.all;--a 3bit 5 to 1 multiplexer entityentity mux51_3bit isport(SW: in std_logic_vector (17 downto 0);LEDR: out std_logic_vector (17 downto 0);LEDG: out std_logic_vector (2 downto 0));end mux51_3bit;--a 3bit 5 to 1 multiplexer architecturearchitecture structural of mux51_3bit iscomponent mux51port(in5_u, in5_v, in5_w, in5_x, in5_y, in5_s1, in5_s2, in5_s0:in std_logic;out5_m:out std_logic);end component;beginLEDR <= sw;U1:mux51 port map (in5_u=>SW(0), in5_v=>SW(3), in5_w=>SW(6), in5_x=>SW(9), in5_y=>SW(12),in5_s0=>SW(15), in5_s1=>SW(16), in5_s2=>SW(17), out5_m=>LEDG(0));U2:mux51 port map (in5_u=>SW(1), in5_v=>SW(4), in5_w=>SW(7), in5_x=>SW(10), in5_y=>SW(13),in5_s0=>SW(15), in5_s1=>SW(16), in5_s2=>SW(17), out5_m=>LEDG(1));U3:mux51 port map (in5_u=>SW(2), in5_v=>SW(5), in5_w=>SW(8), in5_x=>SW(11), in5_y=>SW(14),in5_s0=>SW(15), in5_s1=>SW(16), in5_s2=>SW(17), out5_m=>LEDG(2));end structural;part4library ieee;use ieee.std_logic_1164.all;--a 7-segment decoder entityentity decoder isport(decoder_in_3:in std_logic_vector(2 downto 0);HEX0:out std_logic_vector(0 to 6));end decoder;-- a 7-segment decorder architecturearchitecture behavioral of decoder isbeginprocess(decoder_in_3)begincase decoder_in_3 iswhen "000"=> HEX0<= "0001001";when "001"=> HEX0 <= "0000110";when "010"=> HEX0 <= "1000110";when "011"=> HEX0 <= "1000000";when others => Hex0 <= "1111111";end case;end process;end behavioral;part5library ieee;use ieee.std_logic_1164.all;entity part5 isport(SW: in std_logic_vector(17 downto 0);HEX0,HEX1,HEX2,HEX3,HEX4: out std_logic_vector(6 downto 0));end part5;architecture Behavior of part5 iscomponent mux51_seg7port(Mux51_seg7_in: in std_logic_vector(17 downto 0);Seg: out std_logic_vector(6 downto 0));end component;beginU0:mux51_seg7port map(Mux51_seg7_in=>SW,Seg=>HEX0);U1:mux51_seg7port map(Mux51_seg7_in(17 downto 15)=>SW(17 downto 15), Mux51_seg7_in(14 downto 12)=>SW(11 downto 9),Mux51_seg7_in(11 downto 9)=>SW(8 downto 6), Mux51_seg7_in(8 downto 6)=>SW(5 downto 3),Mux51_seg7_in(5 downto 3)=>SW(2 downto 0), Mux51_seg7_in(2 downto 0)=>SW(14 downto 12),Seg=>HEX1);U2:mux51_seg7port map(Mux51_seg7_in(17 downto 15)=>SW(17 downto 15), Mux51_seg7_in(14 downto 12)=>SW(8 downto 6),Mux51_seg7_in(11 downto 9)=>SW(5 downto 3), Mux51_seg7_in(8 downto 6)=>SW(2 downto 0),Mux51_seg7_in(5 downto 3)=>SW(14 downto 12), Mux51_seg7_in(2 downto 0)=>SW(11 downto 9),Seg=>HEX2);U3:mux51_seg7port map(Mux51_seg7_in(17 downto 15)=>SW(17 downto 15), Mux51_seg7_in(14 downto 12)=>SW(5 downto 3),Mux51_seg7_in(11 downto 9)=>SW(2 downto 0), Mux51_seg7_in(8 downto 6)=>SW(14 downto 12),Mux51_seg7_in(5 downto 3)=>SW(11 downto 9), Mux51_seg7_in(2 downto 0)=>SW(8 downto 6),Seg=>HEX3);U4:mux51_seg7port map(Mux51_seg7_in(17 downto 15)=>SW(17 downto 15), Mux51_seg7_in(14 downto 12)=>SW(2 downto 0),Mux51_seg7_in(11 downto 9)=>SW(14 downto 12), Mux51_seg7_in(8 downto 6)=>SW(11 downto 9),Mux51_seg7_in(5 downto 3)=>SW(8 downto 6), Mux51_seg7_in(2 downto 0)=>SW(5 downto 3),Seg=>HEX4);end Behavior;----------------------------------------------------------------------------------------------------------A circuit that can select and display one of five characters-----------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;entity mux51_seg7 isport(Mux51_seg7_in: in std_logic_vector(17 downto 0);Seg: out std_logic_vector(6 downto 0));end mux51_seg7;architecture Behavior of mux51_seg7 iscomponent mux51_3bitport(S, U, V, W, X, Y: in std_logic_vector(2 downto 0);M: out std_logic_vector(2 downto 0));end component;component char_7segport(C: in std_logic_vector(2 downto 0);Display: out std_logic_vector(6 downto 0));end component;signal M : std_logic_vector(2 downto 0);beginM0: mux51_3bit port map(Mux51_seg7_in(17 downto 15), Mux51_seg7_in(14 downto 12),Mux51_seg7_in(11 downto 9),Mux51_seg7_in(8 downto 6),Mux51_seg7_in(5 downto 3),Mux51_seg7_in(2 downto 0),M);H0: char_7seg port map(M, Seg);end Behavior;-----------------------------------------------------------------------------------------------------------------------------a 3bit mux51----------------------------------------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;--a 2 to 1 multiplexer entityentity mux21 isport(in_x, in_y, in_s:in std_logic;out_m:out std_logic);end mux21;--a 2 to 1 multiplexer architecturearchitecture structural of mux21 issignal signal_u, signal_v:std_logic;beginsignal_u <= in_x and (not in_s);signal_v <= in_y and in_s ;out_m <= signal_u or signal_v ;end structural;library ieee;use ieee.std_logic_1164.all;--a 5 to 1 multiplexer entityentity mux51 isport(in5_u, in5_v, in5_w, in5_x, in5_y, in5_s1, in5_s2, in5_s0:in std_logic;out5_m:out std_logic);end mux51;--a 5 to 1 multiplexer architecturearchitecture Structural of mux51 iscomponent mux21port (in_x, in_y, in_s:in std_logic;out_m:out std_logic);end component;signal signal_a, signal_b, signal_c:std_logic;beginU1:mux21port map (in_x=>in5_u, in_y=>in5_v, in_s=>in5_s0, out_m=>signal_a);U2:mux21port map (in_x=>in5_w, in_y=>in5_x, in_s=>in5_s0, out_m=>signal_b);U3:mux21port map (in_x=>signal_a, in_y=>signal_b, in_s=>in5_s1, out_m=>signal_c);U4:mux21port map (in_x=>signal_c, in_y=>in5_y, in_s=>in5_s2, out_m=>out5_m);end Structural;-----------------------------------------------------------------------------------------------------------------------------a 3bit 5 to 1 multiplexer---------------------------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;--a 3bit 5 to 1 multiplexer entityentity mux51_3bit isport(S, U, V, W, X, Y: in std_logic_vector (2 downto 0);M: out std_logic_vector (2 downto 0));end mux51_3bit;--a 3bit 5 to 1 multiplexer architecturearchitecture structural of mux51_3bit iscomponent mux51port(in5_u, in5_v, in5_w, in5_x, in5_y, in5_s1, in5_s2, in5_s0:in std_logic;out5_m:out std_logic);end component;beginU1:mux51 port map (in5_u=>U(0), in5_v=>V(0), in5_w=>W(0), in5_x=>X(0), in5_y=>Y(0),in5_s0=>S(0), in5_s1=>S(1), in5_s2=>S(2), out5_m=>M(0));U2:mux51 port map (in5_u=>U(1), in5_v=>V(1), in5_w=>W(1), in5_x=>X(1), in5_y=>Y(1),in5_s0=>S(0), in5_s1=>S(1), in5_s2=>S(2), out5_m=>M(1));U3:mux51 port map (in5_u=>U(2), in5_v=>V(2), in5_w=>W(2), in5_x=>X(2), in5_y=>Y(2),in5_s0=>S(0), in5_s1=>S(1), in5_s2=>S(2), out5_m=>M(2));end structural;-----------------------------------------------------------------------------------------------------------------------------a 7-segment decoder---------------------------------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;--a 7-segment decoder entityentity char_7seg isport(C:in std_logic_vector(2 downto 0);Display:out std_logic_vector(6 downto 0));end char_7seg;-- a 7-segment decorder architecturearchitecture behavioral of char_7seg isbeginprocess(C)begincase C iswhen "000"=> Display <= "0001001";when "001"=> Display <= "0000110";when "010"=> Display <= "1000111";when "011"=> Display <= "1000000";when others => Display <= "1111111";end case;end process;end behavioral;part6--------------------------------------------------------------------------------------------------------------Rotating the word HELLO on eight displays.----------------------------------SW(17~15): select--SW(14~12): H--SW(11~9):E--SW(8~6):L--SW(5~3):O--SW(2~0):none---------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;entity part6 isport(SW: in std_logic_vector(17 downto 0);HEX0,HEX1,HEX2,HEX3,HEX4,HEX5,HEX6,HEX7: out std_logic_vector(6 downto 0)); end part6;architecture Behavior of part6 iscomponent mux81_seg7port(S, D0, D1, D2, D3, D4, D5, D6, D7: in std_logic_vector(2 downto 0);Seg: out std_logic_vector(6 downto 0));end component;beginU0:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(2 downto 0),D1=>SW(2 downto 0),D2=>SW(2 downto 0),D3=>SW(14 downto 12),D4=>SW(11 downto 9),D5=>SW(8 downto 6),D6=>SW(8 downto 6),D7=>SW(5 downto 3),Seg=>HEX0);U1:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(2 downto 0),D1=>SW(2 downto 0),D2=>SW(14 downto 12),D3=>SW(11 downto 9),D4=>SW(8 downto 6),D5=>SW(8 downto 6),D6=>SW(5 downto 3),D7=>SW(2 downto 0),Seg=>HEX1);U2:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(2 downto 0),D1=>SW(14 downto 12),D2=>SW(11 downto 9),D3=>SW(8 downto 6),D4=>SW(8 downto 6),D5=>SW(5 downto 3),D6=>SW(2 downto 0),D7=>SW(2 downto 0),Seg=>HEX2);U3:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(14 downto 12),D1=>SW(11downto 9),D2=>SW(8 downto 6),D3=>SW(8 downto 6),D4=>SW(5 downto 3),D5=>SW(2 downto 0),D6=>SW(2 downto 0),D7=>SW(2 downto 0),Seg=>HEX3);U4:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(11 downto 9),D1=>SW(8 downto 6),D2=>SW(8 downto 6),D3=>SW(5 downto 3),D4=>SW(2 downto 0),D5=>SW(2 downto 0),D6=>SW(2 downto 0),D7=>SW(14 downto 12),Seg=>HEX4);U5:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(8 downto 6),D1=>SW(8 downto 6),D2=>SW(5 downto 3),D3=>SW(2 downto 0),D4=>SW(2 downto 0),D5=>SW(2 downto 0),D6=>SW(14 downto 12),D7=>SW(11 downto 9),Seg=>HEX5);U6:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(8 downto 6),D1=>SW(5 downto 3),D2=>SW(2 downto 0),D3=>SW(2 downto 0),D4=>SW(2 downto 0),D5=>SW(14 downto 12),D6=>SW(11 downto 9),D7=>SW(8 downto 6),Seg=>HEX6);U7:mux81_seg7port map(S=>SW(17 downto 15),D0=>SW(5 downto 3),D1=>SW(2 downto 0),D2=>SW(2 downto 0),D3=>SW(2 downto 0),D4=>SW(14 downto 12),D5=>SW(11 downto 9),D6=>SW(8 downto 6),D7=>SW(8 downto 6),Seg=>HEX7);end Behavior;----------------------------------------------------------------------------------------------------------A circuit that can select and display one of eight characters----------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;--eht mux81_seg7 entityentity mux81_seg7 isport(S, D0, D1, D2, D3, D4, D5, D6, D7: in std_logic_vector(2 downto 0);Seg: out std_logic_vector(6 downto 0));end mux81_seg7;--the mux81_seg7 architecturearchitecture Behavior of mux81_seg7 iscomponent mux81_3bitport(S, D0, D1, D2, D3, D4, D5, D6, D7: in std_logic_vector(2 downto 0);M: out std_logic_vector(2 downto 0));end component;component char_7segport(C: in std_logic_vector(2 downto 0);Display: out std_logic_vector(6 downto 0));end component;signal M1 : std_logic_vector(2 downto 0);beginM0: mux81_3bit port map(S, D0, D1, D2, D3, D4, D5, D6, D7,M1);H0: char_7seg port map(M1, Seg);end Behavior;-----------------------------------------------------------------------------------------------------------------------------a 3bit mux81----------------------------------------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;--a 3bit multiplexer 8 to 1 entityentity mux81_3bit isport(S, D0, D1, D2, D3, D4, D5, D6, D7: in std_logic_vector(2 downto 0);M: out std_logic_vector(2 downto 0)); end mux81_3bit;--a 3bit multiplexer 8 to 1 architecturearchitecture behavioral of mux81_3bit isbeginwith S selectM <= D0when "000",D1 when "001",D2 when "010",D3 when "011",D4 when "100",D5 when "101",D6 when "110",D7 when "111","ZZZ"when others;end behavioral;-----------------------------------------------------------------------------------------------------------------------------a 7-segment decoder---------------------------------------------------------------------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;--a 7-segment decoder entityentity char_7seg isport(C:in std_logic_vector(2 downto 0);Display:out std_logic_vector(6 downto 0));end char_7seg;-- a 7-segment decorder architecturearchitecture behavioral of char_7seg isbeginprocess(C)begincase C iswhen "000"=> Display <= "0001001";when "001"=> Display <= "0000110";when "010"=> Display <= "1000111";when "011"=> Display <= "1000000";when others => Display <= "1111111";end case;end process;end behavioral;。