Подскажите, пожалуйста, куды дальше рыть копать… вот описал 16-bit ISA устройство… заливаю в плис EPM3256 все работает: 1. запись байта по адресу 300 2. чтение байта по адресу 300 3. запись слова по адресу 300 кроме: 4. чтение слова по адресу 300 возвращает байт
VHDL - код library IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.numeric_std.all; USE IEEE.STD_LOGIC_UNSIGNED.ALL; entity ISA_16bit is port( I_ADR : in std_logic_vector (9 downto 0); I_RESET : in std_logic; I_AEN : in std_logic; I_IOW : in std_logic; I_IOR : in std_logic; I_IOCS16 : out std_logic; I_DATA : inout std_logic_vector (15 downto 0); OutPort0 : out std_logic_vector (15 downto 0) ); end ISA_16bit; architecture BEHAVIOR of ISA_16bit is component ISA_16bit port( I_ADR : in std_logic_vector (9 downto 0); I_RESET : in std_logic; I_AEN : in std_logic; I_IOW : in std_logic; I_IOR : in std_logic; I_IOCS16 : out std_logic; I_DATA : inout std_logic_vector (15 downto 0); OutPort0 : out std_logic_vector (15 downto 0) ); end component; CONSTANT BASE : integer := 768; CONSTANT ZST : std_logic_vector (15 downto 0) := "ZZZZZZZZZZZZZZZZ"; CONSTANT NUL : std_logic_vector (15 downto 0) := "0000000000000000"; SIGNAL SelectPort0 : std_logic; SIGNAL InOutPort0 : std_logic_vector (15 downto 0); begin SelectPort0 <= '1' when (conv_integer(I_ADR) = BASE and I_AEN = '0') else '0'; I_IOCS16<='0' when (SelectPort0 = '1') else 'Z'; I_DATA <= InOutPort0 when (SelectPort0 = '1' and I_IOR = '0') else ZST; OutPort0 <= InOutPort0; Write:process (I_IOW,I_RESET) begin if I_IOW'event and I_IOW='1' then if SelectPort0 = '1' then InOutPort0<=I_DATA; end if; end if; if I_RESET='1' then InOutPort0<=NUL; end if; end process Write; end BEHAVIOR;
вот функция работы с портом void cmd (){ int port,dataW,dataR; port=TDATAPORT.PORT; dataW=TDATAPORT.HDATA16; while(!kbhit()) { asm {mov dx,port mov ax,dataW out dx,ax in ax,dx mov dataR,ax } fprintf(stdout,"->0x%X..0x%X",dataW,dataR); } fprintf(stdout,"\n"); }
Сообщение отредактировал 3ABXO3 - Sep 30 2008, 15:03
|