Line 2... |
Line 2... |
-- 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.numeric_std.ALL;
|
|
|
entity uartParser is
|
entity uartParser is
|
generic ( -- parameters
|
generic ( -- parameters
|
AW : integer := 8);
|
AW : integer := 8);
|
port ( -- global signals
|
port ( -- global signals
|
Line 349... |
Line 349... |
if ((mainSm = mainBinLen) and (newRxData = '1')) then
|
if ((mainSm = mainBinLen) and (newRxData = '1')) then
|
binByteCount <= rxData;
|
binByteCount <= rxData;
|
elsif (((mainSm = mainBinData) and (binWriteOp = '1') and (newRxData = '1')) or ((binReadOp = '1') and (txEndP = '1'))) then
|
elsif (((mainSm = mainBinData) and (binWriteOp = '1') and (newRxData = '1')) or ((binReadOp = '1') and (txEndP = '1'))) then
|
-- byte counter is updated on every new data received in write operations and for every
|
-- byte counter is updated on every new data received in write operations and for every
|
-- byte transmitted for read operations.
|
-- byte transmitted for read operations.
|
binByteCount <= binByteCount - 1;
|
binByteCount <= std_logic_vector(unsigned(binByteCount) - 1);
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
-- internal write control and data
|
-- internal write control and data
|
-- internal read control
|
-- internal read control
|
Line 409... |
Line 409... |
elsif ((mainSm = mainBinLen) and (newRxData = '1')) then
|
elsif ((mainSm = mainBinLen) and (newRxData = '1')) then
|
-- sample address parameter on reception of length byte
|
-- sample address parameter on reception of length byte
|
iIntAddress <= addrParam(AW - 1 downto 0);
|
iIntAddress <= addrParam(AW - 1 downto 0);
|
elsif ((addrAutoInc = '1') and (((binReadOp = '1') and (txEndP = '1') and (binLastByte = '0')) or ((binWriteOp = '1') and (iIntWrite = '1')))) then
|
elsif ((addrAutoInc = '1') and (((binReadOp = '1') and (txEndP = '1') and (binLastByte = '0')) or ((binWriteOp = '1') and (iIntWrite = '1')))) then
|
-- address is incremented on every read or write if enabled
|
-- address is incremented on every read or write if enabled
|
iIntAddress <= iIntAddress + 1;
|
iIntAddress <= std_logic_vector(unsigned(iIntAddress) + 1);
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
-- read done flag and sampled data read
|
-- read done flag and sampled data read
|
process (clr, clk)
|
process (clr, clk)
|