Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SoCTools Flow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
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
SoCLabs
SoCTools Flow
Commits
f931478e
Commit
f931478e
authored
1 year ago
by
dam1n19
Browse files
Options
Downloads
Patches
Plain Diff
Moved ADP Verify script into soctools
parent
74d6c1bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/adp_verify.py
+95
-0
95 additions, 0 deletions
tools/adp_verify.py
with
95 additions
and
0 deletions
tools/adp_verify.py
0 → 100644
+
95
−
0
View file @
f931478e
#-----------------------------------------------------------------------------
# ADP Command File Verification Script
# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license.
#
# Contributors
#
# David Mapstone (d.a.mapstone@soton.ac.uk)
#
# Copyright � 2021-3, SoC Labs (www.soclabs.org)
#-----------------------------------------------------------------------------
class
address_region
():
def
__init__
(
self
,
base
,
size
):
self
.
base
=
base
self
.
size
=
size
self
.
end
=
base
+
size
-
4
class
read_word
():
def
__init__
(
self
,
index
,
region
,
address
,
read_data
=
0
,
exp_data
=
0
):
self
.
index
=
index
self
.
region
=
region
self
.
address
=
int
(
str
(
address
),
16
)
self
.
read_data
=
int
(
str
(
read_data
),
16
)
self
.
exp_data
=
int
(
str
(
exp_data
),
16
)
def
validate
(
self
):
if
(
self
.
address
>=
self
.
region
.
base
and
self
.
address
<=
self
.
region
.
end
):
return
True
else
:
return
False
def
check_address
(
self
,
address
):
# print(f"self: {hex(self.address)} test: {address}")
if
(
self
.
address
==
int
(
str
(
address
),
16
)):
return
True
else
:
return
False
def
set_read_data
(
self
,
read_data
):
self
.
read_data
=
int
(
read_data
,
16
)
def
set_exp_data
(
self
,
exp_data
):
self
.
exp_data
=
int
(
exp_data
,
16
)
def
verify
(
self
):
assert
(
self
.
read_data
==
self
.
exp_data
)
def
adp_verify
(
adp_input
,
adp_output
,
out_log
):
# Create Input Region for Accelerator
accel_input_port
=
address_region
(
base
=
0x6001_0000
,
size
=
0x0000_0800
)
accel_output_port
=
address_region
(
base
=
0x6001_0800
,
size
=
0x0000_0800
)
word_list
=
[]
temp_address_buf
=
0x0
# Read in adp input
adp_input_lines
=
open
(
adp_input
,
"
r
"
).
readlines
()
idx
=
0
for
line
in
adp_input_lines
:
line_split
=
str
(
line
).
split
()
if
len
(
line_split
)
>
1
:
if
line_split
[
0
].
lower
()
==
"
a
"
:
# Capture Address
temp_address_buf
=
line_split
[
1
]
if
line_split
[
0
].
lower
()
==
"
r
"
:
temp_read_word
=
read_word
(
idx
,
accel_output_port
,
temp_address_buf
,
exp_data
=
line_split
[
1
])
if
temp_read_word
.
validate
():
word_list
.
append
(
temp_read_word
)
idx
+=
1
# Read in adp output
adp_output_lines
=
open
(
adp_output
,
"
r
"
).
readlines
()
idx
=
0
temp_address_buf
=
0x0
for
line
in
adp_output_lines
:
line_split
=
str
(
line
).
split
()
if
len
(
line_split
)
>
1
:
if
line_split
[
0
]
==
"
]A
"
:
# Capture Address
temp_address_buf
=
line_split
[
1
]
if
line_split
[
0
]
==
"
]R
"
:
if
word_list
[
idx
].
check_address
(
temp_address_buf
):
word_list
[
idx
].
set_read_data
(
line_split
[
1
])
idx
+=
1
# Perform Verification
for
word
in
word_list
:
word
.
verify
()
print
(
f
"
Tests Passed on
{
len
(
word_list
)
}
reads
"
)
if
__name__
==
"
__main__
"
:
adp_input
=
"
ft1248_ip.log
"
adp_output
=
"
ft1248_op.log
"
output_log
=
"
verify.log
"
adp_verify
(
adp_input
,
adp_output
,
output_log
)
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