eda课程设计vhdl语言数字时钟电子琴---来自重庆大学电子信息工程内容摘要:

_logic。 sound:out std_logic)。 end rjy4600_nzsound。 architecture rtl of rjy4600_nzsound is signal jishu:integer range 0 to 50000。 signal jishu1:integer range 0 to 50000。 signal didi:integer range 0 to 15:=0。 begin process(clk50_1000) begin if clk50_100039。 event and clk50_1000=39。 039。 then if naozhong_snd=39。 139。 then if didi=0 or didi=2 or didi=4 or didi=6 or didi=8 or didi=10 or didi=12 or didi=14 then if jishu20200 then sound=clk_1K。 else sound=39。 039。 end if。 if jishu=49999 then jishu=0。 didi=didi+1。 else jishu=jishu+1。 end if。 elsif didi=1 or didi=3 or didi=5 or didi=7 or didi=9 or didi=11 or didi=13 then if jishu120200 then sound=clk_2K。 else sound=39。 039。 end if。 if jishu1=49999 then jishu1=0。 didi=didi+1。 else jishu1=jishu1+1。 end if。 else didi=0。 sound=39。 039。 end if。 else sound=39。 039。 end if。 end if。 end process。 end rtl。 rjy4600_PS2_K: — ps2键盘串并行转换 library ieee。 use。 use。 use。 entity rjy4600_PS2_K is Port ( sysclk: in std_logic。 ps2clk: in std_logic。 ps2data: in std_logic。 reset: in std_logic。 led: out std_logic_vector(7 downto 0))。 end rjy4600_PS2_K。 architecture behav of rjy4600_PS2_K is signal ps2clk_r : std_logic_vector(2 downto 0)。 signal ps2clkfall : std_logic。 signal q : std_logic_vector(11 downto 0)。 signal ps2serialdata : std_logic_vector(10 downto 0)。 begin process(sysclk,reset) begin if reset=39。 039。 then ps2clk_r = 000。 elsif rising_edge(sysclk) then ps2clk_r(2) = ps2clk_r(1)。 ps2clk_r(1) = ps2clk_r(0)。 ps2clk_r(0) = ps2clk。 end if。 end process。 ps2clkfall=39。 139。 when ps2clk_r=110 else 39。 039。 process(sysclk) begin if rising_edge(sysclk) then if reset=39。 039。 then q = (others =39。 039。 )。 elsif ps2clkfall=39。 139。 then if q(0)=39。 039。 then q = ps2data amp。 01111111111。 else q = ps2data amp。 q(11 downto 1)。 end if。 end if。 end if。 end process。 process(q) begin if q(0) = 39。 039。 then ps2serialdata = q(11 downto 1)。 led = not ps2serialdata(8 downto 1)。 else led =11111111。 end if。 end process。 end behav。 rjy4600_tone_rom1: — 音符查表及简谱产生 library ieee。 use。 use。 use。 entity rjy4600_tone_rom1 is port(index:in std_logic_vector(7 downto 0)。 index1:in std_logic_vector(3 downto 0)。 c_g:in std_logic。 play_elec:in std_logic。 code:out std_logic_vector(3 downto 0)。 high1:out std_logic_vector(3 downto 0)。 tone:out std_logic_vector(10 downto 0))。 end rjy4600_tone_rom1。 architecture rtl of rjy4600_tone_rom1 is signal index0:integer range 0 to 255。 signal tone1:integer range 0 to 167ff。 signal code1:integer range 0 to 15。 begin tone=conv_std_logic_vector(tone1,11)。 code=conv_std_logic_vector(code1,4)。 search:process(index) begin index0=conv_integer(index1)。 if play_elec=39。 039。 then if c_g=39。 139。 then case index is when 10000010=tone1=2047。 code1=0。 high1=0000。 9null when 10001000=tone1=137。 code1=1。 high1=0000。 num lock when 10110101=tone1=345。 code1=2。 high1=0000。 / when 10000011=tone1=531。 code1=3。 high1=0000。 * when 10000100=tone1=616。 code1=4。 high1=0000。 when 10010011=tone1=772。 code1=5。 high1=0000。 7 when 10001010=tone1=912。 code1=6。 high1=0000。 8 when 10000110=tone1=1035。 code1=7。 high1=0000。 + when 10010100=tone1=1092。 code1=1。 high1=0001。 4 when 10001100=tone1=1197。 code1=2。 high1=0001。 5 when 10001011=tone1=1290。 code1=3。 high1=0001。 6 when 10010110=tone1=1332。 code1=4。 high1=0001。 1 when 10001101=tone1=1410。 code1=5。 high1=0001。 2 when 10000101=tone1=1480。 code1=6。 high1=0001。 3 when 10100101=tone1=1542。 code1=7。 high1=0001。 enter when 10001111=tone1=1570。 code1=1。 high1=0010。 0 when 10011001=tone1=1622。 code1=2。 high1=0010。 back space when 10001110=tone1=1669。 code1=3。 high1=0010。 when others=null。 end case。 else case index is when 10000010=tone1=2047。 code1=0。 high1=0000。 9null when 10001000=tone1=773。 code1=1。 high1=0000。 num lock when 10110101=tone1=912。 code1=2。 high1=0000。 / when 10000011=tone1=1036。 code1=3。 high1=0000。 * when 10000100=tone1=1092。 code1=4。 high1=0000。 when 10010011=tone1=1197。 code1=5。 high1=0000。 7 when 10001010=tone1=1290。 code1=6。 high1=0000。 8 when 10000110=tone1=1372。 code1=7。 high1=0000。 + when 10010100=tone1=1410。 code1=1。 high1=0001。 4 when 10001100=tone1=1480。 code1=2。 high1=0001。 5 when 10001011=tone1=1542。 code1=3。 high1=0001。 6 when 10010110=tone1=1570。 code1=4。 high1=0001。 1 when 10001101=tone1=1622。 code1=5。 high1=0001。 2 when 10000101=tone1=1669。 code1=6。 high1=0001。 3 when 10100101=tone。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。