Line 44... |
Line 44... |
-- Seth Henry 12/19/19 Renamed Tmr_Out to Interrupt
|
-- Seth Henry 12/19/19 Renamed Tmr_Out to Interrupt
|
-- Seth Henry 04/09/20 Modified timer update logic to reset the timer on
|
-- Seth Henry 04/09/20 Modified timer update logic to reset the timer on
|
-- interval write.
|
-- interval write.
|
-- Seth Henry 04/16/20 Modified to use Open8 bus record
|
-- Seth Henry 04/16/20 Modified to use Open8 bus record
|
-- Seth Henry 04/17/20 Altered interval to be a 24-bit counter
|
-- Seth Henry 04/17/20 Altered interval to be a 24-bit counter
|
|
-- 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;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
Line 60... |
Line 61... |
generic(
|
generic(
|
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;
|
Interrupt : out std_logic
|
Interrupt : out std_logic
|
);
|
);
|
end entity;
|
end entity;
|
|
|
Line 74... |
Line 76... |
alias uSec_Tick is Open8_Bus.uSec_Tick;
|
alias uSec_Tick is Open8_Bus.uSec_Tick;
|
|
|
constant User_Addr : std_logic_vector(15 downto 2) :=
|
constant User_Addr : std_logic_vector(15 downto 2) :=
|
Address(15 downto 2);
|
Address(15 downto 2);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 2);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 2);
|
alias Reg_Addr is Open8_Bus.Address(1 downto 0);
|
|
|
|
signal Addr_Match : std_logic := '0';
|
signal Addr_Match : std_logic := '0';
|
signal Reg_Sel : std_logic_vector(1 downto 0) := "00";
|
|
signal Wr_En : std_logic := '0';
|
alias Reg_Sel_d is Open8_Bus.Address(1 downto 0);
|
|
signal Reg_Sel_q : std_logic_vector(1 downto 0) := "00";
|
|
signal Wr_En_d : std_logic;
|
|
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 Rd_En_q : std_logic := '0';
|
|
|
signal Req_Interval : std_logic_vector(23 downto 0) := x"000000";
|
signal Req_Interval : std_logic_vector(23 downto 0) := x"000000";
|
alias Req_Interval_B0 is Req_Interval( 7 downto 0);
|
alias Req_Interval_B0 is Req_Interval( 7 downto 0);
|
alias Req_Interval_B1 is Req_Interval(15 downto 8);
|
alias Req_Interval_B1 is Req_Interval(15 downto 8);
|
Line 98... |
Line 102... |
signal Timer_Cnt : std_logic_vector(23 downto 0) := x"000000";
|
signal Timer_Cnt : std_logic_vector(23 downto 0) := x"000000";
|
|
|
begin
|
begin
|
|
|
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
|
Addr_Match <= '1' when Comp_Addr = User_Addr else '0';
|
|
Wr_En_d <= Addr_Match and Open8_Bus.Wr_En;
|
|
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 <= "00";
|
Reg_Sel_q <= "00";
|
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;
|
Req_Interval <= x"000000";
|
Req_Interval <= x"000000";
|
Update_Interval <= '0';
|
Update_Interval <= '0';
|
Update_Pending <= '0';
|
Update_Pending <= '0';
|
Output_Enable <= '0';
|
Output_Enable <= '0';
|
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_En_q <= Wr_En_d;
|
Wr_Data_q <= Open8_Bus.Wr_Data;
|
Wr_Data_q <= Wr_Data_d;
|
Update_Interval <= '0';
|
Update_Interval <= '0';
|
if( Wr_En = '1' )then
|
if( Wr_En_q = '1' and Write_Qual = '1' )then
|
case( Reg_Sel )is
|
case( Reg_Sel_q )is
|
when "00" =>
|
when "00" =>
|
Req_Interval_B0 <= Wr_Data_q;
|
Req_Interval_B0 <= Wr_Data_q;
|
Update_Pending <= '1';
|
Update_Pending <= '1';
|
when "01" =>
|
when "01" =>
|
Req_Interval_B1 <= Wr_Data_q;
|
Req_Interval_B1 <= Wr_Data_q;
|
Line 140... |
Line 146... |
if( Update_Interval = '1' )then
|
if( Update_Interval = '1' )then
|
Update_Pending <= '0';
|
Update_Pending <= '0';
|
end if;
|
end if;
|
|
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_Data <= OPEN8_NULLBUS;
|
Rd_En <= Addr_Match and Open8_Bus.Rd_En;
|
Rd_En_q <= Rd_En_d;
|
if( Rd_En = '1' )then
|
if( Rd_En_q = '1' )then
|
case( Reg_Sel )is
|
case( Reg_Sel_q )is
|
when "00" =>
|
when "00" =>
|
Rd_Data <= Req_Interval_B0;
|
Rd_Data <= Req_Interval_B0;
|
when "01" =>
|
when "01" =>
|
Rd_Data <= Req_Interval_B1;
|
Rd_Data <= Req_Interval_B1;
|
when "10" =>
|
when "10" =>
|