⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rs232lan_vhl.vhdl

📁 CPLD 9536 程序 我自己用的代码. VHDL语言
💻 VHDL
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

--  Uncomment the following lines to use the declarations that are
--  provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;

entity rs232lan_vhl is
    Port ( cs4 : out std_logic;
           cs1 : out std_logic;
           irqcom4 : in std_logic;
           irqcom1 : in std_logic;
           irq5 : out std_logic;
           irq7 : out std_logic;
           irq10 : out std_logic;
           irq11 : out std_logic;
           irq12 : out std_logic;
           irq15 : out std_logic;
           doc_cs : out std_logic;
           aen : in std_logic;
           smemw : in std_logic;
           smemr : in std_logic;
           iow : in std_logic;
           ior : in std_logic;
           sa19 : in std_logic;
           sa18 : in std_logic;
           sa17 : in std_logic;
           sa16 : in std_logic;
           sa15 : in std_logic;
           sa14 : in std_logic;
           sa13 : in std_logic;
           sa9 : in std_logic;
           sa8 : in std_logic;
           sa7 : in std_logic;
           sa6 : in std_logic;
           sa5 : in std_logic;
           sa4 : in std_logic;
           sa3 : in std_logic;
           irqcom3 : in std_logic;
           cs3 : out std_logic;
           irqcom2 : in std_logic;
           cs2 : out std_logic);
end rs232lan_vhl;

architecture Behavioral of rs232lan_vhl is

begin

--4个串口选通
--0x3f0--COMA
cs1<=not((not aen) and sa9 and sa8 and sa7 and sa6 and sa5 and sa4 and (not sa3) and ((not iow) or (not ior)));
--0x3e0--COMB
cs2<=not((not aen) and sa9 and sa8 and sa7 and sa6 and sa5 and (not sa4) and (not sa3) and ((not iow) or (not ior)));
--0x2f0--COMC
cs3<=not((not aen) and sa9 and (not sa8) and sa7 and sa6 and sa5 and sa4 and (not sa3) and ((not iow) or (not ior)));
--0x2e0--COMD
cs4<=not((not aen) and sa9 and (not sa8) and sa7 and sa6 and sa5 and (not sa4) and (not sa3) and ((not iow) or (not ior)));
--4个串口中断输出
--COMA--IRQ5
irq5 <=irqcom1;
--COMB--IRQ7
irq7 <=irqcom2;
--COMC--IRQ11
irq10<=irqcom3;
--COMD--IRQ12
irq11<=irqcom4;

--DOC的选择,段地址:0xDC00,也不允许smemw,smemr同时为低-防干扰!
doc_cs<=not( (not aen) and sa19 and sa18 and (not sa17) and sa16 and sa15 
           and sa14 and (not sa13) and ((not smemr) or (not smemw))
	      );
--下面语句也可测试以下!
--doc<=not( (not aen) and sa19 and sa18 and (not sa17) and (not sa16) and sa15 
--           and (not sa14) and (not sa13) 
--	    );

--irq15被LAN所用,将其置为高阻抗
irq15<='Z';
--irq12不用,将其置为高阻抗,可被LAN所用
irq12<='Z';

end Behavioral;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -