欢迎来到天天文库
浏览记录
ID:57751144
大小:15.50 KB
页数:3页
时间:2020-09-02
《基于VHDL的流水灯设计.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、LIBRARYIEEE;USEIEEE.STD_LOGIC_1164.ALL;ENTITYhuayangISPORT(clk:INSTD_LOGIC;led0,led1,led2,led3,led4,led5,led6,led7,led8:OUTSTD_LOGIC);ENDhuayang;ARCHITECTUREhahaOFhuayangISSIGNALcnt:INTEGERRANGE0TO;signalclk1hz:INTEGERRANGE0TO1;SIGNALk1:INTEGERRANGE0TO25;BEGINPROCESS(clk)BEGIN
2、IF(clk'EVENTANDclk='1')THENIF(cnt=)THENcnt<=0;elsecnt<=cnt+1;ENDIF;IF(cnt<=)thenclk1hz<=1;ELSEclk1hz<=0;ENDIF;ENDIF;IF(clk1hz'eventandclk1hz=1)THENIF(k1=25)THENk1<=0;ELSEk1<=k1+1;ENDIF;ENDIF;ENDPROCESS;PROCESS(k1)BEGINled0<='0';led1<='0';led2<='0';led3<='0';led4<='0';led5<='0'
3、;led6<='0';led7<='0';led8<='0';IF(k1=0)THENled0<='1';ELSIF(k1=1)THENled1<='1';ELSIF(k1=2)THENled2<='1';ELSIF(k1=3)THENled3<='1';ELSIF(k1=4)THENled4<='1';ELSIF(k1=5)THENled5<='1';ELSIF(k1=6)THENled6<='1';ELSIF(k1=7)THENled7<='1';ELSIF(k1=8)THENled8<='1';ELSIF(k1=9)THENled7<='1'
4、;ELSIF(k1=10)THENled6<='1';ELSIF(k1=11)THENled5<='1';ELSIF(k1=12)THENled4<='1';ELSIF(k1=13)THENled3<='1';ELSIF(k1=14)THENled2<='1';ELSIF(k1=15)THENled1<='1';ELSIF(k1=16)THENled0<='1';ELSIF(k1=17)THENled4<='1';ELSIF(k1=18)THENled3<='1';led5<='1';ELSIF(k1=19)THENled2<='1';led6<=
5、'1';ELSIF(k1=20)THENled1<='1';led7<='1';ELSIF(k1=21)THENled0<='1';led8<='1';ELSIF(k1=22)THENled1<='1';led7<='1';ELSIF(k1=23)THENled2<='1';led6<='1';ELSIF(k1=24)THENled3<='1';led5<='1';ELSIF(k1=25)THENled4<='1';ENDIF;ENDPROCESS;ENDhaha;
此文档下载收益归作者所有