




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
基于VHDL的数字逻辑设计组合逻辑部分组合逻辑电路设计分析逻辑问题,抽象输入、输出逻辑变量。列真值表、写函数表达式。采用基本门电路、PLD实现。实体描述ENTITY__entity_nameIS PORT( __input_name :IN STD_LOGIC; __input_vector_name:INSTD_LOGIC_VECTOR(__highdownto__low); __output_name, :OUT STD_LOGIC); __output_vector_name:OUTSTD_LOGIC_VECTOR(__highdownto__low);END__entity_name;ARCHITECTUREaOF__entity_nameIS
SIGNAL__signal_name:STD_LOGIC;BEGIN --ProcessStatement --ConcurrentProcedureCall
--ConcurrentSignalAssignment --ConditionalSignalAssignment --SelectedSignalAssignment --ComponentInstantiationStatement --GenerateStatementENDa;结构体描述(1)编码器(2)译码器(3)比较器(4)数据选择器(5)三态输出电路
常用组合逻辑电路设计(1)编码器A6A7A5A4A3A2A1A0Y2Y1Y08×3编码器ENA7A6A5A4A3A2A1A0Y2Y1Y00000000100000000010001000001000100000100001100010000100001000001010100000011010000000111libraryieee;useieee.std_logic_1164.all;entitybmqisport(A:instd_logic_vector(7downto0);En:in
std_logic;Y:outstd_logic_vector(2downto0));endbmq;architecturem1ofbmqissignalsel:std_logic_vector(8downto0);beginsel<=En&A;withselselectY<="000"when"100000001","001"when"100000010","010"when"100000100","011"when"100001000","100"when"100010000","101"when"100100000","110"when"101000000","111"when"110000000","000"whenothers;endm1;architecturem2ofbmqissignalsel:std_logic_vector(8downto0);beginProcess(En,A)BeginIfEn='1'thenifA="00000001"thenY<="000";
elsifA="00000010"thenY<="001";
elsifA="00000100"thenY<="010";
elsifA="00001000"thenY<="011";
elsifA="00010000"thenY<="100";
elsifA="00100000"thenY<="101";
elsifA="01000000"thenY<="110";elseY<="111";endif;ElseY<="000";endif;endprocess;endm2;(2)译码器A.3-8译码器3×8译码器A6A7A5A4A3A2A1A0Y2Y1Y0ENlibraryieee;useieee.std_logic_1164.all;entityymqisport(Y:instd_logic_vector(2downto0);EN:instd_logic;A:outstd_logic_vector(7downto0));endymq;architecturem1ofymqissignalsel:std_logic_vector(3downto0);beginsel<=En&Y;withselselectA<="00000001"when"1000","00000010"when"1001","00000100"when"1010","00001000"when"1011","00010000"when"1100","00100000"when"1101","01000000"when"1110","10000000"when"1111","11111111"whenothers;endm1;
B.码制转换(2)译码器四位二进制码转换为BCD码,并译码显示。
(数码管为共阴极)Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic_unsigned.all;EntitybcdisPort(A:instd_logic_vector(3downto0);bcd0,bcd1:outstd_logic_vector(3downto0);seven0,seven1:outstd_logic_vector(6downto0));Endbcd;Architectureaofbcdis
signaltmp:std_logic_vector(3downto0);Beginbcd0<=Awhen(A<10)elseA+6;bcd1<=“0000”when(A<10)else“0001”;tmp<=bcd0;
seven0<="0111111"whentmp="0000"else
--0
"0000110"whentmp="0001"else
--1
"1011011"whentmp="0010"else
--2
"1001111"whentmp="0011"else
--3
"1100110"whentmp="0100"else
--4
"1101101"whentmp="0101"else
--5
"1111101"whentmp="0110"else
--6
"0000111"whentmp="0111"else
--7
"1111111"whentmp="1000"else
--8
"1101111"whentmp="1001"else
--9
"0000000";seven1<=“0111111”when(A<10)else“0000110”;Enda;(3)比较器AGTBBLTBAEQBAB如果a>b,输出为:agtb=‘1‘,altb=’0’,aeqb=‘0’;如果a<b,输出为:altb=‘1‘,agtb=’0’,aeqb=‘0’;如果a=b,输出为:aeqb=‘1‘,agtb=’0’,altb=‘0’。Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic_unsigned.all;ENTITYcmpabIS
PORT(A,B:instd_logic_vector(7downto0); AGTB,ALTB,AEQB:outstd_logic); ENDcmpab;ARCHITECTUREaOFcmpabISBEGIN
aeqb<='1'whena=belse'0';agtb<='1'whena>belse'0';altb<='1'whena<belse'0';ENDa;ARCHITECTUREbOFcmpabISBEGIN
process(a,b)begin
ifA>Bthenagtb<='1';
elsifA=Bthenaeqb<='1';
elsealtb<='1';endif;
end
process;ENDb;(4)数据选择器4选1MUXABCDYS0S1libraryieee;useieee.std_logic_1164.all;entitymux41isport(A,B,C,D:instd_logic;sel:instd_logic_vector(1downto0);dout:outstd_logic);endmux41;architecturearchmuxofmux41isbegin
withselselectdout<=Awhen"00", Bwhen"01", Cwhen"10", Dwhenothers;endarchmux;
(5)三态输出电路
AENBEN=1B=A;EN=0B=高阻态libraryieee;useieee.std_logic_1164.all;entitytrioutisport(data_in :instd_logic;en :instd_logic;data_out:outstd_logic);endtriout;architecturebehaveoftrioutisbegin
data_out<=data_inwhenen='1'else'Z';endbehave;
--注意此处的“Z”要大写;libraryieee;useieee.std_logic_1164.all;entitytrioutisport(data_in :instd_logic_vector(7downto0);en :instd_logic;data_out:outstd_logic_vector(7downto0));endtriout;architecturebehaveoftrioutisbegin
data_out<=data_inwhenen='1'
else(others=>'Z‘);
endbehave;
--注意此处的“Z”要大写;总结:VHDL+PLD组合逻辑电路设计逻辑问题逻辑输入、输出,逻辑函数逻辑输入描述:1位的输入变量标准逻辑类型,std_logic多位的输入变量标准逻辑序列类型,std_logic_vector逻辑输出描述:同逻辑输入。逻辑关系描述:列出真值表
适用于输入变量较少、或函数有效输入值较少的情况。求取逻辑函数表达式输出变量较少或输出变量相互独立的情况。逻辑关系直接表述(逻辑关系概括直接逻辑描述)
码制转换等问题(数值运算类)例一:四位二进制数转换为BCD码。entitybcd2bisport
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 服务外包框架合同
- 2025年小学英语毕业考试模拟试卷:语音语调提升实战训练试题
- 房地产开发项目的技术组织措施
- 2025年古筝演奏技能考核试卷:古筝演奏技巧与音乐心理素质模拟演练试题
- 五年级下册班主任心理健康教育计划
- 机构的经营模式对湖南地区影戏发展的影响
- ESG对比亚迪公司企业绩效的影响
- 2025年监理工程师职业能力测试卷:监理工程进度与成本控制试题集
- 2025年西班牙语DELE考试真题卷:模拟测试与答案解析试题
- 2025年成人高考《语文》得体表达与作文素材积累能力测试题库
- 妊娠合并支气管哮喘课件
- 2025河南中烟漯河卷烟厂招聘7人易考易错模拟试题(共500题)试卷后附参考答案
- 大数据行业数据资产转让协议范本
- 三农村合作社应急管理方案
- s7-200smart详细教学教案
- 旅馆业治安管理培训会
- 血透病人皮肤瘙痒课件
- 国际农业技术转移与合作-深度研究
- 4-2-电商文案开头、结尾、正文的写作
- 2025年广州水务投资集团有限公司招聘笔试参考题库含答案解析
- 2025年江苏扬州水利建筑工程公司招聘笔试参考题库含答案解析
评论
0/150
提交评论