您好,欢迎访问三七文档
7段译码器设计2012-2-13内容提要用并行语句设计在进程语句中设计用ROM设计动态扫描译码器设计硬件电路用并行语句设计ENTITYDECL7SISPORT(A:INSTD_LOGIC_VECTOR(3DOWNTO0);R:INSTD_LOGIC;LED7S:OUTSTD_LOGIC_VECTOR(6DOWNTO0));ENDDECL7S;ARCHITECTUREONEOFDECL7SISBEGINLED7S=1111111WHENA=0000ELSE1111001WHENA=0001ELSE0100100WHENA=0011ELSE0110000WHENA=0011ELSE0011001WHENA=0100ELSE0010010WHENA=0101ELSE0000010WHENA=0110ELSE1111000WHENA=0111ELSE--……0000000WHENA=1000ELSE0001110;ENDONE;级数多,运行速度慢在进程语句中设计LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYDECL7SISPORT(A:INSTD_LOGIC_VECTOR(3DOWNTO0);R:INSTD_LOGIC;LED7S:OUTSTD_LOGIC_VECTOR(6DOWNTO0));ENDDECL7S;ARCHITECTUREONEOFDECL7SISBEGINPROCESS(A,R)BEGINIFR='1'THENCASEAISWHEN0000=LED7S=1000000;WHEN0001=LED7S=1111001;WHEN0010=LED7S=0100100;WHEN0011=LED7S=0110000;WHEN0100=LED7S=0011001;WHEN0101=LED7S=0010010;WHEN0110=LED7S=0000010;WHEN0111=LED7S=1111000;WHEN1000=LED7S=0000000;WHEN1001=LED7S=0010000;WHEN1010=LED7S=0001000;WHEN1011=LED7S=0000011;WHEN1100=LED7S=1000110;WHEN1101=LED7S=0100001;WHEN1110=LED7S=0000110;WHEN1111=LED7S=0001110;WHENOTHERS=NULL;ENDCASE;ELSELED7S=1111111;ENDIF;ENDPROCESS;ENDONE;只有一级,速度快用ROM设计编辑ROM文件新建原理图生成ROM模块连线不使用逻辑宏单元address[4..0]clockq[7..0]lpm_rom0instVCCaddress[4..0]INPUTVCCclockINPUTq[7..0]OUTPUT动态扫描译码器设计LED数码显示电路从电路看,该数码显示器是共阴极结构bcdin输入的数据bcdsel位选信号leddata7段译码输出ledsel位选输出ledd[7..0]OUTPUTledse[3..0]OUTPUTbcdin[3..0]bcdsel[1..0]leddata[7..0]ledsel[3..0]bcd_ledinst3ledd[7..0]ledse[3..0]实体定义libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_unsigned.all;entitybcd_ledisport(leddata:outstd_logic_vector(7downto0);ledsel:outstd_logic_vector(3downto0);bcdin:instd_logic_vector(3downto0);bcdsel:instd_logic_vector(1downto0));endbcd_led;7段译码architecturebehaveofbcd_ledissignalbcdtmp:std_logic_vector(3downto0);signalbcdseltmp:std_logic_vector(1downto0);beginprocess(bcdsel)beginbcdtmp=bcdin;bcdseltmp=bcdsel;casebcdtmpiswhen0000=leddata=11111100;when“0001”=leddata=01100000;when0010=leddata=11011010;when0011=leddata=11110010;when0100=leddata=01100110;when0101=leddata=10110110;when0110=leddata=10111110;when0111=leddata=11100000;when1000=leddata=11111110;when1001=leddata=11110110;when1010=leddata=11101110;when1011=leddata=00111110;when1100=leddata=10011100;when1101=leddata=01111010;when1110=leddata=10011110;when1111=leddata=10001110;whenothers=leddata=00000000;endcase;位选信号输出casebcdseltmpiswhen00=ledsel=0001;when01=ledsel=0010;when10=ledsel=0100;when11=ledsel=1000;whenothers=ledsel=0000;endcase;endprocess;endbehave;
本文标题:7段译码电路设计
链接地址:https://www.777doc.com/doc-3934759 .html