Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
White Rabbit core collection
Manage
Activity
Members
Labels
Plan
Issues
33
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
White Rabbit core collection
Commits
4f0fbbed
Commit
4f0fbbed
authored
13 years ago
by
Tomasz Wlostowski
Browse files
Options
Downloads
Patches
Plain Diff
EthPacketGenerator: added increasing pattern mode
parent
55475776
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sim/eth_packet.svh
+36
-10
36 additions, 10 deletions
sim/eth_packet.svh
with
36 additions
and
10 deletions
sim/eth_packet.svh
+
36
−
10
View file @
4f0fbbed
...
@@ -132,16 +132,26 @@ class EthPacket;
...
@@ -132,16 +132,26 @@ class EthPacket;
function
bit
equal
(
ref
EthPacket
b
,
int
flags
=
_
zero
);
function
bit
equal
(
ref
EthPacket
b
,
int
flags
=
_
zero
);
if
(
src
!=
b
.
src
||
dst
!=
b
.
dst
||
ethertype
!=
b
.
ethertype
)
if
(
src
!=
b
.
src
||
dst
!=
b
.
dst
||
ethertype
!=
b
.
ethertype
)
return
0
;
begin
$
display
(
"notequal: hdr"
);
return
0
;
end
if
(
is_q
^
b
.
is_q
)
if
(
is_q
^
b
.
is_q
)
return
0
;
begin
$
display
(
"notequal: q"
);
return
0
;
end
if
(
is_q
&&
(
vid
!=
b
.
vid
||
pcp
!=
b
.
pcp
))
if
(
is_q
&&
(
vid
!=
b
.
vid
||
pcp
!=
b
.
pcp
))
return
0
;
return
0
;
if
(
payload
!=
b
.
payload
)
if
(
payload
!=
b
.
payload
)
return
0
;
begin
$
display
(
"notequal: payload"
);
return
0
;
end
// return 0;
if
(
flags
&
CMP_STATUS
)
if
(
flags
&
CMP_STATUS
)
if
(
error
^
b
.
error
)
if
(
error
^
b
.
error
)
...
@@ -213,9 +223,10 @@ class EthPacketGenerator;
...
@@ -213,9 +223,10 @@ class EthPacketGenerator;
static
const
int
DMAC
=
(
1
<<
1
);
static
const
int
DMAC
=
(
1
<<
1
);
static
const
int
ETHERTYPE
=
(
1
<<
2
);
static
const
int
ETHERTYPE
=
(
1
<<
2
);
static
const
int
VID
=
(
1
<<
3
);
static
const
int
VID
=
(
1
<<
3
);
static
const
int
PCP
=
(
1
<<
4
);
static
const
int
PCP
=
(
1
<<
4
);
static
const
int
PAYLOAD
=
(
1
<<
5
);
static
const
int
PAYLOAD
=
(
1
<<
5
);
static
const
int
TX_OOB
=
(
1
<<
6
);
static
const
int
SEQ_PAYLOAD
=
(
1
<<
7
);
static
const
int
TX_OOB
=
(
1
<<
6
);
static
const
int
ALL
=
SMAC
|
DMAC
|
VID
|
ETHERTYPE
|
PCP
|
PAYLOAD
;
static
const
int
ALL
=
SMAC
|
DMAC
|
VID
|
ETHERTYPE
|
PCP
|
PAYLOAD
;
...
@@ -242,7 +253,7 @@ class EthPacketGenerator;
...
@@ -242,7 +253,7 @@ class EthPacketGenerator;
protected
function
dyn_array
random_bvec
(
int
size
);
protected
function
dyn_array
random_bvec
(
int
size
);
byte
v
[];
byte
v
[];
int
i
;
int
i
;
$
display
(
"RandomBVEC %d"
,
size
);
//
$display("RandomBVEC %d", size);
v
=
new
[
size
](
v
);
v
=
new
[
size
](
v
);
for
(
i
=
0
;
i
<
size
;
i
++
)
for
(
i
=
0
;
i
<
size
;
i
++
)
...
@@ -252,6 +263,18 @@ class EthPacketGenerator;
...
@@ -252,6 +263,18 @@ class EthPacketGenerator;
endfunction
// random_bvec
endfunction
// random_bvec
protected
function
dyn_array
seq_payload
(
int
size
);
byte
v
[];
int
i
;
v
=
new
[
size
](
v
);
for
(
i
=
0
;
i
<
size
;
i
++
)
v
[
i
]
=
i
;
return
v
;
endfunction
// random_bvec
function
automatic
EthPacket
gen
();
function
automatic
EthPacket
gen
();
EthPacket
pkt
;
EthPacket
pkt
;
...
@@ -266,16 +289,19 @@ class EthPacketGenerator;
...
@@ -266,16 +289,19 @@ class EthPacketGenerator;
pkt
.
is_q
=
template
.
is_q
;
pkt
.
is_q
=
template
.
is_q
;
pkt
.
vid
=
template
.
vid
;
pkt
.
vid
=
template
.
vid
;
pkt
.
pcp
=
template
.
pcp
;
pkt
.
pcp
=
template
.
pcp
;
pkt
.
has_smac
=
template
.
has_smac
;
$
display
(
"Size min %d max %d"
,
min_size
,
max_size
);
//
$display("Size min %d max %d", min_size, max_size);
if
(
r_flags
&
PAYLOAD
)
pkt
.
payload
=
random_bvec
($
dist_uniform
(
seed
,
min_size
,
max_size
));
if
(
r_flags
&
PAYLOAD
)
pkt
.
payload
=
random_bvec
($
dist_uniform
(
seed
,
min_size
,
max_size
));
else
if
(
r_flags
&
SEQ_PAYLOAD
)
pkt
.
payload
=
seq_payload
($
dist_uniform
(
seed
,
min_size
,
max_size
));
else
pkt
.
payload
=
template
.
payload
;
else
pkt
.
payload
=
template
.
payload
;
if
(
r_flags
&
TX_OOB
)
if
(
r_flags
&
TX_OOB
)
begin
begin
pkt
.
ts
.
frame_id
=
m_current_frame_id
++
;
pkt
.
ts
.
frame_id
=
m_current_frame_id
++
;
pkt
.
oob_type
=
TX_FID
;
pkt
.
oob_type
=
TX_FID
;
end
end
return
pkt
;
return
pkt
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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