Skip to content
GitLab
Explore
Sign in
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
3ef59d2d
Commit
3ef59d2d
authored
10 years ago
by
Eric Kooistra
Browse files
Options
Downloads
Patches
Plain Diff
Port the files that use eth_layers_pkg that now for $RADIOHDL is in common_lib.
parent
d9915ff3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/io/eth/src/vhdl/eth_hdr.vhd
+171
-0
171 additions, 0 deletions
libraries/io/eth/src/vhdl/eth_hdr.vhd
with
171 additions
and
0 deletions
libraries/io/eth/src/vhdl/eth_hdr.vhd
0 → 100644
+
171
−
0
View file @
3ef59d2d
-------------------------------------------------------------------------------
--
-- Copyright (C) 2010
-- ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
-- JIVE (Joint Institute for VLBI in Europe) <http://www.jive.nl/>
-- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-------------------------------------------------------------------------------
LIBRARY
IEEE
,
common_lib
,
dp_lib
;
USE
IEEE
.
std_logic_1164
.
ALL
;
USE
IEEE
.
numeric_std
.
ALL
;
USE
common_lib
.
common_pkg
.
ALL
;
USE
dp_lib
.
dp_stream_pkg
.
ALL
;
USE
common_lib
.
eth_layers_pkg
.
ALL
;
USE
work
.
eth_pkg
.
ALL
;
-- Description:
-- . Store the 11 word header and make the header info available for monitoring
-- . Direct snk to src via g_header_store_and_forward = FALSE
-- . Store and forward the header via g_header_store_and_forward = TRUE to allow:
-- 1) IP header checksum insertion for IP frames when g_ip_header_checksum_calculate = TRUE
-- 2) Discard frames that are shorter than 11 words (the minimal header size)
-- 3) Support option to discard frames based on their header info
ENTITY
eth_hdr
IS
GENERIC
(
g_header_store_and_forward
:
BOOLEAN
:
=
TRUE
;
g_ip_header_checksum_calculate
:
BOOLEAN
:
=
TRUE
);
PORT
(
-- Clocks and reset
rst
:
IN
STD_LOGIC
;
-- reset synchronous with clk
clk
:
IN
STD_LOGIC
;
-- packet stream clock
-- Streaming Sink
snk_in
:
IN
t_dp_sosi
;
snk_out
:
OUT
t_dp_siso
;
-- Streaming Source
src_in
:
IN
t_dp_siso
:
=
c_dp_siso_rdy
;
src_out
:
OUT
t_dp_sosi
;
-- Frame control
frm_discard
:
IN
STD_LOGIC
:
=
'0'
;
-- Header info
hdr_words
:
OUT
t_eth_total_header_arr
;
hdr_words_val
:
OUT
STD_LOGIC_VECTOR
(
0
TO
c_eth_total_header_nof_words
-1
);
hdr_fields
:
OUT
t_eth_total_header
;
hdr_fields_val
:
OUT
STD_LOGIC_VECTOR
(
0
TO
c_eth_total_header_nof_words
-1
);
hdr_data
:
OUT
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
hdr_data_val
:
OUT
STD_LOGIC
;
hdr_status
:
OUT
t_eth_hdr_status
);
END
eth_hdr
;
ARCHITECTURE
str
OF
eth_hdr
IS
-- Internal sink ready latency and source ready latency of this component
CONSTANT
c_this_snk_latency
:
NATURAL
:
=
1
;
CONSTANT
c_this_src_latency
:
NATURAL
:
=
1
;
SIGNAL
snk_in_word_cnt
:
NATURAL
RANGE
0
TO
c_eth_total_header_nof_words
;
-- Extract total header
SIGNAL
i_hdr_words
:
t_eth_total_header_arr
;
SIGNAL
i_hdr_words_val
:
STD_LOGIC_VECTOR
(
0
TO
c_eth_total_header_nof_words
-1
);
SIGNAL
i_hdr_fields
:
t_eth_total_header
;
SIGNAL
i_hdr_fields_val
:
STD_LOGIC_VECTOR
(
0
TO
c_eth_total_header_nof_words
-1
);
SIGNAL
i_hdr_data
:
STD_LOGIC_VECTOR
(
c_word_w
-1
DOWNTO
0
);
SIGNAL
i_hdr_data_val
:
STD_LOGIC
;
SIGNAL
i_hdr_status
:
t_eth_hdr_status
;
BEGIN
-- Make all header info available
hdr_words
<=
i_hdr_words
;
hdr_words_val
<=
i_hdr_words_val
;
hdr_fields
<=
i_hdr_fields
;
hdr_fields_val
<=
i_hdr_fields_val
;
hdr_data
<=
i_hdr_data
;
hdr_data_val
<=
i_hdr_data_val
;
hdr_status
<=
i_hdr_status
;
------------------------------------------------------------------------------
-- IP header checksum control
------------------------------------------------------------------------------
gen_ctrl
:
IF
g_header_store_and_forward
=
TRUE
GENERATE
-- Replace IP header checksum with the calculated checksum in case of IPv4, else pass on unchanged but discard frames shorter than 11 words
u_ip_hdr_ctrl
:
ENTITY
work
.
eth_hdr_ctrl
PORT
MAP
(
-- Clocks and reset
rst
=>
rst
,
clk
=>
clk
,
-- Stored header
hdr_words
=>
i_hdr_words
,
hdr_status
=>
i_hdr_status
,
-- ST interface
snk_in_word_cnt
=>
snk_in_word_cnt
,
snk_in
=>
snk_in
,
snk_out
=>
snk_out
,
src_in
=>
src_in
,
src_out
=>
src_out
);
END
GENERATE
;
no_ctrl
:
IF
g_header_store_and_forward
=
FALSE
GENERATE
-- Avoid the store and forward logic of eth_hdr_ctrl if it is not needed, although it would work OK to use it
src_out
<=
snk_in
;
snk_out
<=
src_in
;
END
GENERATE
;
------------------------------------------------------------------------------
-- Extract total header
------------------------------------------------------------------------------
-- Store 11 header words
u_hdr_store
:
ENTITY
work
.
eth_hdr_store
PORT
MAP
(
rst
=>
rst
,
clk
=>
clk
,
-- Streaming Sink
snk_in
=>
snk_in
,
snk_in_word_cnt
=>
snk_in_word_cnt
,
-- Total header
hdr_words
=>
i_hdr_words
,
hdr_words_val
=>
i_hdr_words_val
,
hdr_fields
=>
i_hdr_fields
,
hdr_fields_val
=>
i_hdr_fields_val
,
hdr_data
=>
i_hdr_data
,
hdr_data_val
=>
i_hdr_data_val
);
-- Determine header status
u_hdr_status
:
ENTITY
work
.
eth_hdr_status
GENERIC
MAP
(
g_ip_header_checksum_calculate
=>
g_ip_header_checksum_calculate
)
PORT
MAP
(
rst
=>
rst
,
clk
=>
clk
,
-- Total header
hdr_words
=>
i_hdr_words
,
hdr_words_val
=>
i_hdr_words_val
,
hdr_fields
=>
i_hdr_fields
,
hdr_fields_val
=>
i_hdr_fields_val
,
hdr_data
=>
i_hdr_data
,
hdr_data_val
=>
i_hdr_data_val
,
-- Header status
hdr_status
=>
i_hdr_status
);
END
str
;
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