Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Mock Turtle
Commits
5c0ef2d1
Commit
5c0ef2d1
authored
Aug 10, 2018
by
Dimitris Lampridis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sim: rework queue message class to have the message header unpacked for easier reference
parent
c03f3b5b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
37 deletions
+86
-37
mock_turtle_driver.svh
hdl/testbench/include/mock_turtle_driver.svh
+0
-4
mt_hmq_driver.svh
hdl/testbench/include/mt_hmq_driver.svh
+17
-8
mt_queue_message.svh
hdl/testbench/include/mt_queue_message.svh
+59
-21
main.sv
hdl/testbench/mock_turtle_core/main.sv
+4
-4
main.sv
hdl/testbench/mt_eth_ep/main.sv
+2
-0
main.sv
hdl/testbench/spec_mt_demo/main.sv
+2
-0
main.sv
hdl/testbench/svec_mt_demo/main.sv
+2
-0
No files found.
hdl/testbench/include/mock_turtle_driver.svh
View file @
5c0ef2d1
...
...
@@ -157,9 +157,6 @@ class MockTurtleDriver;
csr
.
notify_queue
[
core
]
=
{};
endtask
// get_cpu_notifications
task
handle_hmq_in_irq
()
;
endtask
// handle_hmq_in_irq
task
hmq_receive_message
(
ref
MQueueMsg
msg
)
;
msg
=
hmq
[
msg
.
core
]
.
receive_message
(
msg
.
slot
)
;
endtask
// hmq_receive_message
...
...
@@ -169,7 +166,6 @@ class MockTurtleDriver;
endtask
// hmq_send_message
task
hmq_purge
(
int
core
,
int
slot
)
;
hmq
[
core
]
.
purge
(
slot
)
;
endtask
// hmq_purge
...
...
hdl/testbench/include/mt_hmq_driver.svh
View file @
5c0ef2d1
...
...
@@ -129,16 +129,20 @@ class MQueueHost;
MQueueMsg
msg
;
u32_queue
hdr
;
csr
.
hmq_select
(
core
,
slot
)
;
msg
=
slots_out
[
slot
]
.
pop_back
()
;
hdr
=
msg
.
hdr_pack
()
;
outgoing_write
(
`MQUEUE_SLOT_COMMAND
,
`MQUEUE_CMD_CLAIM
)
;
for
(
int
i
=
0
;
i
<
msg
.
heade
r
.
size
()
;
i
++
)
for
(
int
i
=
0
;
i
<
hd
r
.
size
()
;
i
++
)
begin
outgoing_write
(
`MQUEUE_SLOT_HEADER
+
i
*
4
,
msg
.
heade
r
[
i
])
;
outgoing_write
(
`MQUEUE_SLOT_HEADER
+
i
*
4
,
hd
r
[
i
])
;
end
for
(
int
i
=
0
;
i
<
msg
.
data
.
size
()
;
i
++
)
for
(
int
i
=
0
;
i
<
msg
.
header
.
len
;
i
++
)
begin
outgoing_write
(
`MQUEUE_SLOT_DATA
+
i
*
4
,
msg
.
data
[
i
])
;
end
...
...
@@ -152,18 +156,23 @@ class MQueueHost;
uint32_t
val
;
uint32_t
hdr
[$]
;
csr
.
hmq_select
(
core
,
slot
)
;
msg
=
new
(
core
,
slot
)
;
msg
=
new
(
core
,
slot
)
;
hdr
=
{};
incoming_read
(
`MQUEUE_SLOT_HEADER
+
0
,
val
)
;
msg
.
heade
r
[
0
]
=
val
;
hd
r
[
0
]
=
val
;
incoming_read
(
`MQUEUE_SLOT_HEADER
+
4
,
val
)
;
msg
.
heade
r
[
1
]
=
val
;
hd
r
[
1
]
=
val
;
incoming_read
(
`MQUEUE_SLOT_HEADER
+
8
,
val
)
;
msg
.
header
[
2
]
=
val
;
hdr
[
2
]
=
val
;
msg
.
set_header
(
hdr
)
;
for
(
int
i
=
0
;
i
<
msg
.
header
[
1
]
&
32'h0000ffff
;
i
++
)
for
(
int
i
=
0
;
i
<
msg
.
header
.
len
;
i
++
)
begin
incoming_read
(
`MQUEUE_SLOT_DATA
+
4
*
i
,
val
)
;
msg
.
data
.
push_back
(
val
)
;
...
...
hdl/testbench/include/mt_queue_message.svh
View file @
5c0ef2d1
...
...
@@ -26,40 +26,78 @@
`ifndef
__
MT_MQUEUE_MSG_INCLUDED
`define
__MT_MQUEUE_MSG_INCLUDED
typedef
uint32_t
u32_queue
[$]
;
typedef
struct
{
uint32_t
app_id
;
uint32_t
flags
;
uint32_t
msg_id
;
uint32_t
len
;
uint32_t
sync_id
;
uint32_t
seq
;
}
mqueue_msg_header
;
class
MQueueMsg
;
int
core
;
int
slot
;
uint32_t
header
[$]
;
u
int32_t
data
[$]
;
mqueue_msg_header
header
;
u
32_queue
data
;
function
new
(
int
core
=
0
,
int
slot
=
0
)
;
function
new
(
int
core
=
0
,
int
slot
=
0
,
u32_queue
header
=
{},
u32_queue
data
=
{}
)
;
this
.
core
=
core
;
this
.
slot
=
slot
;
this
.
header
=
{};
this
.
data
=
{};
if
(
header
.
size
()
)
this
.
header
=
hdr_unpack
(
header
)
;
else
this
.
header
=
'
{
0
,
0
,
0
,
0
,
0
,
0
};
this
.
data
=
data
;
endfunction
// new
function
mqueue_msg_header
hdr_unpack
(
u32_queue
header
)
;
mqueue_msg_header
hdr
;
if
(
header
.
size
()
>
2
)
begin
hdr
.
app_id
=
header
[
0
]
&
32'h0000ffff
;
hdr
.
flags
=
(
header
[
0
]
&
32'h00ff0000
)
>>
16
;
hdr
.
msg_id
=
(
header
[
0
]
&
32'hff000000
)
>>
24
;
hdr
.
len
=
header
[
1
]
&
32'h0000ffff
;
hdr
.
sync_id
=
(
header
[
1
]
&
32'hffff0000
)
>>
16
;
hdr
.
seq
=
header
[
2
]
;
end
else
hdr
=
'
{
0
,
0
,
0
,
0
,
0
,
0
};
if
(
header
.
size
()
!=
3
)
$
warning
(
"incorrect message header size %0d"
,
header
.
size
()
)
;
return
hdr
;
endfunction
// hdr_unpack
task
set_header
(
u32_queue
header
)
;
this
.
header
=
hdr_unpack
(
header
)
;
endtask
// set_header
function
u32_queue
hdr_pack
(
)
;
u32_queue
hdr
;
hdr
[
0
]
=
header
.
app_id
&
'hffff
;
hdr
[
0
]
|=
(
header
.
flags
&
'hff
)
<<
16
;
hdr
[
0
]
|=
(
header
.
msg_id
&
'hff
)
<<
24
;
hdr
[
1
]
=
header
.
len
&
'hffff
;
hdr
[
1
]
|=
(
header
.
sync_id
&
'hffff
)
<<
16
;
hdr
[
2
]
=
header
.
seq
;
return
hdr
;
endfunction
// hdr_pack
function
string
tostring
()
;
uint32_t
app_id
;
uint32_t
flags
;
uint32_t
msg_id
;
uint32_t
len
;
uint32_t
sync_id
;
uint32_t
seq
;
string
hdr
,
dat
;
app_id
=
this
.
header
[
0
]
&
32'h0000ffff
;
flags
=
(
this
.
header
[
0
]
&
32'h00ff0000
)
>>
16
;
msg_id
=
(
this
.
header
[
0
]
&
32'hff000000
)
>>
24
;
len
=
this
.
header
[
1
]
&
32'h0000ffff
;
sync_id
=
(
this
.
header
[
1
]
&
32'hffff0000
)
>>
16
;
seq
=
this
.
header
[
2
]
;
hdr
=
$
sformatf
(
"APP_ID: 0x%4x, MSG_ID: 0x%2x, FLAGS: 0x%2x, LEN: %0d, SYNC_ID: 0x%4x, SEQ: %0d"
,
app_id
,
msg_id
,
flags
,
len
,
sync_id
,
seq
)
;
hdr
=
$
sformatf
(
{
"CPU%0d, SLOT%0d, APP_ID: 0x%4x, MSG_ID: 0x%2x, "
,
"FLAGS: 0x%2x, LEN: %0d, SYNC_ID: 0x%4x, SEQ: %0d"
},
core
,
slot
,
header
.
app_id
,
header
.
msg_id
,
header
.
flags
,
header
.
len
,
header
.
sync_id
,
header
.
seq
)
;
dat
=
" PAYLOAD:"
;
for
(
int
i
=
0
;
i
<
len
;
i
++
)
begin
for
(
int
i
=
0
;
i
<
header
.
len
;
i
++
)
begin
dat
=
{
dat
,
$
sformatf
(
" 0x%8x"
,
this
.
data
[
i
])
};
end
...
...
hdl/testbench/mock_turtle_core/main.sv
View file @
5c0ef2d1
...
...
@@ -104,10 +104,8 @@ module main;
inc_counter
()
;
ntf
.
delete
(
0
)
;
msg
=
new
(
0
,
0
)
;
msg
.
header
[
0
]
=
0
;
msg
.
header
[
1
]
=
1
;
msg
.
header
[
2
]
=
0
;
msg
.
data
[
0
]
=
0
;
msg
.
header
.
len
=
1
;
msg
.
data
[
0
]
=
0
;
drv
.
hmq_send_message
(
msg
)
;
end
endtask
// check_cpu_notifications
...
...
@@ -156,6 +154,8 @@ module main;
initial
begin
$
timeformat
(
-
6
,
3
,
"us"
,
10
)
;
#
10u
s
;
drv
=
new
(
Host
.
get_accessor
()
,
mt_base
,
IrqMonitor
)
;
...
...
hdl/testbench/mt_eth_ep/main.sv
View file @
5c0ef2d1
...
...
@@ -158,6 +158,8 @@ module main;
automatic
WBPacketSink
sink
=
new
(
U_wrf_sink
.
get_accessor
())
;
automatic
WBPacketSource
src
=
new
(
U_wrf_source
.
get_accessor
())
;
$
timeformat
(
-
6
,
3
,
"us"
,
10
)
;
#
10u
s
;
drv
=
new
(
Host
.
get_accessor
()
,
mt_base
,
IrqMonitor
)
;
...
...
hdl/testbench/spec_mt_demo/main.sv
View file @
5c0ef2d1
...
...
@@ -86,6 +86,8 @@ module main;
initial
begin
$
timeformat
(
-
6
,
3
,
"us"
,
10
)
;
@
(
posedge
DUT
.
rst_sys_n
)
;
@
(
posedge
DUT
.
clk_sys
)
;
...
...
hdl/testbench/svec_mt_demo/main.sv
View file @
5c0ef2d1
...
...
@@ -98,6 +98,8 @@ module main;
initial
begin
$
timeformat
(
-
6
,
3
,
"us"
,
10
)
;
@
(
posedge
DUT
.
rst_n_sys
)
;
@
(
posedge
DUT
.
clk_sys
)
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment