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
5f2c4f34
Commit
5f2c4f34
authored
13 years ago
by
Tomasz Wlostowski
Browse files
Options
Downloads
Patches
Plain Diff
simulation models: added WBPacketSink
parent
b4ab815c
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sim/wb_packet_sink.svh
+91
-0
91 additions, 0 deletions
sim/wb_packet_sink.svh
with
91 additions
and
0 deletions
sim/wb_packet_sink.svh
0 → 100644
+
91
−
0
View file @
5f2c4f34
`ifndef
__
WB_PACKET_SINK_SVH
`define
__WB_PACKET_SINK_SVH
`include
"wb_packet_source.svh"
virtual
class
EthPacketSink
;
static
int
_
null
=
0
;
pure
virtual
function
int
poll
();
pure
virtual
task
recv
(
ref
EthPacket
pkt
,
ref
int
result
=
_
null
);
endclass
// EthPacketSink
class
WBPacketSink
extends
EthPacketSink
;
protected
CWishboneAccessor
m_acc
;
function
new
(
CWishboneAccessor
acc
);
m_acc
=
acc
;
endfunction
// new
function
int
poll
();
return
m_acc
.
poll
();
endfunction
// poll
protected
task
decode_status
(
uint64_t
stat
,
ref
EthPacket
pkt
);
if
(
stat
&
'h2
)
pkt
.
error
=
1'b1
;
else
begin
pkt
.
has_smac
=
(
stat
&
'h4
?
1'b1
:
1'b0
);
pkt
.
has_crc
=
(
stat
&
'h8
?
1'b1
:
1'b0
);
end
endtask
// decode_status
task
recv
(
ref
EthPacket
pkt
,
ref
int
result
=
_
null
);
byte
tmp
[];
wb_cycle_t
cyc
;
int
i
,
size
=
0
,
n
=
0
;
pkt
=
new
;
m_acc
.
get
(
cyc
);
for
(
i
=
0
;
i
<
cyc
.
data
.
size
();
i
++
)
if
(
cyc
.
data
[
i
].
a
==
WRF_DATA
)
size
=
size
+
cyc
.
data
[
i
].
size
;
tmp
=
new
[
size
];
$
display
(
"CDS %d size: %d
\n
"
,
cyc
.
data
.
size
(),
size
);
for
(
i
=
0
;
i
<
cyc
.
data
.
size
();
i
++
)
begin
wb_xfer_t
xf
=
cyc
.
data
[
i
];
case
(
xf
.
a
)
WRF_STATUS:
begin
decode_status
(
xf
.
d
,
pkt
);
if
(
pkt
.
error
)
break
;
end
WRF_DATA:
begin
if
(
xf
.
size
==
1
)
tmp
[
n
++
]
=
(
xf
.
d
&
'hff
);
else
if
(
xf
.
size
==
2
)
begin
tmp
[
n
++
]
=
((
xf
.
d
>>
8
)
&
'hff
);
tmp
[
n
++
]
=
(
xf
.
d
&
'hff
);
end
end
endcase
// case (xf.a)
end
pkt
.
deserialize
(
tmp
);
endtask
// recv
endclass
// WBPacketSink
`endif
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