Line 27... |
Line 27... |
--
|
--
|
-- Revision History
|
-- Revision History
|
-- Author Date Change
|
-- Author Date Change
|
------------------ -------- ---------------------------------------------------
|
------------------ -------- ---------------------------------------------------
|
-- Seth Henry 01/22/20 Design Start
|
-- Seth Henry 01/22/20 Design Start
|
|
-- Seth Henry 04/16/20 Modified to use Open8 bus record
|
|
|
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 39... |
Line 40... |
library work;
|
library work;
|
use work.open8_pkg.all;
|
use work.open8_pkg.all;
|
|
|
entity o8_max7221 is
|
entity o8_max7221 is
|
generic(
|
generic(
|
Bit_Rate : real := 5000000.0;
|
Bitclock_Frequency : real := 5000000.0;
|
Sys_Freq : real;
|
Clock_Frequency : real;
|
Reset_Level : std_logic;
|
|
Address : ADDRESS_TYPE
|
Address : ADDRESS_TYPE
|
);
|
);
|
port(
|
port(
|
Clock : in std_logic;
|
|
Reset : in std_logic;
|
|
--
|
|
Open8_Bus : in OPEN8_BUS_TYPE;
|
Open8_Bus : in OPEN8_BUS_TYPE;
|
--
|
--
|
Mx_Data : out std_logic;
|
Mx_Data : out std_logic;
|
Mx_Clock : out std_logic;
|
Mx_Clock : out std_logic;
|
MX_LDCSn : out std_logic
|
MX_LDCSn : out std_logic
|
);
|
);
|
end entity;
|
end entity;
|
|
|
architecture behave of o8_max7221 is
|
architecture behave of o8_max7221 is
|
|
|
|
alias Clock is Open8_Bus.Clock;
|
|
alias Reset is Open8_Bus.Reset;
|
|
|
signal FIFO_Reset : std_logic;
|
signal FIFO_Reset : std_logic;
|
|
|
constant User_Addr : std_logic_vector(15 downto 4) :=
|
constant User_Addr : std_logic_vector(15 downto 4) :=
|
Address(15 downto 4);
|
Address(15 downto 4);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 4);
|
alias Comp_Addr is Open8_Bus.Address(15 downto 4);
|
Line 77... |
Line 77... |
signal TX_Ctrl : TX_CTRL_STATES;
|
signal TX_Ctrl : TX_CTRL_STATES;
|
|
|
signal TX_En : std_logic;
|
signal TX_En : std_logic;
|
signal TX_Idle : std_logic;
|
signal TX_Idle : std_logic;
|
|
|
constant BAUD_DLY_VAL : integer := integer((Sys_Freq / Bit_Rate)/ 2.0);
|
constant BAUD_DLY_RATIO : real := (Clock_Frequency / Bitclock_Frequency);
|
|
constant BAUD_DLY_VAL : integer := integer(BAUD_DLY_RATIO * 0.5);
|
constant BAUD_DLY_WDT : integer := ceil_log2(BAUD_DLY_VAL - 1);
|
constant BAUD_DLY_WDT : integer := ceil_log2(BAUD_DLY_VAL - 1);
|
constant BAUD_DLY : std_logic_vector :=
|
constant BAUD_DLY : std_logic_vector :=
|
conv_std_logic_vector(BAUD_DLY_VAL - 1, BAUD_DLY_WDT);
|
conv_std_logic_vector(BAUD_DLY_VAL - 1, BAUD_DLY_WDT);
|
|
|
signal Baud_Cntr : std_logic_vector( BAUD_DLY_WDT - 1 downto 0 )
|
signal Baud_Cntr : std_logic_vector( BAUD_DLY_WDT - 1 downto 0 )
|