Line 38... |
Line 38... |
------------------ -------- ---------------------------------------------------
|
------------------ -------- ---------------------------------------------------
|
-- Seth Henry 07/28/11 Design Start
|
-- Seth Henry 07/28/11 Design Start
|
-- Seth Henry 12/19/19 Renamed to "o8_gpout" to fit "theme"
|
-- Seth Henry 12/19/19 Renamed to "o8_gpout" to fit "theme"
|
-- Seth Henry 04/10/20 Code Cleanup and comments
|
-- Seth Henry 04/10/20 Code Cleanup and comments
|
-- Seth Henry 04/16/20 Modified to make use of Open8 bus record
|
-- Seth Henry 04/16/20 Modified to make use of Open8 bus record
|
|
-- Seth Henry 05/18/20 Added write qualification input
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
|
library work;
|
library work;
|
Line 54... |
Line 55... |
Disable_Tristate : boolean := false;
|
Disable_Tristate : boolean := false;
|
Address : ADDRESS_TYPE
|
Address : ADDRESS_TYPE
|
);
|
);
|
port(
|
port(
|
Open8_Bus : in OPEN8_BUS_TYPE;
|
Open8_Bus : in OPEN8_BUS_TYPE;
|
|
Write_Qual : in std_logic := '1';
|
Rd_Data : out DATA_TYPE;
|
Rd_Data : out DATA_TYPE;
|
--
|
--
|
GPO : out DATA_TYPE
|
GPO : out DATA_TYPE
|
);
|
);
|
end entity;
|
end entity;
|
Line 68... |
Line 70... |
alias Reset is Open8_Bus.Reset;
|
alias Reset is Open8_Bus.Reset;
|
|
|
constant User_Addr : std_logic_vector(15 downto 1)
|
constant User_Addr : std_logic_vector(15 downto 1)
|
:= Address(15 downto 1);
|
:= Address(15 downto 1);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 1);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 1);
|
alias Reg_Addr is Open8_Bus.Address(0);
|
|
signal Reg_Sel : std_logic := '0';
|
|
signal Addr_Match : std_logic := '0';
|
signal Addr_Match : std_logic := '0';
|
signal Wr_En : std_logic := '0';
|
alias Reg_Sel_d is Open8_Bus.Address(0);
|
|
signal Reg_Sel_q : std_logic := '0';
|
|
signal Wr_En_d : std_logic := '0';
|
|
signal Wr_En_q : std_logic := '0';
|
|
alias Wr_Data_d is Open8_Bus.Wr_Data;
|
signal Wr_Data_q : DATA_TYPE := x"00";
|
signal Wr_Data_q : DATA_TYPE := x"00";
|
signal Rd_En : std_logic := '0';
|
signal Rd_En_d : std_logic := '0';
|
|
signal Rd_En_q : std_logic := '0';
|
|
|
signal User_Out : DATA_TYPE := x"00";
|
signal User_Out : DATA_TYPE := x"00";
|
signal User_En : DATA_TYPE := x"00";
|
signal User_En : DATA_TYPE := x"00";
|
|
|
begin
|
begin
|
Line 85... |
Line 90... |
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
|
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
|
|
|
io_reg: process( Clock, Reset )
|
io_reg: process( Clock, Reset )
|
begin
|
begin
|
if( Reset = Reset_Level )then
|
if( Reset = Reset_Level )then
|
Reg_Sel <= '0';
|
Reg_Sel_q <= '0';
|
Wr_En <= '0';
|
Wr_En_q <= '0';
|
Wr_Data_q <= x"00";
|
Wr_Data_q <= x"00";
|
Rd_En <= '0';
|
Rd_En_q <= '0';
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_Data <= OPEN8_NULLBUS;
|
User_Out <= Default_Out;
|
User_Out <= Default_Out;
|
if( not Disable_Tristate)then
|
if( not Disable_Tristate)then
|
User_En <= Default_En;
|
User_En <= Default_En;
|
end if;
|
end if;
|
elsif( rising_edge( Clock ) )then
|
elsif( rising_edge( Clock ) )then
|
Reg_Sel <= Reg_Addr;
|
Reg_Sel_q <= Reg_Sel_d;
|
Wr_En <= Addr_Match and Open8_Bus.Wr_En;
|
|
Wr_Data_q <= Open8_Bus.Wr_Data;
|
Wr_En_q <= Wr_En_d;
|
if( Wr_En = '1' )then
|
Wr_Data_q <= Wr_Data_d;
|
|
if( Wr_En_q = '1' )then
|
if( Disable_Tristate )then
|
if( Disable_Tristate )then
|
User_Out <= Wr_Data_q;
|
User_Out <= Wr_Data_q;
|
else
|
else
|
if( Reg_Sel = '0' )then
|
if( Reg_Sel_q = '0' )then
|
User_Out <= Wr_Data_q;
|
User_Out <= Wr_Data_q;
|
else
|
else
|
User_En <= Wr_Data_q;
|
User_En <= Wr_Data_q;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
|
Rd_En_q <= Rd_En_d;
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_En <= Addr_Match and Open8_Bus.Rd_En;
|
if( Rd_En_q = '1' )then
|
if( Rd_En = '1' )then
|
|
Rd_Data <= User_Out;
|
Rd_Data <= User_Out;
|
if( (Reg_Sel = '1') and (not Disable_Tristate) )then
|
if( (Reg_Sel_q = '1') and (not Disable_Tristate) )then
|
Rd_Data <= User_En;
|
Rd_Data <= User_En;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|