-- $HDR$-- --+++++++++-- --Source Archived-- --Version in Repository:-- -- $Log: 25083: Balloon_samosa.vhd -- -- Rev 1.2 3/13/2008 8:09:36 PM David -- First draft (Compiles) of SAMOSA interface -- --+++++++++-- ---------------------------------------------------------------------------------- -- Company: iTechnic Ltd -- Engineer: D L Bisset -- -- Create Date: 14:56:23 07/04/2006 -- Design Name: -- Module Name: Balloon_samosa - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: Provides an Interface to the SAMOSA Connector on Balloon 3 -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: 0v01 skeleton version, some logic analyser feed throughs to connector. -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity Balloon_samosa is port ( data_bus_in : in std_logic_vector (15 downto 0); data_bus_out : out std_logic_vector (15 downto 0); reg_add : in std_logic_vector (2 downto 0); --a23..a21 selects SAMOSA control Latches cpu_nwe : in std_logic; cpu_noe : in std_logic; samosa_select : in std_logic; park_IO : in std_logic; nreset : in std_logic; samosa_reset_in : in std_logic; irq_out : out std_logic; samosa_irq : in std_logic; samosa_absent: in std_logic; samosa_nre : out std_logic; samosa_nwe : out std_logic; samosa_cle : out std_logic; samosa_ale : out std_logic; samosa_nce : out std_logic; samosa_nwp : out std_logic; samosa_reset_out : out std_logic; samosa_skt_data : inout std_logic_vector(15 downto 0) ); end Balloon_samosa; architecture Behavioral of Balloon_samosa is constant ADDRESS_PORT : std_logic_vector(2 downto 0):= "000"; constant DATA_PORT : std_logic_vector(2 downto 0):= "001"; constant STATUS_PORT : std_logic_vector(2 downto 0):= "111"; signal address_port_select : std_logic; signal data_port_select : std_logic; signal samosa_active : std_logic; signal samosa_external_active : std_logic; signal nre_out : std_logic; signal nwe_out : std_logic; signal ale_out : std_logic; signal nce_out : std_logic; signal cle_out : std_logic; signal nwp_out : std_logic; signal samosa_status : std_logic_vector (7 downto 0); signal internal_data_out : std_logic_vector(15 downto 0); begin --SAMOSA Interface --The address decodes correspond to writing an address, writing and reading data. --It is assumed that the far end can keep up with Loon3 bus signal timings --NOte that this may worsen EMC performance and latches might be needed to slow the bus. samosa_reset_out <= nreset; --Port selects samosa_active <= '1' when (samosa_select = '1') and (park_IO = '0') else '0'; address_port_select <= '1' when (samosa_active = '1') and (reg_add = ADDRESS_PORT) else '0'; data_port_select <= '1' when (samosa_active = '1') and (reg_add = DATA_PORT) else '0'; samosa_external_active <= '1' when (address_port_select = '1') or (data_port_select = '1') else '0'; --Create Socket IO signals --This assumes we do not use the command port just the address and data ports. nre_out <= '0' when (samosa_active = '1') and (cpu_noe = '0') else '1'; nwe_out <= '0' when (samosa_active = '1') and (cpu_nwe = '0') else '1'; ale_out <= '1' when (address_port_select = '1') else '0'; nce_out <= not samosa_external_active; cle_out <= '0'; --We don't use the command write. nwp_out <= '1'; --High enables writing will be shut down by park_IO. --Park the IO bits to the SAMOSA bus samosa_nre <= nre_out when (park_IO = '0') else '0'; samosa_nwe <= nwe_out when (park_IO = '0') else '0'; samosa_ale <= ale_out when (park_IO = '0') else '0'; samosa_nce <= nce_out when (park_IO = '0') else '0'; samosa_cle <= cle_out when (park_IO = '0') else '0'; samosa_nwp <= nwp_out when (park_IO = '0') else '0'; --set the status word samosa_status <= samosa_irq & "000000" & samosa_absent; --Mux the internal data sources, note it is possible to add a SAMOSA bus version on reading from ADDRESS with reg_add select internal_data_out <= samosa_skt_data when DATA_PORT, X"0000" when ADDRESS_PORT, X"00" & samosa_status when STATUS_PORT, X"0000" when others; samosa_skt_data <= data_bus_in when (samosa_external_active = '1') and (nwe_out = '0') else "ZZZZZZZZZZZZZZZZ"; data_bus_out <= internal_data_out when (samosa_active = '1') else "ZZZZZZZZZZZZZZZZ"; end Behavioral;