欢迎来到天天文库
浏览记录
ID:11231349
大小:36.50 KB
页数:6页
时间:2018-07-10
《北邮_vhdl时序逻辑电路设计部分实验vhdl源代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、异步复位4位二进制减计数器:LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYV8ISPORT(clk,reset:INSTD_LOGIC;q:OUTSTD_LOGIC_VECTOR(3DOWNTO0));ENDV8;ARCHITECTUREstrucOFV8ISSIGNALq_temp:STD_LOGIC_VECTOR(3DOWNTO0);BEGINPROCESS(clk,reset)BEGINIFreset='1'THENq_temp<=
2、"1111";ELSIF(clk'EVENTANDclk='1')THENq_temp<=q_temp-1;ENDIF;ENDPROCESS;q<=q_temp;ENDstruc;分频计:LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;USEIEEE.STD_LOGIC_UNSIGNED.ALL;ENTITYGKY07P13ISPORT(clk,clear:INSTD_LOGIC;o,clk_out:OUTSTD_LOGIC);ENDGKY07P13;ARCHITECTUREstrucOFGKY07P13ISSI
3、GNALtemp:INTEGERRANGE0TO11;BEGINp1:PROCESS(clear,clk)BEGINo<=clk;IFclear='0'THENtemp<=0;ELSIFclk'EVENTANDclk='1'THENIFtemp=11THENtemp<=0;ELSEtemp<=temp+1;ENDIF;ENDIF;ENDPROCESSp1;p2:PROCESS(temp)BEGINIFtemp>5THENclk_out<='1';ELSEclk_out<='0';ENDIF;ENDPROCESSp2;ENDstruc;带异步复
4、位的4位能自动启动环形计数器LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYHUANXINGJISHUISPORT(clk,rs:INSTD_LOGIC;countout:OUTSTD_LOGIC_VECTOR(3DOWNTO0));ENDHUANXINGJISHU;ARCHITECTUREbehaveOFHUANXINGJISHUISSIGNALQ:STD_LOGIC_VECTOR(3DOWNTO0);BEGINPROCESS(rs,clk)BEGINIFrs='0'THENQ<="0011";EL
5、SIF(clk'eventANDclk='1')THENCASEQISWHEN"0000"=>Q<="0001";WHEN"0001"=>Q<="0010";WHEN"0010"=>Q<="0100";WHEN"0011"=>Q<="0110";WHEN"0100"=>Q<="1000";WHEN"0101"=>Q<="1010";WHEN"0110"=>Q<="1100";WHEN"0111"=>Q<="1110";WHEN"1000"=>Q<="0001";WHEN"1001"=>Q<="0010";WHEN"1010"=>Q<="010
6、0";WHEN"1011"=>Q<="0110";WHEN"1100"=>Q<="1000";WHEN"1101"=>Q<="1010";WHEN"1110"=>Q<="1100";WHEN"1111"=>Q<="1110";WHENOTHERS=>Q<="0000";ENDCASE;ENDIF;ENDPROCESS;countout<=Q;ENDbehave;带异步复位的4位能自启动扭形计数器:LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYNIUHUAIJISHUISPORT(clk,rs:INS
7、TD_LOGIC;countout:OUTSTD_LOGIC_VECTOR(3DOWNTO0));ENDNIUHUAIJISHU;ARCHITECTUREbehaveOFNIUHUAIJISHUISSIGNALQ:STD_LOGIC_VECTOR(3DOWNTO0);BEGINPROCESS(rs,clk)BEGINIFrs='0'THENQ<="0100";ELSIF(clk'eventANDclk='1')THENCASEQISWHEN"0000"=>Q<="0001";WHEN"0001"=>Q<="0011";WHEN"0010"=>
8、Q<="0101";WHEN"0011"=>Q<="0111";WHEN"0100"=>Q<="1001";WHEN"0101"=>Q<="1011";WHEN"0
此文档下载收益归作者所有