Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
HDL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RTSD
HDL
Commits
9def7464
Commit
9def7464
authored
2 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Add unpack to count octets.
parent
3bff7fee
No related branches found
No related tags found
1 merge request
!288
Resolve L2SDP-836
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/io/eth/src/vhdl/eth_tester_rx.vhd
+65
-19
65 additions, 19 deletions
libraries/io/eth/src/vhdl/eth_tester_rx.vhd
with
65 additions
and
19 deletions
libraries/io/eth/src/vhdl/eth_tester_rx.vhd
+
65
−
19
View file @
9def7464
...
@@ -24,13 +24,14 @@
...
@@ -24,13 +24,14 @@
-- References:
-- References:
-- [1] https://support.astron.nl/confluence/display/L2M/L6+FWLIB+Design+Document%3A+ETH+tester+unit+for+1GbE
-- [1] https://support.astron.nl/confluence/display/L2M/L6+FWLIB+Design+Document%3A+ETH+tester+unit+for+1GbE
LIBRARY
IEEE
,
common_lib
,
dp_lib
;
LIBRARY
IEEE
,
common_lib
,
dp_lib
,
diag_lib
;
USE
IEEE
.
std_logic_1164
.
ALL
;
USE
IEEE
.
std_logic_1164
.
ALL
;
USE
IEEE
.
NUMERIC_STD
.
ALL
;
USE
IEEE
.
NUMERIC_STD
.
ALL
;
USE
common_lib
.
common_pkg
.
ALL
;
USE
common_lib
.
common_pkg
.
ALL
;
USE
common_lib
.
common_mem_pkg
.
ALL
;
USE
common_lib
.
common_mem_pkg
.
ALL
;
USE
common_lib
.
common_field_pkg
.
ALL
;
USE
common_lib
.
common_field_pkg
.
ALL
;
USE
dp_lib
.
dp_stream_pkg
.
ALL
;
USE
dp_lib
.
dp_stream_pkg
.
ALL
;
USE
diag_lib
.
diag_pkg
.
ALL
;
USE
work
.
eth_tester_pkg
.
ALL
;
USE
work
.
eth_tester_pkg
.
ALL
;
ENTITY
eth_tester_rx
IS
ENTITY
eth_tester_rx
IS
...
@@ -59,10 +60,22 @@ END eth_tester_rx;
...
@@ -59,10 +60,22 @@ END eth_tester_rx;
ARCHITECTURE
str
OF
eth_tester_rx
IS
ARCHITECTURE
str
OF
eth_tester_rx
IS
CONSTANT
c_nof_total_counts
:
NATURAL
:
=
2
;
CONSTANT
c_nof_total_counts
:
NATURAL
:
=
3
;
-- 0 = nof_sop, 1 = nof_valid, 2 = nof_crc_corrupt
CONSTANT
c_empty_w
:
NATURAL
:
=
2
;
-- for 0, 1, 2, 3 empty octets per word
CONSTANT
c_fifo_fill
:
NATURAL
:
=
c_eth_tester_bg_block_len_max
/
c_word_sz
;
-- = 9000 / 4 = 2250
CONSTANT
c_fifo_size
:
NATURAL
:
=
true_log_pow2
(
c_fifo_fill
);
-- = 4096
SIGNAL
rx_udp_data
:
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
SIGNAL
rx_offload_sosi
:
t_dp_sosi
;
SIGNAL
rx_offload_sosi
:
t_dp_sosi
;
SIGNAL
rx_offload_data
:
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
SIGNAL
decoded_sosi
:
t_dp_sosi
;
SIGNAL
decoded_sosi
:
t_dp_sosi
;
SIGNAL
decoded_data
:
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
SIGNAL
rx_fifo_siso
:
t_dp_siso
;
SIGNAL
rx_fifo_sosi
:
t_dp_sosi
;
SIGNAL
rx_fifo_data
:
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
SIGNAL
unpacked_sosi
:
t_dp_sosi
;
SIGNAL
unpacked_data
:
STD_LOGIC_VECTOR
(
c_octet_w
-1
DOWNTO
0
);
SIGNAL
crc_corrupt
:
STD_LOGIC
:
=
'0'
;
SIGNAL
crc_corrupt
:
STD_LOGIC
:
=
'0'
;
SIGNAL
in_strobe_arr
:
STD_LOGIC_VECTOR
(
c_nof_total_counts
-1
DOWNTO
0
);
SIGNAL
in_strobe_arr
:
STD_LOGIC_VECTOR
(
c_nof_total_counts
-1
DOWNTO
0
);
...
@@ -74,6 +87,12 @@ ARCHITECTURE str OF eth_tester_rx IS
...
@@ -74,6 +87,12 @@ ARCHITECTURE str OF eth_tester_rx IS
BEGIN
BEGIN
-- View sosi.data in Wave Window
rx_udp_data
<=
rx_udp_sosi
.
data
(
c_word_w
-1
DOWNTO
0
);
rx_offload_data
<=
rx_offload_sosi
.
data
(
c_word_w
-1
DOWNTO
0
);
rx_fifo_data
<=
rx_fifo_sosi
.
data
(
c_word_w
-1
DOWNTO
0
);
unpacked_data
<=
unpacked_sosi
.
data
(
c_octet_w
-1
DOWNTO
0
);
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Rx ETH/UDP/IP packets with packed BG data
-- Rx ETH/UDP/IP packets with packed BG data
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
...
@@ -112,6 +131,43 @@ BEGIN
...
@@ -112,6 +131,43 @@ BEGIN
decoded_sosi
.
bsn
<=
RESIZE_DP_BSN
(
hdr_fields_raw_slv
(
field_hi
(
c_eth_tester_hdr_field_arr
,
"dp_bsn"
)
DOWNTO
field_lo
(
c_eth_tester_hdr_field_arr
,
"dp_bsn"
)));
decoded_sosi
.
bsn
<=
RESIZE_DP_BSN
(
hdr_fields_raw_slv
(
field_hi
(
c_eth_tester_hdr_field_arr
,
"dp_bsn"
)
DOWNTO
field_lo
(
c_eth_tester_hdr_field_arr
,
"dp_bsn"
)));
END
PROCESS
;
END
PROCESS
;
u_rx_fifo
:
ENTITY
dp_lib
.
dp_fifo_sc
GENERIC
MAP
(
g_data_w
=>
c_word_w
,
g_bsn_w
=>
c_diag_bg_bsn_init_w
,
-- = 64 bit
g_empty_w
=>
c_empty_w
,
g_use_bsn
=>
TRUE
,
g_use_empty
=>
TRUE
,
g_use_sync
=>
TRUE
,
g_fifo_size
=>
c_fifo_size
)
PORT
MAP
(
rst
=>
st_rst
,
clk
=>
st_clk
,
-- ST sink
snk_in
=>
decoded_sosi
,
-- ST source
src_in
=>
rx_fifo_siso
,
src_out
=>
rx_fifo_sosi
);
u_unpack
:
ENTITY
dp_lib
.
dp_repack_data
-- unpack 32b words into 8b octets
GENERIC
MAP
(
g_in_dat_w
=>
c_word_w
,
-- = 32
g_in_nof_words
=>
1
,
g_in_symbol_w
=>
c_octet_w
,
g_out_dat_w
=>
c_octet_w
,
-- = 8
g_out_nof_words
=>
c_word_sz
,
-- = 4
g_out_symbol_w
=>
c_octet_w
)
PORT
MAP
(
rst
=>
st_rst
,
clk
=>
st_clk
,
snk_out
=>
rx_fifo_siso
,
snk_in
=>
rx_fifo_sosi
,
src_out
=>
unpacked_sosi
);
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Rx packet monitors
-- Rx packet monitors
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
...
@@ -133,25 +189,15 @@ BEGIN
...
@@ -133,25 +189,15 @@ BEGIN
dp_clk
=>
st_clk
,
dp_clk
=>
st_clk
,
ref_sync
=>
ref_sync
,
ref_sync
=>
ref_sync
,
in_sosi_arr
(
0
)
=>
decod
ed_sosi
in_sosi_arr
(
0
)
=>
unpack
ed_sosi
);
);
p_crc_corrupt
:
PROCESS
(
st_clk
)
-- Rx CRC result is available at last octet
VARIABLE
v_I
:
NATURAL
;
crc_corrupt
<=
'1'
WHEN
rising_edge
(
st_clk
)
AND
unpacked_sosi
.
eop
=
'1'
AND
UNSIGNED
(
unpacked_data
)
/=
0
ELSE
'0'
;
VARIABLE
v_crc
:
STD_LOGIC_VECTOR
(
c_octet_w
-1
DOWNTO
0
);
BEGIN
IF
rising_edge
(
st_clk
)
THEN
v_I
:
=
TO_UINT
(
decoded_sosi
.
empty
(
1
DOWNTO
0
));
v_crc
:
=
decoded_sosi
.
data
((
v_I
+
1
)
*
c_octet_w
-1
DOWNTO
v_I
*
c_octet_w
);
crc_corrupt
<=
'0'
;
IF
decoded_sosi
.
eop
=
'1'
AND
UNSIGNED
(
v_crc
)
/=
0
THEN
crc_corrupt
<=
'1'
;
END
IF
;
END
IF
;
END
PROCESS
;
in_strobe_arr
(
0
)
<=
decoded_sosi
.
sop
;
-- count total nof Rx packets
in_strobe_arr
(
0
)
<=
unpacked_sosi
.
sop
;
-- count total nof Rx packets
in_strobe_arr
(
1
)
<=
crc_corrupt
;
-- count total nof corrupted Rx packets
in_strobe_arr
(
1
)
<=
unpacked_sosi
.
valid
;
-- count total nof Rx valid octets
in_strobe_arr
(
2
)
<=
crc_corrupt
;
-- count total nof corrupted Rx packets
u_dp_strobe_total_count
:
ENTITY
dp_lib
.
dp_strobe_total_count
u_dp_strobe_total_count
:
ENTITY
dp_lib
.
dp_strobe_total_count
GENERIC
MAP
(
GENERIC
MAP
(
...
@@ -163,7 +209,7 @@ BEGIN
...
@@ -163,7 +209,7 @@ BEGIN
dp_rst
=>
st_rst
,
dp_rst
=>
st_rst
,
dp_clk
=>
st_clk
,
dp_clk
=>
st_clk
,
ref_sync
=>
decod
ed_sosi
.
sync
,
ref_sync
=>
unpack
ed_sosi
.
sync
,
in_strobe_arr
=>
in_strobe_arr
,
in_strobe_arr
=>
in_strobe_arr
,
mm_rst
=>
mm_rst
,
mm_rst
=>
mm_rst
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment