OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_max7221.vhd] - Diff between revs 224 and 244

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 224 Rev 244
Line 28... Line 28...
-- 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
-- Seth Henry      04/16/20 Modified to use 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;
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 46... Line 47...
  Clock_Frequency            : real;
  Clock_Frequency            : real;
  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';
  --
  --
  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
);
);
Line 63... Line 65...
  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);
 
  signal Addr_Match          : std_logic := '0';
 
 
  signal FIFO_Wr_En          : std_logic;
  signal FIFO_Wr_En          : std_logic := '0';
  signal FIFO_Wr_Data        : std_logic_vector(11 downto 0);
  signal FIFO_Wr_Data        : std_logic_vector(11 downto 0) :=
 
                                (others => '0');
  signal FIFO_Rd_En          : std_logic;
 
  signal FIFO_Empty          : std_logic;
  signal FIFO_Rd_En          : std_logic := '0';
  signal FIFO_Rd_Data        : std_logic_vector(11 downto 0);
  signal FIFO_Empty          : std_logic := '0';
 
  signal FIFO_Rd_Data        : std_logic_vector(11 downto 0) :=
 
                                (others => '0');
 
 
  type TX_CTRL_STATES is (IDLE, TX_BYTE, TX_START, TX_WAIT );
  type TX_CTRL_STATES is (IDLE, TX_BYTE, TX_START, TX_WAIT );
  signal TX_Ctrl             : TX_CTRL_STATES;
  signal TX_Ctrl             : TX_CTRL_STATES := IDLE;
 
 
  signal TX_En               : std_logic;
  signal TX_En               : std_logic := '0';
  signal TX_Idle             : std_logic;
  signal TX_Idle             : std_logic := '0';
 
 
  constant BAUD_DLY_RATIO    : real := (Clock_Frequency / Bitclock_Frequency);
  constant BAUD_DLY_RATIO    : real := (Clock_Frequency / Bitclock_Frequency);
  constant BAUD_DLY_VAL      : integer := integer(BAUD_DLY_RATIO * 0.5);
  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 )
                               := (others => '0');
                               := (others => '0');
  signal Baud_Tick           : std_logic;
  signal Baud_Tick           : std_logic := '0';
 
 
  type IO_STATES is ( IDLE, SYNC_CLK, SCLK_L, SCLK_H, ADV_BIT, DONE );
  type IO_STATES is ( IDLE, SYNC_CLK, SCLK_L, SCLK_H, ADV_BIT, DONE );
  signal io_state            : IO_STATES;
  signal io_state            : IO_STATES := IDLE;
  signal bit_cntr            : std_logic_vector(3 downto 0);
  signal bit_cntr            : std_logic_vector(3 downto 0) := (others => '0');
  signal tx_buffer           : std_logic_vector(15 downto 0);
  signal tx_buffer           : std_logic_vector(15 downto 0) :=
 
                                (others => '0');
 
 
begin
begin
 
 
  FIFO_Wr_En                 <= Open8_Bus.Wr_En when Comp_Addr = User_Addr else
  Addr_Match                 <= '1' when Comp_Addr = User_Addr else '0';
                                '0';
 
 
  FIFO_Wr_En                 <= Addr_Match and Open8_Bus.Wr_En and Write_Qual;
 
 
  FIFO_Wr_Data               <= Open8_Bus.Address(3 downto 0) &
  FIFO_Wr_Data               <= Open8_Bus.Address(3 downto 0) &
                                Open8_Bus.Wr_Data;
                                Open8_Bus.Wr_Data;
 
 
  FIFO_Reset                 <= Reset when Reset_Level = '1' else (not Reset);
  FIFO_Reset                 <= Reset when Reset_Level = '1' else (not Reset);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.