Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
Gennum GN4124 core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Gennum GN4124 core
Commits
d0c2399b
Commit
d0c2399b
authored
Apr 03, 2020
by
Dimitris Lampridis
Committed by
Dimitris Lampridis
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hdl: DMA rewrite work-in-progress.
parent
386c2ae9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
727 additions
and
527 deletions
+727
-527
general-cores
hdl/ip_cores/general-cores
+1
-1
dma_controller.vhd
hdl/rtl/dma_controller.vhd
+1
-1
l2p_dma_master.vhd
hdl/rtl/l2p_dma_master.vhd
+529
-429
gn4124_core.vhd
hdl/rtl/spartan6/gn4124_core.vhd
+83
-53
gn4124_core_pkg.vhd
hdl/rtl/spartan6/gn4124_core_pkg.vhd
+11
-8
xwb_gn4124_core.vhd
hdl/rtl/spartan6/xwb_gn4124_core.vhd
+16
-9
main.sv
hdl/sim/example_tb/main.sv
+52
-26
wave.do
hdl/sim/example_tb/wave.do
+34
-0
No files found.
general-cores
@
64f7e518
Subproject commit
284373b7ea1db559dd323634dd34a8dba1811c12
Subproject commit
64f7e518bab2bf0489077f4b9eb26e8cccbf1411
hdl/rtl/dma_controller.vhd
View file @
d0c2399b
...
...
@@ -306,10 +306,10 @@ begin
dma_stat_reg
<=
c_DMA_STAT_ERROR
;
dma_ctrl_current_state
<=
DMA_IDLE
;
else
-- Start the DMA if the length is not 0
if
dma_attrib_dir_reg
=
'0'
then
-- L2P transfer (from target to PCIe)
dma_ctrl_start_l2p_o
<=
'1'
;
dma_ctrl_direction_o
<=
'0'
;
else
-- P2L transfer (from PCIe to target)
dma_ctrl_start_p2l_o
<=
'1'
;
...
...
hdl/rtl/l2p_dma_master.vhd
View file @
d0c2399b
This diff is collapsed.
Click to expand it.
hdl/rtl/spartan6/gn4124_core.vhd
View file @
d0c2399b
...
...
@@ -9,7 +9,7 @@
-- description: GN4124 core top level. Version for spartan6 FPGAs.
--
--------------------------------------------------------------------------------
-- Copyright CERN 2010-20
19
-- Copyright CERN 2010-20
20
--------------------------------------------------------------------------------
-- Copyright and related rights are licensed under the Solderpad Hardware
-- License, Version 2.0 (the "License"); you may not use this file except
...
...
@@ -25,8 +25,10 @@
library
IEEE
;
use
IEEE
.
STD_LOGIC_1164
.
all
;
use
IEEE
.
NUMERIC_STD
.
all
;
use
work
.
gn4124_core_pkg
.
all
;
use
work
.
gencores_pkg
.
all
;
use
work
.
wishbone_pkg
.
all
;
library
UNISIM
;
use
UNISIM
.
vcomponents
.
all
;
...
...
@@ -39,6 +41,11 @@ entity gn4124_core is
generic
(
-- If TRUE, enable the DMA interface
g_WITH_DMA
:
boolean
:
=
TRUE
;
-- if TRUE, use 200MHz PCI clock also for DMA transfers.
-- if FALSE, use whatever is provided by the user on dma_clk_i,
-- which is assumed to be asynchronous to the PCI clock and goes
-- through dual clock FIFOs.
g_DMA_USE_PCI_CLK
:
boolean
:
=
FALSE
;
-- Tunable size and threshold for all async FIFOs.
-- If not sure, leave the defaults.
g_WBM_TO_WB_FIFO_SIZE
:
positive
:
=
128
;
...
...
@@ -47,10 +54,7 @@ entity gn4124_core is
g_WBM_FROM_WB_FIFO_FULL_THRES
:
positive
:
=
110
;
g_P2L_FIFO_SIZE
:
positive
:
=
512
;
g_P2L_FIFO_FULL_THRES
:
positive
:
=
500
;
g_L2P_ADDR_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_ADDR_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_DATA_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_SIZE
:
positive
:
=
128
;
-- Wishbone ACK timeout (in wishbone clock cycles)
g_ACK_TIMEOUT
:
positive
:
=
100
);
port
(
...
...
@@ -59,6 +63,11 @@ entity gn4124_core is
rst_n_a_i
:
in
std_logic
;
-- Asynchronous reset from GN4124
status_o
:
out
std_logic_vector
(
31
downto
0
);
-- Core status output
---------------------------------------------------------
-- 200MHz PCI clock output and synchronous reset for applications
clk_200m_o
:
out
std_logic
;
rst_200m_n_o
:
out
std_logic
;
---------------------------------------------------------
-- P2L Direction
--
...
...
@@ -170,6 +179,9 @@ architecture rtl of gn4124_core is
signal
sys_rst_n
:
std_logic
;
signal
arst_pll
:
std_logic
;
signal
wb_dma_clk
:
std_logic
;
signal
wb_dma_rst_n
:
std_logic
;
-------------------------------------------------------------
-- P2L DataPath (from deserializer to packet decoder)
-------------------------------------------------------------
...
...
@@ -277,6 +289,19 @@ architecture rtl of gn4124_core is
signal
dma_irq
:
std_logic
;
attribute
keep
of
dma_ctrl_l2p_error
:
signal
is
"TRUE"
;
attribute
keep
of
dma_ctrl_l2p_done
:
signal
is
"TRUE"
;
attribute
keep
of
dma_ctrl_start_l2p
:
signal
is
"TRUE"
;
attribute
keep
of
dma_ctrl_abort
:
signal
is
"TRUE"
;
attribute
keep
of
ldm_arb_valid
:
signal
is
"TRUE"
;
attribute
keep
of
ldm_arb_dframe
:
signal
is
"TRUE"
;
attribute
keep
of
ldm_arb_data
:
signal
is
"TRUE"
;
attribute
keep
of
ldm_arb_req
:
signal
is
"TRUE"
;
attribute
keep
of
l2p_rdy
:
signal
is
"TRUE"
;
attribute
keep
of
l_wr_rdy
:
signal
is
"TRUE"
;
attribute
keep
of
tx_error
:
signal
is
"TRUE"
;
attribute
keep
of
arb_ldm_gnt
:
signal
is
"TRUE"
;
------------------------------------------------------------------------------
-- CSR wishbone bus
------------------------------------------------------------------------------
...
...
@@ -285,14 +310,8 @@ architecture rtl of gn4124_core is
------------------------------------------------------------------------------
-- DMA wishbone bus
------------------------------------------------------------------------------
signal
l2p_dma_adr
:
std_logic_vector
(
31
downto
0
);
signal
l2p_dma_dat
:
std_logic_vector
(
31
downto
0
);
signal
l2p_dma_sel
:
std_logic_vector
(
3
downto
0
);
signal
l2p_dma_cyc
:
std_logic
;
signal
l2p_dma_stb
:
std_logic
;
signal
l2p_dma_we
:
std_logic
;
signal
l2p_dma_ack
:
std_logic
;
signal
l2p_dma_stall
:
std_logic
;
signal
l2p_dma_in
:
t_wishbone_master_in
;
signal
l2p_dma_out
:
t_wishbone_master_out
;
signal
p2l_dma_adr
:
std_logic_vector
(
31
downto
0
);
signal
p2l_dma_dat
:
std_logic_vector
(
31
downto
0
);
...
...
@@ -352,6 +371,9 @@ begin
clks_i
(
0
)
=>
sys_clk
,
rst_n_o
(
0
)
=>
sys_rst_n
);
clk_200m_o
<=
sys_clk
;
rst_200m_n_o
<=
sys_rst_n
;
-- Always active high reset for PLL and SERDES
arst_pll
<=
not
(
rst_n_a_i
);
...
...
@@ -360,6 +382,19 @@ begin
------------------------------------------------------------------------------
irq_p_o
<=
irq_p_i
;
------------------------------------------------------------------------------
-- DMA WB clock and reset selection
------------------------------------------------------------------------------
gen_sync_wb_dma
:
if
g_DMA_USE_PCI_CLK
=
TRUE
generate
wb_dma_clk
<=
sys_clk
;
wb_dma_rst_n
<=
sys_rst_n
;
end
generate
gen_sync_wb_dma
;
gen_async_wb_dma
:
if
g_DMA_USE_PCI_CLK
=
FALSE
generate
wb_dma_clk
<=
dma_clk_i
;
wb_dma_rst_n
<=
dma_rst_n_i
;
end
generate
gen_async_wb_dma
;
--============================================================================
-- P2L DataPath
--============================================================================
...
...
@@ -583,11 +618,9 @@ begin
-----------------------------------------------------------------------------
cmp_l2p_dma_master
:
entity
work
.
l2p_dma_master
generic
map
(
g_ADDR_FIFO_FULL_SIZE
=>
g_L2P_ADDR_FIFO_FULL_SIZE
,
g_ADDR_FIFO_FULL_THRES
=>
g_L2P_ADDR_FIFO_FULL_THRES
,
g_DATA_FIFO_FULL_SIZE
=>
g_L2P_DATA_FIFO_FULL_SIZE
,
g_DATA_FIFO_FULL_THRES
=>
g_L2P_DATA_FIFO_FULL_THRES
,
g_BYTE_SWAP
=>
TRUE
)
g_DMA_USE_PCI_CLK
=>
g_DMA_USE_PCI_CLK
,
g_DATA_FIFO_SIZE
=>
g_L2P_DATA_FIFO_SIZE
,
g_BYTE_SWAP
=>
TRUE
)
port
map
(
clk_i
=>
sys_clk
,
rst_n_i
=>
sys_rst_n
,
...
...
@@ -606,30 +639,28 @@ begin
ldm_arb_dframe_o
=>
ldm_arb_dframe
,
ldm_arb_data_o
=>
ldm_arb_data
,
ldm_arb_req_o
=>
ldm_arb_req
,
arb_ldm
_gnt_i
=>
arb_ldm_gnt
,
ldm_arb
_gnt_i
=>
arb_ldm_gnt
,
l2p_edb_o
=>
l2p_edb
,
l_wr_rdy_i
=>
l_wr_rdy
,
l2p_rdy_i
=>
l2p_rdy
,
tx_error_i
=>
tx_error
,
l2p_dma_rst_n_i
=>
dma_rst_n_i
,
l2p_dma_clk_i
=>
dma_clk_i
,
l2p_dma_adr_o
=>
l2p_dma_adr
,
l2p_dma_dat_i
=>
dma_dat_i
,
l2p_dma_dat_o
=>
l2p_dma_dat
,
l2p_dma_sel_o
=>
l2p_dma_sel
,
l2p_dma_cyc_o
=>
l2p_dma_cyc
,
l2p_dma_stb_o
=>
l2p_dma_stb
,
l2p_dma_we_o
=>
l2p_dma_we
,
l2p_dma_ack_i
=>
l2p_dma_ack
,
l2p_dma_stall_i
=>
l2p_dma_stall
);
wb_dma_rst_n_i
=>
wb_dma_rst_n
,
wb_dma_clk_i
=>
wb_dma_clk
,
wb_dma_i
=>
l2p_dma_in
,
wb_dma_o
=>
l2p_dma_out
);
l2p_dma_in
.
dat
<=
dma_dat_i
;
l2p_dma_in
.
err
<=
dma_err_i
;
l2p_dma_in
.
rty
<=
dma_rty_i
;
-----------------------------------------------------------------------------
-- P2L DMA master
-----------------------------------------------------------------------------
cmp_p2l_dma_master
:
entity
work
.
p2l_dma_master
generic
map
(
--g_DMA_USE_PCI_CLK => g_DMA_USE_PCI_CLK,
g_FIFO_SIZE
=>
g_P2L_FIFO_SIZE
,
g_FIFO_FULL_THRES
=>
g_P2L_FIFO_FULL_THRES
,
g_BYTE_SWAP
=>
TRUE
)
...
...
@@ -691,32 +722,31 @@ begin
);
p_dma_wb_mux
:
process
(
dma_ack_i
,
dma_ctrl_direction
,
dma_stall_i
,
l2p_dma_adr
,
l2p_dma_cyc
,
l2p_dma_dat
,
l2p_dma_sel
,
l2p_dma_stb
,
l2p_dma_we
,
p2l_dma_adr
,
p2l_dma_cyc
,
p2l_dma_dat
,
p2l_dma_sel
,
p2l_dma_stb
,
p2l_dma_we
)
l2p_dma_out
,
p2l_dma_adr
,
p2l_dma_cyc
,
p2l_dma_dat
,
p2l_dma_sel
,
p2l_dma_stb
,
p2l_dma_we
)
begin
if
(
dma_ctrl_direction
=
'0'
)
then
dma_adr_o
<=
l2p_dma_
adr
;
dma_dat_o
<=
l2p_dma_
dat
;
dma_sel_o
<=
l2p_dma_
sel
;
dma_cyc_o
<=
l2p_dma_
cyc
;
dma_stb_o
<=
l2p_dma_
stb
;
dma_we_o
<=
l2p_dma_
we
;
l2p_dma_ack
<=
dma_ack_i
;
l2p_dma_stall
<=
dma_stall_i
;
p2l_dma_ack
<=
'0'
;
p2l_dma_stall
<=
'0'
;
dma_adr_o
<=
l2p_dma_out
.
adr
;
dma_dat_o
<=
l2p_dma_out
.
dat
;
dma_sel_o
<=
l2p_dma_out
.
sel
;
dma_cyc_o
<=
l2p_dma_out
.
cyc
;
dma_stb_o
<=
l2p_dma_out
.
stb
;
dma_we_o
<=
l2p_dma_out
.
we
;
l2p_dma_
in
.
ack
<=
dma_ack_i
;
l2p_dma_
in
.
stall
<=
dma_stall_i
;
p2l_dma_ack
<=
'0'
;
p2l_dma_stall
<=
'0'
;
else
dma_adr_o
<=
p2l_dma_adr
;
dma_dat_o
<=
p2l_dma_dat
;
dma_sel_o
<=
p2l_dma_sel
;
dma_cyc_o
<=
p2l_dma_cyc
;
dma_stb_o
<=
p2l_dma_stb
;
dma_we_o
<=
p2l_dma_we
;
p2l_dma_ack
<=
dma_ack_i
;
p2l_dma_stall
<=
dma_stall_i
;
l2p_dma_ack
<=
'0'
;
l2p_dma_stall
<=
'0'
;
dma_adr_o
<=
p2l_dma_adr
;
dma_dat_o
<=
p2l_dma_dat
;
dma_sel_o
<=
p2l_dma_sel
;
dma_cyc_o
<=
p2l_dma_cyc
;
dma_stb_o
<=
p2l_dma_stb
;
dma_we_o
<=
p2l_dma_we
;
p2l_dma_ack
<=
dma_ack_i
;
p2l_dma_stall
<=
dma_stall_i
;
l2p_dma_
in
.
ack
<=
'0'
;
l2p_dma_
in
.
stall
<=
'0'
;
end
if
;
end
process
p_dma_wb_mux
;
...
...
hdl/rtl/spartan6/gn4124_core_pkg.vhd
View file @
d0c2399b
...
...
@@ -56,16 +56,14 @@ package gn4124_core_pkg is
component
xwb_gn4124_core
is
generic
(
g_WITH_DMA
:
boolean
:
=
TRUE
;
g_DMA_USE_PCI_CLK
:
boolean
:
=
FALSE
;
g_WBM_TO_WB_FIFO_SIZE
:
positive
:
=
128
;
g_WBM_TO_WB_FIFO_FULL_THRES
:
positive
:
=
110
;
g_WBM_FROM_WB_FIFO_SIZE
:
positive
:
=
128
;
g_WBM_FROM_WB_FIFO_FULL_THRES
:
positive
:
=
110
;
g_P2L_FIFO_SIZE
:
positive
:
=
512
;
g_P2L_FIFO_FULL_THRES
:
positive
:
=
500
;
g_L2P_ADDR_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_ADDR_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_DATA_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_SIZE
:
positive
:
=
128
;
g_WB_MASTER_MODE
:
t_wishbone_interface_mode
:
=
PIPELINED
;
g_WB_MASTER_GRANULARITY
:
t_wishbone_address_granularity
:
=
BYTE
;
g_WB_DMA_CFG_MODE
:
t_wishbone_interface_mode
:
=
PIPELINED
;
...
...
@@ -76,6 +74,8 @@ package gn4124_core_pkg is
port
(
rst_n_a_i
:
in
std_logic
;
status_o
:
out
std_logic_vector
(
31
downto
0
);
clk_200m_o
:
out
std_logic
;
rst_200m_n_o
:
out
std_logic
;
p2l_clk_p_i
:
in
std_logic
;
p2l_clk_n_i
:
in
std_logic
;
p2l_data_i
:
in
std_logic_vector
(
15
downto
0
);
...
...
@@ -117,16 +117,14 @@ package gn4124_core_pkg is
component
gn4124_core
generic
(
g_WITH_DMA
:
boolean
:
=
TRUE
;
g_DMA_USE_PCI_CLK
:
boolean
:
=
FALSE
;
g_WBM_TO_WB_FIFO_SIZE
:
positive
:
=
128
;
g_WBM_TO_WB_FIFO_FULL_THRES
:
positive
:
=
110
;
g_WBM_FROM_WB_FIFO_SIZE
:
positive
:
=
128
;
g_WBM_FROM_WB_FIFO_FULL_THRES
:
positive
:
=
110
;
g_P2L_FIFO_SIZE
:
positive
:
=
512
;
g_P2L_FIFO_FULL_THRES
:
positive
:
=
500
;
g_L2P_ADDR_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_ADDR_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_DATA_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_SIZE
:
positive
:
=
128
;
g_ACK_TIMEOUT
:
positive
:
=
100
);
port
(
---------------------------------------------------------
...
...
@@ -134,6 +132,11 @@ package gn4124_core_pkg is
rst_n_a_i
:
in
std_logic
;
-- Asynchronous reset from GN4124
status_o
:
out
std_logic_vector
(
31
downto
0
);
-- Core status output
---------------------------------------------------------
-- 200MHz PCI clock output and synchronous reset for applications
clk_200m_o
:
out
std_logic
;
rst_200m_n_o
:
out
std_logic
;
---------------------------------------------------------
-- P2L Direction
--
...
...
hdl/rtl/spartan6/xwb_gn4124_core.vhd
View file @
d0c2399b
...
...
@@ -11,7 +11,7 @@
-- Version for Spartan6 FPGAs.
--
--------------------------------------------------------------------------------
-- Copyright CERN 2018
-- Copyright CERN 2018
- 2020
--------------------------------------------------------------------------------
-- Copyright and related rights are licensed under the Solderpad Hardware
-- License, Version 2.0 (the "License"); you may not use this file except
...
...
@@ -34,6 +34,11 @@ entity xwb_gn4124_core is
generic
(
-- If TRUE, enable the DMA interface
g_WITH_DMA
:
boolean
:
=
TRUE
;
-- if TRUE, use 200MHz PCI clock also for DMA transfers.
-- if FALSE, use whatever is provided by the user on dma_clk_i,
-- which is assumed to be asynchronous to the PCI clock and goes
-- through dual clock FIFOs.
g_DMA_USE_PCI_CLK
:
boolean
:
=
FALSE
;
-- Tunable size and threshold for all async FIFOs.
-- If not sure, leave the defaults.
g_WBM_TO_WB_FIFO_SIZE
:
positive
:
=
128
;
...
...
@@ -42,10 +47,7 @@ entity xwb_gn4124_core is
g_WBM_FROM_WB_FIFO_FULL_THRES
:
positive
:
=
110
;
g_P2L_FIFO_SIZE
:
positive
:
=
512
;
g_P2L_FIFO_FULL_THRES
:
positive
:
=
500
;
g_L2P_ADDR_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_ADDR_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_FULL_SIZE
:
positive
:
=
1024
;
g_L2P_DATA_FIFO_FULL_THRES
:
positive
:
=
700
;
g_L2P_DATA_FIFO_SIZE
:
positive
:
=
128
;
-- WB config for three WB interfaces
g_WB_MASTER_MODE
:
t_wishbone_interface_mode
:
=
PIPELINED
;
g_WB_MASTER_GRANULARITY
:
t_wishbone_address_granularity
:
=
BYTE
;
...
...
@@ -61,6 +63,11 @@ entity xwb_gn4124_core is
rst_n_a_i
:
in
std_logic
;
-- Asynchronous reset from GN4124
status_o
:
out
std_logic_vector
(
31
downto
0
);
-- Core status output
---------------------------------------------------------
-- 200MHz PCI clock output and synchronous reset for applications
clk_200m_o
:
out
std_logic
;
rst_200m_n_o
:
out
std_logic
;
---------------------------------------------------------
-- P2L Direction
--
...
...
@@ -191,20 +198,20 @@ begin
cmp_wrapped_gn4124
:
gn4124_core
generic
map
(
g_WITH_DMA
=>
g_WITH_DMA
,
g_DMA_USE_PCI_CLK
=>
g_DMA_USE_PCI_CLK
,
g_WBM_TO_WB_FIFO_SIZE
=>
g_WBM_TO_WB_FIFO_SIZE
,
g_WBM_TO_WB_FIFO_FULL_THRES
=>
g_WBM_TO_WB_FIFO_FULL_THRES
,
g_WBM_FROM_WB_FIFO_SIZE
=>
g_WBM_FROM_WB_FIFO_SIZE
,
g_WBM_FROM_WB_FIFO_FULL_THRES
=>
g_WBM_FROM_WB_FIFO_FULL_THRES
,
g_P2L_FIFO_SIZE
=>
g_P2L_FIFO_SIZE
,
g_P2L_FIFO_FULL_THRES
=>
g_P2L_FIFO_FULL_THRES
,
g_L2P_ADDR_FIFO_FULL_SIZE
=>
g_L2P_ADDR_FIFO_FULL_SIZE
,
g_L2P_ADDR_FIFO_FULL_THRES
=>
g_L2P_ADDR_FIFO_FULL_THRES
,
g_L2P_DATA_FIFO_FULL_SIZE
=>
g_L2P_DATA_FIFO_FULL_SIZE
,
g_L2P_DATA_FIFO_FULL_THRES
=>
g_L2P_DATA_FIFO_FULL_THRES
,
g_L2P_DATA_FIFO_SIZE
=>
g_L2P_DATA_FIFO_SIZE
,
g_ACK_TIMEOUT
=>
g_ACK_TIMEOUT
)
port
map
(
rst_n_a_i
=>
rst_n_a_i
,
status_o
=>
status_o
,
clk_200m_o
=>
clk_200m_o
,
rst_200m_n_o
=>
rst_200m_n_o
,
p2l_clk_p_i
=>
p2l_clk_p_i
,
p2l_clk_n_i
=>
p2l_clk_n_i
,
p2l_data_i
=>
p2l_data_i
,
...
...
hdl/sim/example_tb/main.sv
View file @
d0c2399b
...
...
@@ -36,6 +36,7 @@ import wishbone_pkg::*;
module
main
;
reg
clk_125m
=
0
;
reg
clk_62m5
=
0
;
logic
gn4124_irq
;
...
...
@@ -43,19 +44,35 @@ module main;
t_wishbone_master_out
wb_out
,
wb_dma_out
,
wb_mem_out
;
always
#
4
ns
clk_125m
<=
~
clk_125m
;
always
#
23
ns
clk_62m5
<=
~
clk_62m5
;
logic
rst_125m_n
;
logic
rst_62m5_n
;
logic
rst_gn4124_n
;
logic
clk_gn4124
;
logic
wb_dma_clk
;
logic
wb_dma_rst_n
;
initial
begin
rst_125m_n
=
0
;
#
80
ns
rst_125m_n
=
1
;
rst_62m5_n
=
0
;
#
80
ns
;
rst_125m_n
=
1
;
rst_62m5_n
=
1
;
end
IGN4124PCIMaster
i_gn4124
()
;
xwb_gn4124_core
xwb_gn4124_core
#
(
.
g_dma_use_pci_clk
(
0
)
)
DUT
(
.
rst_n_a_i
(
i_gn4124
.
rst_n
)
,
.
clk_200m_o
(
clk_gn4124
)
,
.
rst_200m_n_o
(
rst_gn4124_n
)
,
.
p2l_clk_p_i
(
i_gn4124
.
p2l_clk_p
)
,
.
p2l_clk_n_i
(
i_gn4124
.
p2l_clk_n
)
,
.
p2l_data_i
(
i_gn4124
.
p2l_data
)
,
...
...
@@ -88,12 +105,21 @@ module main;
.
wb_dma_cfg_rst_n_i
(
rst_125m_n
)
,
.
wb_dma_cfg_i
(
wb_out
)
,
.
wb_dma_cfg_o
(
wb_in
)
,
.
wb_dma_dat_clk_i
(
clk_125m
)
,
.
wb_dma_dat_rst_n_i
(
rst_125m
_n
)
,
.
wb_dma_dat_clk_i
(
wb_dma_clk
)
,
.
wb_dma_dat_rst_n_i
(
wb_dma_rst
_n
)
,
.
wb_dma_dat_i
(
wb_dma_in
)
,
.
wb_dma_dat_o
(
wb_dma_out
)
)
;
/* -----\/----- EXCLUDED -----\/-----
assign wb_dma_clk = clk_gn4124;
assign wb_dma_rst_n = rst_gn4124_n;
assign wb_dma_clk = clk_125m;
assign wb_dma_rst_n = rst_125m_n;
-----/\----- EXCLUDED -----/\----- */
assign
wb_dma_clk
=
clk_62m5
;
assign
wb_dma_rst_n
=
rst_62m5_n
;
xwb_dpram
#
(
.
g_size
(
32
)
,
...
...
@@ -104,8 +130,8 @@ module main;
.
g_slave2_granularity
(
1
)
)
MEM
(
.
rst_n_i
(
1'b1
)
,
.
clk_sys_i
(
clk_125m
)
,
.
rst_n_i
(
wb_dma_rst_n
)
,
.
clk_sys_i
(
wb_dma_clk
)
,
.
slave1_i
(
wb_dma_out
)
,
.
slave1_o
(
wb_dma_in
)
,
.
slave2_i
(
wb_mem_out
)
,
...
...
@@ -153,7 +179,7 @@ module main;
initial
begin
automatic
int
ntest
=
1
;
const
int
tests
=
8
;
const
int
tests
=
9
;
uint32_t
addr
,
val
,
expected
;
...
...
@@ -185,6 +211,7 @@ module main;
$
write
(
"PASS
\n
"
)
;
/* -----\/----- EXCLUDED -----\/-----
$write("Test %0d/%0d: 128B read over DMA, abort after first read: ",
ntest++, tests);
...
...
@@ -196,7 +223,7 @@ module main;
// Check values read from memory
@(posedge i_gn4124.l2p_valid); // skip header
@
(
posedge
i_gn4124
.
l2p_valid
)
;
repeat(2) @(posedge i_gn4124.l2p_clk_p
);
expected = 32'h8000001f;
val = i_gn4124.l2p_data;
...
...
@@ -214,12 +241,13 @@ module main;
repeat(2) @(posedge clk_125m);
$write("PASS\n");
-----/\----- EXCLUDED -----/\----- */
$
write
(
"Test %0d/%0d: 2x128B chained reads over DMA: "
,
ntest
++,
tests
)
;
// Setup DMA chain info in BFM memory
i_gn4124
.
host_mem_write
(
'h20000
,
'h0000
0
000
)
;
// remote address
i_gn4124
.
host_mem_write
(
'h20000
,
'h0000
1
000
)
;
// remote address
i_gn4124
.
host_mem_write
(
'h20004
,
'h20000100
)
;
// hstartL
i_gn4124
.
host_mem_write
(
'h20008
,
'h00000000
)
;
// hstartH
i_gn4124
.
host_mem_write
(
'h2000C
,
'h80
)
;
// count
...
...
@@ -241,22 +269,21 @@ module main;
@
(
posedge
dma_irq
)
;
check_irq_status
;
clear_irq
;
for
(
addr
=
'h00
;
addr
<
'h20
;
addr
+=
1
)
begin
expected
=
32'h80000000
+
'h20
-
addr
-
1
;
expected
=
32'h80000000
+
'h20
-
(
addr
%
'h20
)
-
1
;
mem_check
(
4
*
addr
,
expected
)
;
mem_check
(
'h100
+
4
*
addr
,
expected
)
;
end
clear_irq
;
repeat
(
4
)
@
(
posedge
clk_125m
)
;
$
write
(
"PASS
\n
"
)
;
// ---------------------------------
$
write
(
"Test %0d/%0d:
128 reads
over DMA: "
,
$
write
(
"Test %0d/%0d:
256B read
over DMA: "
,
ntest
++,
tests
)
;
// Setup DMA
...
...
@@ -270,15 +297,14 @@ module main;
@
(
posedge
dma_irq
)
;
check_irq_status
;
clear_irq
;
for
(
addr
=
'h00
;
addr
<
'h40
;
addr
+=
1
)
begin
expected
=
32'h80000000
+
'h20
-
addr
-
1
;
expected
=
32'h80000000
+
'h20
-
(
addr
%
'h20
)
-
1
;
mem_check
(
4
*
addr
,
expected
)
;
end
clear_irq
;
repeat
(
4
)
@
(
posedge
clk_125m
)
;
$
write
(
"PASS
\n
"
)
;
...
...
@@ -286,11 +312,11 @@ module main;
// Check all four byte swap settings
// ---------------------------------
for
(
int
i
=
0
;
i
<
4
;
i
++
)
begin
$
write
(
"Test %0d/%0d:
64
KB read over DMA (byte swap = %0d): "
,
$
write
(
"Test %0d/%0d:
16
KB read over DMA (byte swap = %0d): "
,
ntest
++,
tests
,
i
)
;
// Restart
acc
.
write
(
'h14
,
'h
10
000
)
;
// count
acc
.
write
(
'h14
,
'h
4
000
)
;
// count
acc
.
write
(
'h20
,
'h00
)
;
// attrib
acc
.
write
(
'h0c
,
'h20000000
+
i
*
'h4000
)
;
// hstartL
acc
.
write
(
'h10
,
'h00000000
)
;
// hstartH
...
...
@@ -300,7 +326,7 @@ module main;
check_irq_status
;
for
(
addr
=
'h00
;
addr
<
'h
4
000
;
addr
+=
1
)
for
(
addr
=
'h00
;
addr
<
'h
1
000
;
addr
+=
1
)
begin
expected
=
32'h80000000
+
'h20
-
(
addr
%
'h20
)
-
1
;
if
(
i
==
1
)
...
...
@@ -321,26 +347,26 @@ module main;
#
1u
s
;
end
$
write
(
"Test %0d/%0d:
256
B read over DMA with 32bit host address overflow: "
,
$
write
(
"Test %0d/%0d:
8K
B read over DMA with 32bit host address overflow: "
,
ntest
++,
tests
)
;
acc
.
write
(
'h14
,
'h
1
00
)
;
// count
acc
.
write
(
'h14
,
'h
20
00
)
;
// count
acc
.
write
(
'h20
,
'h00
)
;
// attrib
acc
.
write
(
'h0c
,
'hfffff
f8
0
)
;
// hstartL
acc
.
write
(
'h0c
,
'hfffff
00
0
)
;
// hstartL
acc
.
write
(
'h10
,
'h00000000
)
;
// hstartH
acc
.
write
(
'h00
,
'h01
)
;
// start
// Transfer will be split internally by L2P DMA master in two requests, the first
// one with a 32-bit adress starting at ffff_f
f8
0 and the next one with a 64-bit
// one with a 32-bit adress starting at ffff_f
00
0 and the next one with a 64-bit
// address starting at 1_0000_0000
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_dframe
)
;
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
sys_clk
)
;
val_check
(
"Host address overflow header"
,
1
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
'h02ff00
2
0
)
;
val_check
(
"Host address overflow header"
,
1
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
'h02ff00
0
0
)
;
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
sys_clk
)
;
val_check
(
"Host address overflow address"
,
1
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
'hfffff
f8
0
)
;
val_check
(
"Host address overflow address"
,
1
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
'hfffff
00
0
)
;
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_dframe
)
;
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
sys_clk
)
;
val_check
(
"Host address overflow header"
,
2
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
'h03ff00
2
0
)
;
val_check
(
"Host address overflow header"
,
2
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
'h03ff00
0
0
)
;
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
sys_clk
)
;
val_check
(
"Host address overflow address high"
,
2
,
DUT
.
cmp_wrapped_gn4124
.
ldm_arb_data
,
1
)
;
@
(
posedge
DUT
.
cmp_wrapped_gn4124
.
sys_clk
)
;
...
...
hdl/sim/example_tb/wave.do
0 → 100644
View file @
d0c2399b
onerror {resume}
quietly WaveActivateNextPane {} 0
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/wb_dma_clk_i
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/wb_dma_current_state
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/wb_dma_cnt_stb
add wave -noupdate -expand /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/wb_dma_o
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/wb_dma_cnt_ack
add wave -noupdate -expand /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/wb_dma_i
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/data_fifo_wr
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/data_fifo_full
add wave -noupdate /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/data_fifo_din
add wave -noupdate -color Gold /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/clk_i
add wave -noupdate -color Gold /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/l2p_dma_current_state
add wave -noupdate -color Gold /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/ldm_arb_valid_o
add wave -noupdate -color Gold /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/ldm_arb_dframe_o
add wave -noupdate -color Gold /main/DUT/cmp_wrapped_gn4124/gen_with_dma/cmp_l2p_dma_master/ldm_arb_data_o
TreeUpdate [SetDefaultTree]
WaveRestoreCursors {{Cursor 1} {537831000 ps} 0}
quietly wave cursor active 1
configure wave -namecolwidth 199
configure wave -valuecolwidth 100
configure wave -justifyvalue left
configure wave -signalnamewidth 1
configure wave -snapdistance 10
configure wave -datasetprefix 0
configure wave -rowmargin 4
configure wave -childrowmargin 2
configure wave -gridoffset 0
configure wave -gridperiod 1
configure wave -griddelta 40
configure wave -timeline 0
configure wave -timelineunits ps
update
WaveRestoreZoom {0 ps} {737045400 ps}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment