Skip to content
Snippets Groups Projects
Commit 8735df15 authored by Matthieu Cattin's avatar Matthieu Cattin
Browse files

Implement DMA abort.

Check L2P channel status when sending data to GN4124.
parent add2b142
Branches
Tags
No related merge requests found
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- last changes: 30-09-2010 (mcattin) Add status, error and abort -- last changes: 30-09-2010 (mcattin) Add status, error and abort
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- TODO: - Abort feature -- TODO:
-- --
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
...@@ -41,7 +41,7 @@ entity dma_controller is ...@@ -41,7 +41,7 @@ entity dma_controller is
--------------------------------------------------------- ---------------------------------------------------------
-- Interrupt request -- Interrupt request
dma_ctrl_irq_o : out std_logic; dma_ctrl_irq_o : out std_logic_vector(1 downto 0);
--------------------------------------------------------- ---------------------------------------------------------
-- To the L2P DMA master and P2L DMA master -- To the L2P DMA master and P2L DMA master
...@@ -313,8 +313,12 @@ begin ...@@ -313,8 +313,12 @@ begin
dma_ctrl_byte_swap_o <= dma_ctrl_reg(3 downto 2); dma_ctrl_byte_swap_o <= dma_ctrl_reg(3 downto 2);
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- IRQ output assignement
------------------------------------------------------------------------------
dma_ctrl_irq_o <= dma_error_irq & dma_done_irq;
------------------------------------------------------------------------------
-- DMA controller FSM -- DMA controller FSM
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
p_fsm : process (sys_clk_i, sys_rst_n_i) p_fsm : process (sys_clk_i, sys_rst_n_i)
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
-- --
-- unit name: Gn4124 core main block (gn4124-core.vhd) -- unit name: Gn4124 core main block (gn4124-core.vhd)
-- --
-- authors: Simon Deprez (simon.deprez@cern.ch)
-- Matthieu Cattin (matthieu.cattin@cern.ch)
-- --
-- date: 31-08-2010 -- date: 31-08-2010
-- --
...@@ -18,11 +19,9 @@ ...@@ -18,11 +19,9 @@
-- dependencies: -- dependencies:
-- --
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- last changes: <date> <initials> <log> -- last changes: 23-09-2010 (mcattin)
-- <extended description>
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- TODO: - P2L DMA master -- TODO: -
-- - Interrupt
-- - -- -
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
...@@ -60,9 +59,10 @@ entity gn4124_core is ...@@ -60,9 +59,10 @@ entity gn4124_core is
p2l_valid_i : in std_logic; -- Receive Data Valid p2l_valid_i : in std_logic; -- Receive Data Valid
-- P2L Control -- P2L Control
p2l_rdy_o : out std_logic; -- Rx Buffer Full Flag p2l_rdy_o : out std_logic; -- Rx Buffer Full Flag
p_wr_req_o : in std_logic_vector(1 downto 0); -- PCIe Write Request p_wr_req_i : in std_logic_vector(1 downto 0); -- PCIe Write Request
p_wr_rdy_o : out std_logic_vector(1 downto 0); -- PCIe Write Ready p_wr_rdy_o : out std_logic_vector(1 downto 0); -- PCIe Write Ready
rx_error_o : out std_logic; -- Receive Error rx_error_o : out std_logic; -- Receive Error
vc_rdy_i : in std_logic_vector(1 downto 0); -- Channel ready
--------------------------------------------------------- ---------------------------------------------------------
-- L2P Direction -- L2P Direction
...@@ -79,12 +79,11 @@ entity gn4124_core is ...@@ -79,12 +79,11 @@ entity gn4124_core is
l_wr_rdy_i : in std_logic_vector(1 downto 0); -- Local-to-PCIe Write l_wr_rdy_i : in std_logic_vector(1 downto 0); -- Local-to-PCIe Write
p_rd_d_rdy_i : in std_logic_vector(1 downto 0); -- PCIe-to-Local Read Response Data Ready p_rd_d_rdy_i : in std_logic_vector(1 downto 0); -- PCIe-to-Local Read Response Data Ready
tx_error_i : in std_logic; -- Transmit Error tx_error_i : in std_logic; -- Transmit Error
vc_rdy_i : in std_logic_vector(1 downto 0); -- Channel ready
--------------------------------------------------------- ---------------------------------------------------------
-- Interrupt interface -- Interrupt interface
dma_irq_o : out std_logic_vector(1 downto 0); -- Interrupts sources to IRQ manager dma_irq_o : out std_logic_vector(1 downto 0); -- Interrupts sources to IRQ manager
irq_p_i : in std_logic : -- Interrupt request pulse from IRQ manager irq_p_i : in std_logic; -- Interrupt request pulse from IRQ manager
irq_p_o : out std_logic; -- Interrupt request pulse to GN4124 GPIO irq_p_o : out std_logic; -- Interrupt request pulse to GN4124 GPIO
--------------------------------------------------------- ---------------------------------------------------------
...@@ -97,7 +96,6 @@ entity gn4124_core is ...@@ -97,7 +96,6 @@ entity gn4124_core is
wb_stb_o : out std_logic; wb_stb_o : out std_logic;
wb_we_o : out std_logic; wb_we_o : out std_logic;
wb_ack_i : in std_logic; wb_ack_i : in std_logic;
--wb_stall_i : in std_logic;
--------------------------------------------------------- ---------------------------------------------------------
-- DMA interface (Pipelined wishbone master) -- DMA interface (Pipelined wishbone master)
...@@ -113,6 +111,7 @@ entity gn4124_core is ...@@ -113,6 +111,7 @@ entity gn4124_core is
); );
end gn4124_core; end gn4124_core;
--============================================================================== --==============================================================================
-- Architecture declaration for GN4124 core (gn4124_core) -- Architecture declaration for GN4124 core (gn4124_core)
--============================================================================== --==============================================================================
...@@ -135,17 +134,21 @@ architecture rtl of gn4124_core is ...@@ -135,17 +134,21 @@ architecture rtl of gn4124_core is
signal rst_reg : std_logic; signal rst_reg : std_logic;
signal rst_n : std_logic; signal rst_n : std_logic;
------------------------------------------------------------- -------------------------------------------------------------
-- P2L DataPath (from deserializer to packet decoder) -- P2L DataPath (from deserializer to packet decoder)
------------------------------------------------------------- -------------------------------------------------------------
signal des_pd_valid : std_logic; signal des_pd_valid : std_logic;
signal des_pd_dframe : std_logic; signal des_pd_dframe : std_logic;
signal des_pd_data : std_logic_vector(31 downto 0); signal des_pd_data : std_logic_vector(31 downto 0);
------------------------------------------------------------- -- Local bus control
-- P2L DataPath (from packet decoder to Wishbone master and P2L DMA master) signal p_wr_rdy : std_logic;
------------------------------------------------------------- signal p2l_rdy_wbm : std_logic;
signal p2l_rdy_pdm : std_logic;
-------------------------------------------------------------
-- P2L DataPath (from packet decoder to Wishbone master and P2L DMA master)
-------------------------------------------------------------
signal p2l_hdr_start : std_logic; -- Indicates Header start cycle signal p2l_hdr_start : std_logic; -- Indicates Header start cycle
signal p2l_hdr_length : std_logic_vector(9 downto 0); -- Latched LENGTH value from header signal p2l_hdr_length : std_logic_vector(9 downto 0); -- Latched LENGTH value from header
signal p2l_hdr_cid : std_logic_vector(1 downto 0); -- Completion ID signal p2l_hdr_cid : std_logic_vector(1 downto 0); -- Completion ID
...@@ -163,10 +166,6 @@ architecture rtl of gn4124_core is ...@@ -163,10 +166,6 @@ architecture rtl of gn4124_core is
signal p2l_addr : std_logic_vector(31 downto 0); -- Registered and counting Address signal p2l_addr : std_logic_vector(31 downto 0); -- Registered and counting Address
signal p2l_addr_start : std_logic; signal p2l_addr_start : std_logic;
signal p_wr_rdy : std_logic;
signal p2l_rdy_wbm : std_logic;
signal p2l_rdy_pdm : std_logic;
------------------------------------------------------------- -------------------------------------------------------------
-- L2P DataPath (from arbiter to serializer) -- L2P DataPath (from arbiter to serializer)
------------------------------------------------------------- -------------------------------------------------------------
...@@ -174,15 +173,16 @@ architecture rtl of gn4124_core is ...@@ -174,15 +173,16 @@ architecture rtl of gn4124_core is
signal arb_ser_dframe : std_logic; signal arb_ser_dframe : std_logic;
signal arb_ser_data : std_logic_vector(31 downto 0); signal arb_ser_data : std_logic_vector(31 downto 0);
signal l2p_data_o_o : std_logic_vector(l2p_data_o'range); -- Local bus control
signal l_wr_rdy_t : std_logic_vector(1 downto 0);
-- Resync bridge controls signal l_wr_rdy : std_logic_vector(1 downto 0);
signal Il_wr_rdy_i : std_logic; -- Clocked version of L_WR_RDY from GN412x signal p_rd_d_rdy_t : std_logic_vector(1 downto 0);
signal Ip_rd_d_rdy_i : std_logic; -- Clocked version of p_rd_d_rdy_i from GN412x signal p_rd_d_rdy : std_logic_vector(1 downto 0);
signal Il2p_rdy_i : std_logic; -- Clocked version of l2p_rdy_i from GN412x signal l2p_rdy_t : std_logic;
signal l2p_rdy : std_logic;
------------------------------------------------------------- -------------------------------------------------------------
-- Target Controller (Wishbone master) -- CSR wishbone master to arbiter
------------------------------------------------------------- -------------------------------------------------------------
signal wbm_arb_valid : std_logic; signal wbm_arb_valid : std_logic;
signal wbm_arb_dframe : std_logic; signal wbm_arb_dframe : std_logic;
...@@ -190,6 +190,24 @@ architecture rtl of gn4124_core is ...@@ -190,6 +190,24 @@ architecture rtl of gn4124_core is
signal wbm_arb_req : std_logic; signal wbm_arb_req : std_logic;
signal arb_wbm_gnt : std_logic; signal arb_wbm_gnt : std_logic;
-------------------------------------------------------------
-- L2P DMA master to arbiter
-------------------------------------------------------------
signal ldm_arb_req : std_logic; -- Request use of the L2P bus
signal arb_ldm_gnt : std_logic; -- L2P bus emits data on behalf of the L2P DMA
signal ldm_arb_valid : std_logic;
signal ldm_arb_dframe : std_logic;
signal ldm_arb_data : std_logic_vector(31 downto 0);
-------------------------------------------------------------
-- P2L DMA master to arbiter
-------------------------------------------------------------
signal pdm_arb_valid : std_logic;
signal pdm_arb_dframe : std_logic;
signal pdm_arb_data : std_logic_vector(31 downto 0);
signal pdm_arb_req : std_logic;
signal arb_pdm_gnt : std_logic;
------------------------------------------------------------- -------------------------------------------------------------
-- DMA controller -- DMA controller
------------------------------------------------------------- -------------------------------------------------------------
...@@ -219,6 +237,9 @@ architecture rtl of gn4124_core is ...@@ -219,6 +237,9 @@ architecture rtl of gn4124_core is
signal next_item_attrib : std_logic_vector(31 downto 0); signal next_item_attrib : std_logic_vector(31 downto 0);
signal next_item_valid : std_logic; signal next_item_valid : std_logic;
------------------------------------------------------------------------------
-- CSR wishbone bus
------------------------------------------------------------------------------
signal wb_adr : std_logic_vector(31 downto 0); -- Adress signal wb_adr : std_logic_vector(31 downto 0); -- Adress
signal wb_dat_s2m : std_logic_vector(31 downto 0); -- Data in signal wb_dat_s2m : std_logic_vector(31 downto 0); -- Data in
signal wb_dat_m2s : std_logic_vector(31 downto 0); -- Data out signal wb_dat_m2s : std_logic_vector(31 downto 0); -- Data out
...@@ -229,9 +250,11 @@ architecture rtl of gn4124_core is ...@@ -229,9 +250,11 @@ architecture rtl of gn4124_core is
signal wb_ack : std_logic; -- Acknowledge signal wb_ack : std_logic; -- Acknowledge
signal wb_stall : std_logic; -- Pipelined mode signal wb_stall : std_logic; -- Pipelined mode
signal wb_ack_dma_ctrl : std_logic; -- signal wb_ack_dma_ctrl : std_logic; --
--signal wb_stall_dma_ctrl : std_logic; --
signal wb_dat_s2m_dma_ctrl : std_logic_vector(31 downto 0); -- signal wb_dat_s2m_dma_ctrl : std_logic_vector(31 downto 0); --
------------------------------------------------------------------------------
-- DMA wishbone bus
------------------------------------------------------------------------------
signal l2p_dma_adr : std_logic_vector(31 downto 0); -- Adress signal l2p_dma_adr : std_logic_vector(31 downto 0); -- Adress
signal l2p_dma_dat_s2m : std_logic_vector(31 downto 0); -- Data in signal l2p_dma_dat_s2m : std_logic_vector(31 downto 0); -- Data in
signal l2p_dma_dat_m2s : std_logic_vector(31 downto 0); -- Data out signal l2p_dma_dat_m2s : std_logic_vector(31 downto 0); -- Data out
...@@ -252,25 +275,6 @@ architecture rtl of gn4124_core is ...@@ -252,25 +275,6 @@ architecture rtl of gn4124_core is
signal p2l_dma_ack : std_logic; -- Acknowledge signal p2l_dma_ack : std_logic; -- Acknowledge
signal p2l_dma_stall : std_logic; -- Acknowledge signal p2l_dma_stall : std_logic; -- Acknowledge
-------------------------------------------------------------
-- L2P DMA master
-------------------------------------------------------------
signal ldm_arb_req : std_logic; -- Request use of the L2P bus
signal arb_ldm_gnt : std_logic; -- L2P bus emits data on behalf of the L2P DMA
signal ldm_arb_valid : std_logic;
signal ldm_arb_dframe : std_logic;
signal ldm_arb_data : std_logic_vector(31 downto 0);
-- signal IL2P_DMA_RDY : STD_LOGIC; -- Clocked version of l2p_rdy_i from GN412x
-------------------------------------------------------------
-- P2L DMA master
-------------------------------------------------------------
signal pdm_arb_valid : std_logic;
signal pdm_arb_dframe : std_logic;
signal pdm_arb_data : std_logic_vector(31 downto 0);
signal pdm_arb_req : std_logic;
signal arb_pdm_gnt : std_logic;
--============================================================================== --==============================================================================
-- Architecture begin (gn4124_core) -- Architecture begin (gn4124_core)
...@@ -318,7 +322,6 @@ begin ...@@ -318,7 +322,6 @@ begin
end if; end if;
end process; end process;
cmp_rst_buf : BUFG cmp_rst_buf : BUFG
port map ( port map (
I => rst_reg, I => rst_reg,
...@@ -332,9 +335,9 @@ begin ...@@ -332,9 +335,9 @@ begin
--=============================================================================================-- --=============================================================================================--
--=============================================================================================-- --=============================================================================================--
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- p2l_des: Deserialize the P2L DDR inputs -- p2l_des: Deserialize the P2L DDR inputs
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
cmp_p2l_des : p2l_des cmp_p2l_des : p2l_des
port map port map
( (
...@@ -361,9 +364,15 @@ begin ...@@ -361,9 +364,15 @@ begin
p2l_data_o => des_pd_data p2l_data_o => des_pd_data
); );
----------------------------------------------------------------------------- ------------------------------------------------------------------------------
-- p2l_decode32: Decode the output of the p2l_des -- P2L local bus control signals
----------------------------------------------------------------------------- ------------------------------------------------------------------------------
-- de-asserted to pause transfer from GN4124
p2l_rdy_o <= p2l_rdy_wbm and p2l_rdy_pdm;
-----------------------------------------------------------------------------
-- p2l_decode32: Decode the output of the p2l_des
-----------------------------------------------------------------------------
cmp_p2l_decode32 : p2l_decode32 cmp_p2l_decode32 : p2l_decode32
port map port map
( (
...@@ -405,32 +414,15 @@ begin ...@@ -405,32 +414,15 @@ begin
); );
-----------------------------------------------------------------------------
-- Resync some GN412x Signals
-----------------------------------------------------------------------------
process (clk_p, rst_n)
begin
if(rst_n = c_RST_ACTIVE) then
Il_wr_rdy_i <= '0';
Ip_rd_d_rdy_i <= '0';
Il2p_rdy_i <= '0';
elsif rising_edge(clk_p) then
Il_wr_rdy_i <= l_wr_rdy_i(0);
Ip_rd_d_rdy_i <= p_rd_d_rdy_i(0);
Il2p_rdy_i <= l2p_rdy_i;
end if;
end process;
--=============================================================================================-- --=============================================================================================--
--=============================================================================================-- --=============================================================================================--
--== Core Logic Blocks --== Core Logic Blocks
--=============================================================================================-- --=============================================================================================--
--=============================================================================================-- --=============================================================================================--
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- Wishbone master -- Wishbone master
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
u_wbmaster32 : wbmaster32 u_wbmaster32 : wbmaster32
generic map generic map
( (
...@@ -467,8 +459,9 @@ begin ...@@ -467,8 +459,9 @@ begin
--------------------------------------------------------- ---------------------------------------------------------
-- P2L Control -- P2L Control
p_wr_rdy_o => p_wr_rdy, p_wr_rdy_o => p_wr_rdy_o,
p2l_rdy_o => p2l_rdy_wbm, p2l_rdy_o => p2l_rdy_wbm,
p_rd_d_rdy_i => p_rd_d_rdy,
--------------------------------------------------------- ---------------------------------------------------------
-- To the L2P Interface -- To the L2P Interface
...@@ -500,16 +493,14 @@ begin ...@@ -500,16 +493,14 @@ begin
wb_stb_o <= wb_stb; wb_stb_o <= wb_stb;
wb_we_o <= wb_we; wb_we_o <= wb_we;
wb_ack <= wb_ack_i or wb_ack_dma_ctrl; wb_ack <= wb_ack_i or wb_ack_dma_ctrl;
--wb_stall <= wb_stall_i or wb_stall_dma_ctrl;
--wb_stall_dma_ctrl <= wb_stb and not wb_ack;
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- DMA controller
-----------------------------------------------------------------------------
u_dma_controller : dma_controller u_dma_controller : dma_controller
-----------------------------------------------------------------------------
port map port map
( (
--DEBUG=> LED (7 downto 4), sys_clk_i => clk_p,
sys_clk_i => clk_p, --sys_clk_i,
sys_rst_n_i => rst_n, sys_rst_n_i => rst_n,
dma_ctrl_irq_o => dma_irq_o, dma_ctrl_irq_o => dma_irq_o,
...@@ -545,16 +536,17 @@ begin ...@@ -545,16 +536,17 @@ begin
wb_ack_o => wb_ack_dma_ctrl wb_ack_o => wb_ack_dma_ctrl
); );
-- Status signals from DMA masters
dma_ctrl_done <= dma_ctrl_l2p_done or dma_ctrl_p2l_done; dma_ctrl_done <= dma_ctrl_l2p_done or dma_ctrl_p2l_done;
dma_ctrl_error <= dma_ctrl_l2p_error or dma_ctrl_p2l_error; dma_ctrl_error <= dma_ctrl_l2p_error or dma_ctrl_p2l_error;
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
-- L2P DMA master
-----------------------------------------------------------------------------
u_l2p_dma_master : l2p_dma_master u_l2p_dma_master : l2p_dma_master
-----------------------------------------------------------------------------
port map port map
( (
sys_clk_i => clk_p, --sys_clk_i, sys_clk_i => clk_p,
sys_rst_n_i => rst_n, sys_rst_n_i => rst_n,
dma_ctrl_target_addr_i => dma_ctrl_carrier_addr, dma_ctrl_target_addr_i => dma_ctrl_carrier_addr,
...@@ -573,6 +565,10 @@ begin ...@@ -573,6 +565,10 @@ begin
ldm_arb_req_o => ldm_arb_req, ldm_arb_req_o => ldm_arb_req,
arb_ldm_gnt_i => arb_ldm_gnt, arb_ldm_gnt_i => arb_ldm_gnt,
l2p_edb_o => l2p_edb_o,
l_wr_rdy_i => l_wr_rdy,
l2p_rdy_i => l2p_rdy,
l2p_dma_clk_i => clk_p, l2p_dma_clk_i => clk_p,
l2p_dma_adr_o => l2p_dma_adr, l2p_dma_adr_o => l2p_dma_adr,
l2p_dma_dat_i => l2p_dma_dat_s2m, l2p_dma_dat_i => l2p_dma_dat_s2m,
...@@ -585,13 +581,13 @@ begin ...@@ -585,13 +581,13 @@ begin
l2p_dma_stall_i => l2p_dma_stall l2p_dma_stall_i => l2p_dma_stall
); );
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- P2L DMA master
-----------------------------------------------------------------------------
u_p2l_dma_master : p2l_dma_master u_p2l_dma_master : p2l_dma_master
-----------------------------------------------------------------------------
port map port map
( (
DEBUG => LED (7 downto 4), sys_clk_i => clk_p,
sys_clk_i => clk_p, --sys_clk_i,
sys_rst_n_i => rst_n, sys_rst_n_i => rst_n,
dma_ctrl_carrier_addr_i => dma_ctrl_carrier_addr, dma_ctrl_carrier_addr_i => dma_ctrl_carrier_addr,
...@@ -616,7 +612,8 @@ begin ...@@ -616,7 +612,8 @@ begin
pd_pdm_data_i => p2l_d, pd_pdm_data_i => p2l_d,
pd_pdm_be_i => p2l_be, pd_pdm_be_i => p2l_be,
p2l_rdy_o => p2l_rdy_pdm, p2l_rdy_o => p2l_rdy_pdm,
rx_error_o => rx_error_o,
pdm_arb_valid_o => pdm_arb_valid, pdm_arb_valid_o => pdm_arb_valid,
pdm_arb_dframe_o => pdm_arb_dframe, pdm_arb_dframe_o => pdm_arb_dframe,
...@@ -659,29 +656,42 @@ begin ...@@ -659,29 +656,42 @@ begin
p2l_dma_stall <= dma_stall_i; p2l_dma_stall <= dma_stall_i;
-----------------------------------------------------------------------------
-- Top Level LB Controls
-----------------------------------------------------------------------------
p_wr_rdy_o <= p_wr_rdy & p_wr_rdy; -- assert when wbmaster32 ready to receive target write
rx_error_o <= '0'; -- assert when p2l dma master aborted
l2p_edb_o <= '0'; -- assert when l2p dma master aborted
-- de-asserted to pause transfer from GN4124
p2l_rdy_o <= p2l_rdy_wbm and p2l_rdy_pdm;
--=============================================================================================-- --=============================================================================================--
--=============================================================================================-- --=============================================================================================--
--== L2P DataPath --== L2P DataPath
--=============================================================================================-- --=============================================================================================--
--=============================================================================================-- --=============================================================================================--
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- ARBITER: Arbitrate between Wishbone master, DMA master and DMA pdmuencer -- Resync GN412x L2P status signals
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
process (clk_p, rst_n)
begin
if(rst_n = c_RST_ACTIVE) then
l_wr_rdy_t <= "00";
l_wr_rdy <= "00";
p_rd_d_rdy_t <= "00";
p_rd_d_rdy <= "00";
l2p_rdy_t <= '0';
l2p_rdy <= '0';
elsif rising_edge(clk_p) then
-- must be checked before l2p_dma_master issues a master write
l_wr_rdy_t <= l_wr_rdy_i;
l_wr_rdy <= l_wr_rdy_t;
-- must be checked before wbmaster32 sends read completion with data
p_rd_d_rdy_t <= p_rd_d_rdy_i;
p_rd_d_rdy <= p_rd_d_rdy_t;
-- when de-asserted, l2p_dma_master must stop sending data (de-assert l2p_valid) within 3 (or 7 ?) clock cycles
l2p_rdy_t <= l2p_rdy_i;
l2p_rdy <= l2p_rdy_t;
end if;
end process;
-----------------------------------------------------------------------------
-- L2P arbiter, arbitrates access to GN4124
-----------------------------------------------------------------------------
u_arbiter : arbiter u_arbiter : arbiter
port map port map
( (
...@@ -723,9 +733,9 @@ begin ...@@ -723,9 +733,9 @@ begin
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- L2P_SER: Generate the L2P DDR Outputs -- L2P_SER: Generate the L2P DDR Outputs
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
cmp_l2p_ser : l2p_ser cmp_l2p_ser : l2p_ser
port map port map
( (
......
...@@ -176,8 +176,9 @@ package gn4124_core_pkg is ...@@ -176,8 +176,9 @@ package gn4124_core_pkg is
--------------------------------------------------------- ---------------------------------------------------------
-- P2L Control -- P2L Control
p_wr_rdy_o : out std_logic; -- Write buffer not empty p_wr_rdy_o : out std_logic_vector(1 downto 0); -- Ready to accept target write
p2l_rdy_o : out std_logic; -- Asserted to pause transfer already in progress p2l_rdy_o : out std_logic; -- De-asserted to pause transfer already in progress
p_rd_d_rdy_i : in std_logic_vector(1 downto 0); -- Asserted when GN4124 ready to accept read completion with data
--------------------------------------------------------- ---------------------------------------------------------
-- To the L2P Interface -- To the L2P Interface
...@@ -288,6 +289,12 @@ package gn4124_core_pkg is ...@@ -288,6 +289,12 @@ package gn4124_core_pkg is
ldm_arb_req_o : out std_logic; ldm_arb_req_o : out std_logic;
arb_ldm_gnt_i : in std_logic; arb_ldm_gnt_i : in std_logic;
---------------------------------------------------------
-- L2P channel control
l2p_edb_o : out std_logic; -- Asserted when transfer is aborted
l_wr_rdy_i : in std_logic_vector(1 downto 0); -- Asserted when GN4124 is ready to receive master write
l2p_rdy_i : in std_logic; -- De-asserted to pause transfer already in progress
--------------------------------------------------------- ---------------------------------------------------------
-- DMA Interface (Pipelined Wishbone) -- DMA Interface (Pipelined Wishbone)
l2p_dma_clk_i : in std_logic; -- Bus clock l2p_dma_clk_i : in std_logic; -- Bus clock
...@@ -308,8 +315,6 @@ package gn4124_core_pkg is ...@@ -308,8 +315,6 @@ package gn4124_core_pkg is
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
port port
( (
DEBUG : out std_logic_vector(3 downto 0);
--------------------------------------------------------- ---------------------------------------------------------
-- Clock/Reset -- Clock/Reset
sys_clk_i : in std_logic; sys_clk_i : in std_logic;
...@@ -346,7 +351,8 @@ package gn4124_core_pkg is ...@@ -346,7 +351,8 @@ package gn4124_core_pkg is
--------------------------------------------------------- ---------------------------------------------------------
-- P2L control -- P2L control
p2l_rdy_o : out std_logic; -- Asserted to pause transfer already in progress p2l_rdy_o : out std_logic; -- De-asserted to pause transfer already in progress
rx_error_o : out std_logic; -- Asserted when transfer is aborted
--------------------------------------------------------- ---------------------------------------------------------
-- To the L2P Interface (send the DMA Master Read request) -- To the L2P Interface (send the DMA Master Read request)
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
-- Dead times optimisation in packet generator. -- Dead times optimisation in packet generator.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- TODO: - issue an error if ask DMA transfert of length = 0 -- TODO: - issue an error if ask DMA transfert of length = 0
-- - Abort feature => assert L2P_EDB (EnD of packet Bad)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
library IEEE; library IEEE;
...@@ -65,6 +64,12 @@ entity l2p_dma_master is ...@@ -65,6 +64,12 @@ entity l2p_dma_master is
ldm_arb_req_o : out std_logic; ldm_arb_req_o : out std_logic;
arb_ldm_gnt_i : in std_logic; arb_ldm_gnt_i : in std_logic;
---------------------------------------------------------
-- L2P channel control
l2p_edb_o : out std_logic; -- Asserted when transfer is aborted
l_wr_rdy_i : in std_logic_vector(1 downto 0); -- Asserted when GN4124 is ready to receive master write
l2p_rdy_i : in std_logic; -- De-asserted to pause transfer already in progress
--------------------------------------------------------- ---------------------------------------------------------
-- DMA Interface (Pipelined Wishbone) -- DMA Interface (Pipelined Wishbone)
l2p_dma_clk_i : in std_logic; -- Bus clock l2p_dma_clk_i : in std_logic; -- Bus clock
...@@ -157,7 +162,8 @@ architecture behaviour of l2p_dma_master is ...@@ -157,7 +162,8 @@ architecture behaviour of l2p_dma_master is
signal wb_ack_cnt : unsigned(6 downto 0); signal wb_ack_cnt : unsigned(6 downto 0);
-- L2P DMA Master FSM -- L2P DMA Master FSM
type l2p_dma_state_type is (L2P_IDLE, L2P_WAIT_DATA, L2P_HEADER, L2P_ADDR_H, L2P_ADDR_L, L2P_DATA, L2P_LAST_DATA); type l2p_dma_state_type is (L2P_IDLE, L2P_WAIT_DATA, L2P_HEADER, L2P_ADDR_H,
L2P_ADDR_L, L2P_DATA, L2P_LAST_DATA, L2P_WAIT_RDY);
signal l2p_dma_current_state : l2p_dma_state_type; signal l2p_dma_current_state : l2p_dma_state_type;
-- L2P packet generator -- L2P packet generator
...@@ -334,6 +340,7 @@ begin ...@@ -334,6 +340,7 @@ begin
ldm_arb_dframe_o <= '0'; ldm_arb_dframe_o <= '0';
data_fifo_rd <= '0'; data_fifo_rd <= '0';
dma_ctrl_done_o <= '0'; dma_ctrl_done_o <= '0';
l2p_edb_o <= '0';
elsif rising_edge(sys_clk_i) then elsif rising_edge(sys_clk_i) then
case l2p_dma_current_state is case l2p_dma_current_state is
...@@ -344,8 +351,9 @@ begin ...@@ -344,8 +351,9 @@ begin
ldm_arb_data_o <= (others => '0'); ldm_arb_data_o <= (others => '0');
ldm_arb_valid_o <= '0'; ldm_arb_valid_o <= '0';
ldm_arb_dframe_o <= '0'; ldm_arb_dframe_o <= '0';
l2p_edb_o <= '0';
if (data_fifo_empty = '0') then if (data_fifo_empty = '0' and l_wr_rdy_i = "11") then
-- We have data to send -> prepare a packet, first the header -- We have data to send -> prepare a packet, first the header
l2p_dma_current_state <= L2P_HEADER; l2p_dma_current_state <= L2P_HEADER;
-- request access to PCIe bus -- request access to PCIe bus
...@@ -400,14 +408,31 @@ begin ...@@ -400,14 +408,31 @@ begin
-- send data with byte swap if requested -- send data with byte swap if requested
ldm_arb_data_o <= f_byte_swap(g_BYTE_SWAP, data_fifo_dout, l2p_byte_swap); ldm_arb_data_o <= f_byte_swap(g_BYTE_SWAP, data_fifo_dout, l2p_byte_swap);
ldm_arb_valid_o <= '1'; ldm_arb_valid_o <= '1';
-- data not ready yet, wait for it if (dma_ctrl_abort_i = '1') then
if(data_fifo_empty = '1') then l2p_edb_o <= '1';
l2p_dma_current_state <= L2P_IDLE;
elsif(data_fifo_empty = '1') then
-- data not ready yet, wait for it
l2p_dma_current_state <= L2P_WAIT_DATA; l2p_dma_current_state <= L2P_WAIT_DATA;
elsif(l2p_data_cnt <= 2) then elsif(l2p_data_cnt <= 2) then
-- Only one 32-bit data word to send -- Only one 32-bit data word to send
l2p_dma_current_state <= L2P_LAST_DATA; l2p_dma_current_state <= L2P_LAST_DATA;
-- Stop reading from fifo -- Stop reading from fifo
data_fifo_rd <= '0'; data_fifo_rd <= '0';
elsif (l2p_rdy_i = '0') then
-- GN4124 not able to receive more data, have to wait
l2p_dma_current_state <= L2P_WAIT_RDY;
-- Stop reading from fifo
data_fifo_rd <= '0';
end if;
when L2P_WAIT_RDY =>
ldm_arb_valid_o <= '0';
if (l2p_rdy_i = '1') then
-- GN4124 is ready to receive more data
l2p_dma_current_state <= L2P_DATA;
-- Re-start fifo reading
data_fifo_rd <= '1';
end if; end if;
when L2P_WAIT_DATA => when L2P_WAIT_DATA =>
......
...@@ -181,7 +181,7 @@ architecture BEHAVIOUR of LOTUS is ...@@ -181,7 +181,7 @@ architecture BEHAVIOUR of LOTUS is
p2l_valid_i : in std_logic; -- Receive Data Valid p2l_valid_i : in std_logic; -- Receive Data Valid
-- P2L Control -- P2L Control
p2l_rdy_o : out std_logic; -- Rx Buffer Full Flag p2l_rdy_o : out std_logic; -- Rx Buffer Full Flag
p_wr_req_o : in std_logic_vector(1 downto 0); -- PCIe Write Request p_wr_req_i : in std_logic_vector(1 downto 0); -- PCIe Write Request
p_wr_rdy_o : out std_logic_vector(1 downto 0); -- PCIe Write Ready p_wr_rdy_o : out std_logic_vector(1 downto 0); -- PCIe Write Ready
rx_error_o : out std_logic; -- Receive Error rx_error_o : out std_logic; -- Receive Error
...@@ -205,7 +205,7 @@ architecture BEHAVIOUR of LOTUS is ...@@ -205,7 +205,7 @@ architecture BEHAVIOUR of LOTUS is
--------------------------------------------------------- ---------------------------------------------------------
-- Interrupt interface -- Interrupt interface
dma_irq_o : out std_logic_vector(1 downto 0); -- Interrupts sources to IRQ manager dma_irq_o : out std_logic_vector(1 downto 0); -- Interrupts sources to IRQ manager
irq_p_i : in std_logic : -- Interrupt request pulse from IRQ manager irq_p_i : in std_logic; -- Interrupt request pulse from IRQ manager
irq_p_o : out std_logic; -- Interrupt request pulse to GN4124 GPIO irq_p_o : out std_logic; -- Interrupt request pulse to GN4124 GPIO
--------------------------------------------------------- ---------------------------------------------------------
...@@ -332,7 +332,7 @@ begin ...@@ -332,7 +332,7 @@ begin
-- P2L Control -- P2L Control
p2l_rdy_o => P2L_RDY, p2l_rdy_o => P2L_RDY,
p_wr_req_o => P_WR_REQ, p_wr_req_i => P_WR_REQ,
p_wr_rdy_o => P_WR_RDY, p_wr_rdy_o => P_WR_RDY,
rx_error_o => RX_ERROR, rx_error_o => RX_ERROR,
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- TODO: - byte swap -- TODO: - byte swap
-- - byte enable support. -- - byte enable support.
-- - abort feature => assert RX_ERROR to GN4124 -- - issue an error if ask DMA transfert of length = 0
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
library IEEE; library IEEE;
...@@ -37,9 +37,6 @@ use work.gn4124_core_pkg.all; ...@@ -37,9 +37,6 @@ use work.gn4124_core_pkg.all;
entity p2l_dma_master is entity p2l_dma_master is
port port
( (
DEBUG : out std_logic_vector(3 downto 0);
--------------------------------------------------------- ---------------------------------------------------------
-- Clock/Reset -- Clock/Reset
sys_clk_i : in std_logic; sys_clk_i : in std_logic;
...@@ -76,7 +73,8 @@ entity p2l_dma_master is ...@@ -76,7 +73,8 @@ entity p2l_dma_master is
--------------------------------------------------------- ---------------------------------------------------------
-- P2L control -- P2L control
p2l_rdy_o : out std_logic; -- Asserted to pause transfer already in progress p2l_rdy_o : out std_logic; -- De-asserted to pause transfer already in progress
rx_error_o : out std_logic; -- Asserted when transfer is aborted
--------------------------------------------------------- ---------------------------------------------------------
-- To the P2L Interface (send the DMA Master Read request) -- To the P2L Interface (send the DMA Master Read request)
...@@ -276,6 +274,7 @@ begin ...@@ -276,6 +274,7 @@ begin
dma_ctrl_done_o <= '0'; dma_ctrl_done_o <= '0';
next_item_valid_o <= '0'; next_item_valid_o <= '0';
completion_error <= '0'; completion_error <= '0';
rx_error_o <= '0';
elsif rising_edge(sys_clk_i) then elsif rising_edge(sys_clk_i) then
case p2l_dma_current_state is case p2l_dma_current_state is
...@@ -284,6 +283,7 @@ begin ...@@ -284,6 +283,7 @@ begin
dma_ctrl_done_o <= '0'; dma_ctrl_done_o <= '0';
next_item_valid_o <= '0'; next_item_valid_o <= '0';
completion_error <= '0'; completion_error <= '0';
rx_error_o <= '0';
-- Start a read request when a P2L DMA is initated or when the DMA -- Start a read request when a P2L DMA is initated or when the DMA
-- controller asks for the next DMA info (in a chained DMA). -- controller asks for the next DMA info (in a chained DMA).
if (dma_ctrl_start_p2l_i = '1' or dma_ctrl_start_next_i = '1') then if (dma_ctrl_start_p2l_i = '1' or dma_ctrl_start_next_i = '1') then
...@@ -327,7 +327,10 @@ begin ...@@ -327,7 +327,10 @@ begin
when P2L_WAIT_READ_COMPLETION => when P2L_WAIT_READ_COMPLETION =>
-- End of the read request packet -- End of the read request packet
pdm_arb_valid_o <= '0'; pdm_arb_valid_o <= '0';
if (pd_pdm_master_cpld_i = '1' and pd_pdm_data_last_i = '1') then if (dma_ctrl_abort_i = '1') then
rx_error_o <= '1';
p2l_dma_current_state <= P2L_IDLE;
elsif (pd_pdm_master_cpld_i = '1' and pd_pdm_data_last_i = '1') then
-- last word of read completion has been received -- last word of read completion has been received
if (l2p_last_packet = '0') then if (l2p_last_packet = '0') then
-- A new read request is needed, DMA size > max payload -- A new read request is needed, DMA size > max payload
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
-- Dead times optimisation in packet generator. -- Dead times optimisation in packet generator.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- TODO: - byte enable support. -- TODO: - byte enable support.
-- -
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
library IEEE; library IEEE;
...@@ -70,8 +69,9 @@ entity wbmaster32 is ...@@ -70,8 +69,9 @@ entity wbmaster32 is
--------------------------------------------------------- ---------------------------------------------------------
-- P2L channel control -- P2L channel control
p_wr_rdy_o : out std_logic; -- Ready to accept target write p_wr_rdy_o : out std_logic_vector(1 downto 0); -- Ready to accept target write
p2l_rdy_o : out std_logic; -- Asserted to pause transfer already in progress p2l_rdy_o : out std_logic; -- De-asserted to pause transfer already in progress
p_rd_d_rdy_i : in std_logic_vector(1 downto 0); -- Asserted when GN4124 ready to accept read completion with data
--------------------------------------------------------- ---------------------------------------------------------
-- To the arbiter (L2P data) -- To the arbiter (L2P data)
...@@ -163,7 +163,7 @@ begin ...@@ -163,7 +163,7 @@ begin
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- ready to receive new target write if fifo not full -- ready to receive new target write if fifo not full
p_wr_rdy_o <= not(to_wb_fifo_full); p_wr_rdy_o <= "00" when to_wb_fifo_full = '1' else "11";
-- pause transfer from GN4124 when fifo is full -- pause transfer from GN4124 when fifo is full
p2l_rdy_o <= not(to_wb_fifo_full); p2l_rdy_o <= not(to_wb_fifo_full);
...@@ -243,7 +243,8 @@ begin ...@@ -243,7 +243,8 @@ begin
wbm_arb_data_o <= (others => '0'); wbm_arb_data_o <= (others => '0');
wbm_arb_valid_o <= '0'; wbm_arb_valid_o <= '0';
wbm_arb_dframe_o <= '0'; wbm_arb_dframe_o <= '0';
if(from_wb_fifo_empty = '0') then if(from_wb_fifo_empty = '0' and p_rd_d_rdy_i = "11") then
-- generate a packet when read data in fifo and GN4124 ready to receive the packet
wbm_arb_req_o <= '1'; wbm_arb_req_o <= '1';
from_wb_fifo_rd <= '1'; from_wb_fifo_rd <= '1';
l2p_read_cpl_current_state <= L2P_HEADER; l2p_read_cpl_current_state <= L2P_HEADER;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment