欢迎来到天天文库
浏览记录
ID:38330941
大小:41.00 KB
页数:5页
时间:2019-06-10
《北邮 VHDL时序逻辑电路设计部分实验VHDL源代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、(写的有点简陋,见谅哈,各位~~)VHDL时序设计逻辑电路设计(一)四位二进制减计数器(摘自网上)libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycount1isport(ci:instd_logic;--计数信号reset:instd_logic;--异步复位load:instd_logic;--同步置数clk:instd_logic;d:instd_logic_vector(3downto0);--置数值q:bufferstd_log
2、ic_vector(3downto0);co:outstd_logic--计数溢出标志);endcount1;architecturebehaveofcount1isbeginprocess(clk,reset)beginif(reset='0')thenq<="0000";elsif(clk'eventandclk='1')thenif(load='1')thenq<=d;elsif(ci='1')thenif(q=0)thenq<="1111";co<='1';elseq<=q-1;co<='0';endif;endif;endif;e
3、ndprocess;endbehave;VHDL时序设计逻辑电路设计(二)(一)带异步复位的4位能自动启动环形计数器LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYHUANXINGJISHUISPORT(clk,rs:INSTD_LOGIC;countout:OUTSTD_LOGIC_VECTOR(3DOWNTO0));ENDHUANXINGJISHU;ARCHITECTUREbehaveOFHUANXINGJISHUISSIGNALQ:STD_LOGIC_VECTOR(3DOWNTO0);BEGI
4、NPROCESS(rs,clk)BEGINIFrs='0'THENQ<="0011";ELSIF(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<="0
5、001";WHEN"1001"=>Q<="0010";WHEN"1010"=>Q<="0100";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_
6、LOGIC_1164.ALL;ENTITYNIUHUAIJISHUISPORT(clk,rs:INSTD_LOGIC;countout:OUTSTD_LOGIC_VECTOR(3DOWNTO0));ENDNIUHUAIJISHU;ARCHITECTUREbehaveOFNIUHUAIJISHUISSIGNALQ:STD_LOGIC_VECTOR(3DOWNTO0);BEGINPROCESS(rs,clk)BEGINIFrs='0'THENQ<="0100";ELSIF(clk'eventANDclk='1')THENCASEQISWHEN"
7、0000"=>Q<="0001";WHEN"0001"=>Q<="0011";WHEN"0010"=>Q<="0101";WHEN"0011"=>Q<="0111";WHEN"0100"=>Q<="1001";WHEN"0101"=>Q<="1011";WHEN"0110"=>Q<="1101";WHEN"0111"=>Q<="1111";WHEN"1000"=>Q<="0000";WHEN"1001"=>Q<="0010";WHEN"1010"=>Q<="0101";WHEN"1011"=>Q<="0111";WHEN"1100"=>Q<
8、="1000";WHEN"1101"=>Q<="1010";WHEN"1110"=>Q<="1100";WHEN"1111"=>Q<="1110";WHENOTHERS=>Q<=
此文档下载收益归作者所有