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
e798aa45
Commit
e798aa45
authored
Jul 25, 2018
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust mock_turtle_core test: ensure rmq is ok.
parent
a3c94bad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
main.sv
hdl/testbench/mock_turtle_core/main.sv
+8
-5
sim-verif.c
tests/firmware/sim-verif/sim-verif.c
+29
-3
No files found.
hdl/testbench/mock_turtle_core/main.sv
View file @
e798aa45
...
...
@@ -143,11 +143,14 @@ module main;
endtask
:
check_debug_interface
task
check_final_count
(
uint32_t
expected
)
;
#
500u
s
;
if
(
count
!=
expected
)
$
fatal
(
1
,
"Simulation FAILED: incorrect final count (%0d, expected %0d)"
,
count
,
expected
)
;
uint32_t
val
;
#
300u
s
;
drv
.
smem_read
(
0
,
val
)
;
if
(
val
!=
expected
)
$
fatal
(
1
,
"Simulation FAILED: incorrect final count (%0d, expected %0d)"
,
val
,
expected
)
;
else
$
display
(
"Simulation PASSED"
)
;
$
display
(
"Simulation PASSED"
)
;
$
finish
;
endtask
// check_final_result
...
...
@@ -166,7 +169,7 @@ module main;
check_debug_interface
(
0
)
;
fork
check_final_count
(
11
)
;
check_final_count
(
240
)
;
join_none
count
=
0
;
...
...
tests/firmware/sim-verif/sim-verif.c
View file @
e798aa45
...
...
@@ -85,12 +85,34 @@ test_hmq(void)
failed
(
'k'
);
}
static
char
hex
[]
=
"0123456789abcdef"
;
static
void
put_hex
(
unsigned
char
c
)
{
putchar
(
hex
[
c
>>
4
]);
putchar
(
hex
[
c
&
0xf
]);
}
unsigned
bswap32
(
unsigned
v
)
{
return
((
v
&
0xff
)
<<
24
)
|
((
v
&
0xff00
)
<<
8
)
|
((
v
>>
8
)
&
0xff00
)
|
((
v
>>
24
)
&
0xff
);
}
static
void
test_rmq
(
void
)
{
int
i
;
char
*
p
;
unsigned
*
p32
;
unsigned
*
hdr
;
union
{
unsigned
char
b
[
sizeof
(
msg
)];
unsigned
int
w
[(
sizeof
(
msg
)
+
3
)
/
4
];
}
buf
;
puts
(
"#4 rmq
\n
"
);
...
...
@@ -111,11 +133,13 @@ test_rmq(void)
// Read answer
hdr
=
mq_map_in_header
(
TRTL_RMQ
,
0
);
if
(
hdr
[
1
]
!=
(
sizeof
(
msg
)
+
3
)
/
4
)
if
(
hdr
[
1
]
!=
(
(
sizeof
(
msg
)
+
3
)
/
4
)
*
4
-
2
)
failed
(
'R'
);
p
=
mq_map_in_buffer
(
TRTL_RMQ
,
0
);
p32
=
mq_map_in_buffer
(
TRTL_RMQ
,
0
);
for
(
i
=
0
;
i
<
(
sizeof
(
msg
)
+
3
)
/
4
;
i
++
)
buf
.
w
[
i
]
=
bswap32
(
p32
[
i
]);
for
(
i
=
0
;
i
<
sizeof
(
msg
);
i
++
)
if
(
p
[
i
]
!=
msg
[
i
])
if
(
buf
.
b
[
i
]
!=
msg
[
i
])
failed
(
'r'
);
mq_discard
(
TRTL_RMQ
,
0
);
...
...
@@ -140,6 +164,8 @@ main(void)
test_rmq
();
counts
[
cpu
]
=
0xf0
;
puts
(
"Done
\n
"
);
return
0
;
...
...
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