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

Subversion Repositories uart2bus

[/] [uart2bus/] [trunk/] [vhdl/] [rtl/] [uartParser.vhd] - Diff between revs 6 and 11

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

Rev 6 Rev 11
Line 1... Line 1...
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
-- uart parser module  
-- uart parser module  
--
--
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
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;
 
 
entity uartParser is
entity uartParser is
  generic ( -- parameters 
  generic ( -- parameters 
            AW : integer := 8);
            AW : integer := 8);
  port ( -- global signals 
  port ( -- global signals 
Line 17... Line 17...
         rxData     : in  std_logic_vector(7 downto 0);      -- data byte received
         rxData     : in  std_logic_vector(7 downto 0);      -- data byte received
         newRxData  : in  std_logic;                         -- signs that a new byte was received
         newRxData  : in  std_logic;                         -- signs that a new byte was received
         txData     : out std_logic_vector(7 downto 0);      -- data byte to transmit
         txData     : out std_logic_vector(7 downto 0);      -- data byte to transmit
         newTxData  : out std_logic;                         -- asserted to indicate that there is a new data byte for transmission
         newTxData  : out std_logic;                         -- asserted to indicate that there is a new data byte for transmission
         -- internal bus to register file 
         -- internal bus to register file 
 
         intReq     : out std_logic;                         -- 
 
         intGnt     : in  std_logic;                         -- 
         intRdData  : in  std_logic_vector(7 downto 0);      -- data read from register file
         intRdData  : in  std_logic_vector(7 downto 0);      -- data read from register file
         intAddress : out std_logic_vector(AW - 1 downto 0); -- address bus to register file
         intAddress : out std_logic_vector(AW - 1 downto 0); -- address bus to register file
         intWrData  : out std_logic_vector(7 downto 0);      -- write data to register file
         intWrData  : out std_logic_vector(7 downto 0);      -- write data to register file
         intWrite   : out std_logic;                         -- write control to register file
         intWrite   : out std_logic;                         -- write control to register file
         intRead    : out std_logic);                        -- read control to register file
         intRead    : out std_logic);                        -- read control to register file
Line 103... Line 105...
  signal   dataNibble     : std_logic_vector(3 downto 0);       -- data nibble from received character
  signal   dataNibble     : std_logic_vector(3 downto 0);       -- data nibble from received character
  signal   addrParam      : std_logic_vector(15 downto 0);      -- operation address parameter
  signal   addrParam      : std_logic_vector(15 downto 0);      -- operation address parameter
  signal   addrNibble     : std_logic_vector(3 downto 0);       -- data nibble from received character
  signal   addrNibble     : std_logic_vector(3 downto 0);       -- data nibble from received character
  signal   binByteCount   : std_logic_vector(7 downto 0);       -- binary mode byte counter
  signal   binByteCount   : std_logic_vector(7 downto 0);       -- binary mode byte counter
  signal   iIntAddress    : std_logic_vector(intAddress'range); -- 
  signal   iIntAddress    : std_logic_vector(intAddress'range); -- 
 
  signal   iWriteReq      : std_logic;                          -- 
  signal   iIntWrite      : std_logic;                          -- 
  signal   iIntWrite      : std_logic;                          -- 
  signal   readDone       : std_logic;                          -- internally generated read done flag
  signal   readDone       : std_logic;                          -- internally generated read done flag
  signal   readDoneS      : std_logic;                          -- sampled read done
  signal   readDoneS      : std_logic;                          -- sampled read done
  signal   readDataS      : std_logic_vector(7 downto 0);       -- sampled read data
  signal   readDataS      : std_logic_vector(7 downto 0);       -- sampled read data
 
  signal   iReadReq       : std_logic;                          -- 
  signal   iIntRead       : std_logic;                          -- 
  signal   iIntRead       : std_logic;                          -- 
  signal   txChar         : std_logic_vector(7 downto 0);       -- transmit byte from nibble to character conversion
  signal   txChar         : std_logic_vector(7 downto 0);       -- transmit byte from nibble to character conversion
  signal   sTxBusy        : std_logic;                          -- sampled tx_busy for falling edge detection
  signal   sTxBusy        : std_logic;                          -- sampled tx_busy for falling edge detection
  signal   txNibble       : std_logic_vector(3 downto 0);       -- nibble value for transmission
  signal   txNibble       : std_logic_vector(3 downto 0);       -- nibble value for transmission
 
 
Line 354... Line 358...
    -- internal write control and data
    -- internal write control and data
    -- internal read control
    -- internal read control
    process (clr, clk)
    process (clr, clk)
    begin
    begin
      if (clr = '1') then
      if (clr = '1') then
 
        iReadReq <= '0';
        iIntRead <= '0';
        iIntRead <= '0';
 
        iWriteReq <= '0';
        iIntWrite <= '0';
        iIntWrite <= '0';
        intWrData <= (others => '0');
        intWrData <= (others => '0');
      elsif (rising_edge(clk)) then
      elsif (rising_edge(clk)) then
        if ((mainSm = mainAddr) and (writeOp = '1') and (newRxData = '1') and (dataInHexRange = '0')) then
        if ((mainSm = mainAddr) and (writeOp = '1') and (newRxData = '1') and (dataInHexRange = '0')) then
          iIntWrite <= '1';
          iWriteReq <= '1';
          intWrData <= dataParam;
          intWrData <= dataParam;
        -- binary extension mode
        -- binary extension mode
        elsif ((mainSm = mainBinData) and (binWriteOp = '1') and (newRxData = '1')) then
        elsif ((mainSm = mainBinData) and (binWriteOp = '1') and (newRxData = '1')) then
          iIntWrite <= '1';
          iWriteReq <= '1';
          intWrData <= rxData;
          intWrData <= rxData;
 
        elsif ((intGnt = '1') and (iWriteReq = '1')) then
 
          iWriteReq <= '0';
 
          iIntWrite <= '1';
        else
        else
          iIntWrite <= '0';
          iIntWrite <= '0';
        end if;
        end if;
        if ((mainSm = mainAddr) and (readOp = '1') and (newRxData = '1') and (dataInHexRange = '0')) then
        if ((mainSm = mainAddr) and (readOp = '1') and (newRxData = '1') and (dataInHexRange = '0')) then
          iIntRead <= '1';
          iReadReq <= '1';
        -- binary extension
        -- binary extension
        elsif ((mainSm = mainBinLen) and (binReadOp = '1') and (newRxData = '1')) then
        elsif ((mainSm = mainBinLen) and (binReadOp = '1') and (newRxData = '1')) then
          -- the first read request is issued on reception of the length byte
          -- the first read request is issued on reception of the length byte
          iIntRead <= '1';
          iReadReq <= '1';
        elsif ((binReadOp = '1') and (txEndP = '1') and (binLastByte = '0')) then
        elsif ((binReadOp = '1') and (txEndP = '1') and (binLastByte = '0')) then
          -- the next read requests are issued after the previous read value was transmitted and
          -- the next read requests are issued after the previous read value was transmitted and
          -- this is not the last byte to be read.
          -- this is not the last byte to be read.
 
          iReadReq <= '1';
 
        elsif ((intGnt = '1') and (iReadReq = '1')) then
 
          iReadReq <= '0';
          iIntRead <= '1';
          iIntRead <= '1';
        else
        else
          iIntRead <= '0';
          iIntRead <= '0';
        end if;
        end if;
      end if;
      end if;
Line 557... Line 569...
                charFHigh when x"F",
                charFHigh when x"F",
                charFHigh when others;
                charFHigh when others;
    intAddress <= iIntAddress;
    intAddress <= iIntAddress;
    intWrite <= iIntWrite;
    intWrite <= iIntWrite;
    intRead <= iIntRead;
    intRead <= iIntRead;
 
    intReq <= '1' when (iReadReq = '1') else
 
              '1' when (iWriteReq = '1') else '0';
  end Behavioral;
  end Behavioral;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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