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
3f044e04
Commit
3f044e04
authored
5 years ago
by
Reinier van der Walle
Browse files
Options
Downloads
Patches
Plain Diff
Replaced if else statements by switch
parent
190dcc54
No related branches found
No related tags found
2 merge requests
!10
Update branch to latest revision
,
!9
Resolve L2SDP-23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/io/nw_10GbE/src/vhdl/nw_ping_response.vhd
+28
-18
28 additions, 18 deletions
libraries/io/nw_10GbE/src/vhdl/nw_ping_response.vhd
with
28 additions
and
18 deletions
libraries/io/nw_10GbE/src/vhdl/nw_ping_response.vhd
+
28
−
18
View file @
3f044e04
...
@@ -60,7 +60,7 @@ ARCHITECTURE rtl of nw_ping_response IS
...
@@ -60,7 +60,7 @@ ARCHITECTURE rtl of nw_ping_response IS
CONSTANT
c_dp_fifo_size
:
NATURAL
:
=
16
;
CONSTANT
c_dp_fifo_size
:
NATURAL
:
=
16
;
CONSTANT
c_cin_w
:
NATURAL
:
=
4
;
CONSTANT
c_cin_w
:
NATURAL
:
=
4
;
CONSTANT
c_pipeline
:
NATURAL
:
=
c_network_total_header_64b_nof_words
+
3
;
-- Header length and
3
more pipeline cycles to allow for the other states
CONSTANT
c_pipeline
:
NATURAL
:
=
c_network_total_header_64b_nof_words
+
5
;
-- Header length and
5
more pipeline cycles to allow for the other states
TYPE
t_state
IS
(
s_idle
,
s_capture
,
s_check
,
s_sum
,
s_output
,
s_wait
);
TYPE
t_state
IS
(
s_idle
,
s_capture
,
s_check
,
s_sum
,
s_output
,
s_wait
);
...
@@ -150,23 +150,33 @@ BEGIN
...
@@ -150,23 +150,33 @@ BEGIN
WHEN
s_output
=>
-- Send out ICMP response
WHEN
s_output
=>
-- Send out ICMP response
v
.
src_out
:
=
dp_pipeline_src_out
;
v
.
src_out
:
=
dp_pipeline_src_out
;
IF
dp_pipeline_src_out
.
valid
=
'1'
THEN
IF
dp_pipeline_src_out
.
valid
=
'1'
THEN
IF
r
.
word_cnt
=
0
THEN
CASE
r
.
word_cnt
IS
WHEN
0
=>
-- Also perform final checksum calculation
-- Also perform final checksum calculation
IF
dp_pipeline_src_out
.
sop
=
'1'
THEN
-- Wait for SOP
v
.
src_out
.
data
(
c_data_w
-1
DOWNTO
0
)
:
=
r
.
hdr_response
(
r
.
word_cnt
);
v
.
ip_checksum
:
=
NOT
(
STD_LOGIC_VECTOR
(
r
.
ip_sum
(
c_halfword_w
-1
DOWNTO
0
)
+
r
.
ip_sum
(
r
.
ip_sum
'HIGH
DOWNTO
c_halfword_w
)));
-- checksum = inverted (sum + carry)
v
.
ip_checksum
:
=
NOT
(
STD_LOGIC_VECTOR
(
r
.
ip_sum
(
c_halfword_w
-1
DOWNTO
0
)
+
r
.
ip_sum
(
r
.
ip_sum
'HIGH
DOWNTO
c_halfword_w
)));
-- checksum = inverted (sum + carry)
v
.
icmp_checksum
:
=
TO_UVEC
((
2048
+
TO_UINT
(
r
.
hdr_fields
.
icmp
.
checksum
)),
c_halfword_w
);
-- checksum = original checksum + 0x0800 (incremental update)
v
.
icmp_checksum
:
=
TO_UVEC
((
2048
+
TO_UINT
(
r
.
hdr_fields
.
icmp
.
checksum
)),
c_halfword_w
);
-- checksum = original checksum + 0x0800 (incremental update)
v
.
word_cnt
:
=
r
.
word_cnt
+
1
;
ELSE
v
.
src_out
:
=
c_dp_sosi_rst
;
END
IF
;
END
IF
;
IF
r
.
word_cnt
<
c_network_total_header_64b_nof_words
THEN
WHEN
1
TO
2
=>
v
.
src_out
.
data
(
c_data_w
-1
DOWNTO
0
)
:
=
r
.
hdr_response
(
r
.
word_cnt
);
v
.
word_cnt
:
=
r
.
word_cnt
+
1
;
v
.
word_cnt
:
=
r
.
word_cnt
+
1
;
WHEN
3
=>
v
.
src_out
.
data
(
c_data_w
-1
DOWNTO
0
)
:
=
r
.
hdr_response
(
r
.
word_cnt
);
v
.
src_out
.
data
(
c_data_w
-1
DOWNTO
0
)
:
=
r
.
hdr_response
(
r
.
word_cnt
);
END
IF
;
IF
r
.
word_cnt
=
3
THEN
-- insert ip checksum
v
.
src_out
.
data
(
c_halfword_w
*
4
-1
DOWNTO
c_halfword_w
*
3
)
:
=
r
.
ip_checksum
;
v
.
src_out
.
data
(
c_halfword_w
*
4
-1
DOWNTO
c_halfword_w
*
3
)
:
=
r
.
ip_checksum
;
ELSIF
r
.
word_cnt
=
4
THEN
-- insert icmp checksum
v
.
word_cnt
:
=
r
.
word_cnt
+
1
;
WHEN
4
=>
v
.
src_out
.
data
(
c_data_w
-1
DOWNTO
0
)
:
=
r
.
hdr_response
(
r
.
word_cnt
);
v
.
src_out
.
data
(
c_halfword_w
*
2
-1
DOWNTO
c_halfword_w
)
:
=
r
.
icmp_checksum
;
v
.
src_out
.
data
(
c_halfword_w
*
2
-1
DOWNTO
c_halfword_w
)
:
=
r
.
icmp_checksum
;
ELSIF
dp_pipeline_src_out
.
eop
=
'1'
THEN
v
.
word_cnt
:
=
r
.
word_cnt
+
1
;
WHEN
OTHERS
=>
IF
dp_pipeline_src_out
.
eop
=
'1'
THEN
v
.
state
:
=
s_wait
;
v
.
state
:
=
s_wait
;
END
IF
;
END
IF
;
END
CASE
;
END
IF
;
END
IF
;
WHEN
s_wait
=>
WHEN
s_wait
=>
...
...
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