资源描述:
《VHDL语言实例.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、.VHDL语言实例例1:设计一七段显示译码器,用它来驱动七段发光管LED显示十六进制数字0到9和字母A到F。LED显示数码管为共阳极。LIBRARYieee; USEieee.std_logic_1164.all; ENTITYHEX2LEDIS PORT( HEX:INstd_logic_vector(3DOWNTO0);
2、 LED:OUTstd_logic_vector(6TO0) ); ENDHEX2LED; 图例1七段显示译码器实体ARCHITECTUREHEX2LED_arcOFHEX2LEDIS BEGIN --HEX-TO-SEVEN-SEGMENTDECODER --SEGMEN
3、TENCODING --0 ------ --5
4、
5、1 ------<--6 --4
6、
7、2 ------
8、 --3 WITHHEXSELECT LED<="1111001"when"0001", "0100100"when"0010", "0110000"when"0011", "0011001"when"0100", "0010010"when"0101",
9、 "0000010"when"0110", "1111000"when"0111", "0000000"when"1000", "0010000"when.."1001", "0001000"when"1010", "0000011"when"1011", "1000110"when"1100",
10、 "0100001"when"1101", "0000110"when"1110", "0001110"when"1111", "1000000"whenothers; ENDHEX2LED_arc; 例2:设计一个八选一数据选择器1)s是通道选择信号, d0,d1,d2,d3,d4,d5,d6,d7数据输入 out1是数据输出ENTITYselsISPORT(d0
11、,d1,d2,d3,d4,d5,d6,d7:INBIT; s:INTEGERRANGE0TO7; out1:OUTBIT);ENDsels;图例2(a) 八选一数据选择器实体ARCHITECTUREsels_arcOFselsISBEGIN WITHsSELECT out1<=d0WHEN0, d1WHEN1, d2WHEN2, d3WHEN3, d4WHEN4,
12、 d5WHEN5, d6WHEN6, d7WHEN7;ENDsels_arc;2)A,B,C是通道选择信号, I0,I1,I2,I3,I4,I5,I6,I7数据输入 Q是数据输出 ..LIBRARYieee;USE