Line 73... |
Line 73... |
|
|
constant Divide_SCLK_by_2 : boolean := (Clock_Frequency > 96000000.0);
|
constant Divide_SCLK_by_2 : boolean := (Clock_Frequency > 96000000.0);
|
|
|
constant User_Addr : std_logic_vector(15 downto 3) := Address(15 downto 3);
|
constant User_Addr : std_logic_vector(15 downto 3) := Address(15 downto 3);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 3);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 3);
|
alias Reg_Sel is Open8_Bus.Address(2 downto 0);
|
|
signal Reg_Sel_q : std_logic_vector(2 downto 0);
|
|
signal Wr_Data_q : DATA_TYPE;
|
|
signal Addr_Match : std_logic;
|
signal Addr_Match : std_logic;
|
signal Wr_En : std_logic;
|
alias Reg_Sel_d is Open8_Bus.Address(2 downto 0);
|
signal Rd_En : std_logic;
|
signal Reg_Sel_q : std_logic_vector(2 downto 0);
|
signal User_In : DATA_TYPE;
|
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 Rd_En_d : std_logic := '0';
|
|
signal Rd_En_q : std_logic := '0';
|
|
|
signal User_Trig : std_logic;
|
signal User_Trig : std_logic;
|
|
|
signal Timer_Int : DATA_TYPE;
|
signal Timer_Int : DATA_TYPE;
|
signal Timer_Cnt : DATA_TYPE;
|
signal Timer_Cnt : DATA_TYPE;
|
Line 102... |
Line 104... |
signal ADC2_Data : std_logic_vector(13 downto 0);
|
signal ADC2_Data : std_logic_vector(13 downto 0);
|
signal ADC_Ready : std_logic;
|
signal ADC_Ready : std_logic;
|
begin
|
begin
|
|
|
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
|
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
|
|
Rd_En_d <= Addr_Match and Open8_Bus.Rd_En;
|
|
|
io_reg: process( Clock, Reset )
|
io_reg: process( Clock, Reset )
|
begin
|
begin
|
if( Reset = Reset_Level )then
|
if( Reset = Reset_Level )then
|
Reg_Sel_q <= (others => '0');
|
Reg_Sel_q <= "000";
|
|
Wr_En_q <= '0';
|
Wr_Data_q <= x"00";
|
Wr_Data_q <= x"00";
|
Wr_En <= '0';
|
Rd_En_q <= '0';
|
Rd_En <= '0';
|
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_Data <= OPEN8_NULLBUS;
|
|
|
User_Trig <= '0';
|
User_Trig <= '0';
|
Timer_Int <= x"00";
|
Timer_Int <= x"00";
|
elsif( rising_edge( Clock ) )then
|
elsif( rising_edge( Clock ) )then
|
Reg_Sel_q <= Reg_Sel;
|
Reg_Sel_q <= Reg_Sel_d;
|
Wr_Data_q <= Open8_Bus.Wr_Data;
|
|
Wr_En <= Addr_Match and Open8_Bus.Wr_En;
|
Wr_En_q <= Wr_En_d;
|
|
Wr_Data_q <= Wr_Data_d;
|
|
|
User_Trig <= '0';
|
User_Trig <= '0';
|
if( Wr_En = '1' )then
|
if( Wr_En_q = '1' )then
|
if( Reg_Sel_q = "110" )then
|
if( Reg_Sel_q = "110" )then
|
Timer_Int <= Wr_Data_q;
|
Timer_Int <= Wr_Data_q;
|
end if;
|
end if;
|
if( Reg_Sel_q = "111" )then
|
if( Reg_Sel_q = "111" )then
|
User_Trig <= '1';
|
User_Trig <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
|
|
Rd_En <= Addr_Match and Open8_Bus.Rd_En;
|
Rd_En_q <= Rd_En_d;
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_Data <= OPEN8_NULLBUS;
|
|
if( Rd_En_q = '1' )then
|
if( Rd_En = '1' )then
|
|
case( Reg_Sel_q )is
|
case( Reg_Sel_q )is
|
-- Channel 1, Full resolution, lower byte
|
-- Channel 1, Full resolution, lower byte
|
when "000" =>
|
when "000" =>
|
Rd_Data <= ADC1_Data(7 downto 0);
|
Rd_Data <= ADC1_Data(7 downto 0);
|
-- Channel 1, Full resolution, upper byte
|
-- Channel 1, Full resolution, upper byte
|