Board logo

标题: 各位大哥看看这个cpld程序怎么编译通不过 [打印本页]

作者: cdwlin    时间: 2006-10-25 09:28     标题: 各位大哥看看这个cpld程序怎么编译通不过

希望各位能看看:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity cn8900 is port ( ngcs3,noe,nwe,a24,ngcs5,ngcs4,clk : in std_logic; memr,memw : out std_logic; reset : out std_logic; nreset : in std_logic; ngcs2 :in std_logic; addr : in std_logic_vector( 7 downto 0); data : inout std_logic_vector(7 downto 0); ior,iow : out std_logic; dirnwe,dirngcs2ut std_logic; a23 : in std_logic; ionwe,ionoe,eint15 : out std_logic; pc104memr,pc104memw : out std_logic; col : in std_logic_vector( 7 downto 0); row : out std_logic_vector( 7 downto 0)); end cn8900; architecture wlin of cn8900 is signal sel1,sel2,key_val : std_logic; signal reg1 : std_logic_vector(7 downto 0); signal clkfrq : std_logic; signal cntscn : std_logic_vector(3 downto 0); signal scnlin : std_logic_vector(7 downto 0); signal cntfrq : std_logic_vector(14 downto 0); signal lednum : std_logic_vector(15 downto 0); signal leds : std_logic_vector(7 downto 0); begin ----------------cs8900 io/mem逻辑电路----------------- con_pro : process(noe,nwe) begin ior<=(noe or not(a24)); iow<=(nwe or not(a24)); memr<=noe or a24 or ngcs3; memw<=nwe or a24 or ngcs3; reset<=not(nreset); end process; --------------pc104接口部分的io/mem逻辑电路------------- IO_MEM : process(a23,noe,nwe) begin ionwe<=(nwe or a23); ionoe<=(noe or a23); pc104memr<=(noe or not(a23)); pc104memw<=(nwe or not(a23)); dirnwe<=nwe; dirngcs2<=ngcs2; if (ngcs4='0' and addr="00001100" and a23='0') then key_val<='1'; else key_val<='0'; end if; end process; -- ----------------------下面为键盘扫描程序---------------------- shaomiao : process(nreset,clk,clkfrq) -- 晶振为50MHz,进行25000分频产生扫描时钟(1000Hz) begin if nreset = '0' then clkfrq <= '0'; cntfrq <= (others=>'0'); elsif clk'event and clk = '1' then if cntfrq = "110000110101000" then --if cntfrq = "1111" then cntfrq <= (others => '0'); clkfrq <= not clkfrq; else cntfrq <= cntfrq + 1; end if; end if; end process; hang: process(nreset,clkfrq) -- 根据扫描时钟产生扫描线 begin if nreset = '0' then cntscn <= "0000"; elsif clkfrq'event and clkfrq = '1' then if cntscn = "1000" then cntscn <= "0000"; else cntscn <= cntscn+1; end if; case cntscn is when "0000" => scnlin <= "00000001"; when "0001" => scnlin <= "00000010"; when "0010" => scnlin <= "00000100"; when "0011" => scnlin <= "00001000"; when "0100" => scnlin <= "00010000"; when "0101" => scnlin <= "00100000"; when "0110" => scnlin <= "01000000"; when "1000" => scnlin <= "10000000"; when others => null; end case; end if; end process; process(nreset, clkfrq) -- 根据按键点亮相应的leds begin if(nreset = '0' ) then leds <= "11111111"; elsif clkfrq'event and clkfrq = '0' then case lednum is when "0000000100000001" => leds <= "00000000"; when "0000000100000010" => leds <= "00000001"; when "0000000100000100" => leds <= "00000010"; when "0000000100001000" => leds <= "00000011"; when "0000000100010000" => leds <= "00000100"; when "0000000100100000" => leds <= "00000101"; when "0000000101000000" => leds <= "00000110"; when "0000000110000000" => leds <= "00000111"; when "0000001000000001" => leds <= "00001000"; when "0000001000000010" => leds <= "00001001"; when "0000001000000100" => leds <= "00001010"; when "0000001000001000" => leds <= "00001011"; when "0000001000010000" => leds <= "00001100"; when "0000001000100000" => leds <= "00001101"; when "0000001001000000" => leds <= "00001110"; when "0000001010000000" => leds <= "00001111"; when "0000010000000001" => leds <= "00010000"; when "0000010000000010" => leds <= "00010001"; when "0000010000000100" => leds <= "00010010"; when "0000010000001000" => leds <= "00010011"; when "0000010000010000" => leds <= "00010100"; when "0000010000100000" => leds <= "00010101"; when "0000010001000000" => leds <= "00010110"; when "0000010010000000" => leds <= "00010111"; when "0000100000000001" => leds <= "00011000"; when "0000100000000010" => leds <= "00011001"; when "0000100000000100" => leds <= "00011010"; when "0000100000001000" => leds <= "00011011"; when "0000100000010000" => leds <= "00011100"; when "0000100000100000" => leds <= "00011101"; when "0000100001000000" => leds <= "00011110"; when "0000100010000000" => leds <= "00011111"; when "0001000000000001" => leds <= "00100000"; when "0001000000000010" => leds <= "00100001"; when "0001000000000100" => leds <= "00100010"; when "0001000000001000" => leds <= "00100011"; when "0001000000010000" => leds <= "00100100"; when "0001000000100000" => leds <= "00100101"; when "0001000001000000" => leds <= "00100110"; when "0001000010000000" => leds <= "00100111"; when "0010000000000001" => leds <= "00101000"; when "0010000000000010" => leds <= "00101001"; when "0010000000000100" => leds <= "00101010"; when "0010000000001000" => leds <= "00101011"; when "0010000000010000" => leds <= "00101100"; when "0010000000100000" => leds <= "00101101"; when "0010000001000000" => leds <= "00101110"; when "0010000010000000" => leds <= "00101111"; when "0100000000000001" => leds <= "00110000"; when "0100000000000010" => leds <= "00110001"; when "0100000000000100" => leds <= "00110010"; when "0100000000001000" => leds <= "00110011"; when "0100000000010000" => leds <= "00110100"; when "0100000000100000" => leds <= "00110101"; when "0100000001000000" => leds <= "00110110"; when "0100000010000000" => leds <= "00110111"; when "1000000000000001" => leds <= "00111000"; when "1000000000000010" => leds <= "00111001"; when "1000000000000100" => leds <= "00111010"; when "1000000000001000" => leds <= "00111011"; when "1000000000010000" => leds <= "00111100"; when "1000000000100000" => leds <= "00111101"; when "1000000001000000" => leds <= "00111110"; when "1000000010000000" => leds <= "00111111"; when others => null; end case; end if; end process; -------读键盘的值 -------------------- row <= scnlin; lednum <= scnlin&col; data<=leds when noe='0' and key_val='1' else "ZZZZZZZZ"; end wlin;

[此贴子已经被作者于2006-10-25 9:29:57编辑过]


作者: kzw    时间: 2006-10-26 10:46

这个样子太难看了吧
作者: anotherchen    时间: 2006-10-27 11:45

为什么要这样发
作者: feng2003    时间: 2006-10-27 20:59

这让人怎么看啊




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0