Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alan Marchiori
SodorProfiler
Commits
a364d7bc
Commit
a364d7bc
authored
Oct 17, 2018
by
Alan Marchiori
Browse files
now supports 5stage output
parent
735485dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
profile.py
View file @
a364d7bc
...
...
@@ -109,6 +109,7 @@ type_lut = {
'slti'
:
'arth'
,
'slt'
:
'arth'
,
'snez'
:
'arth'
,
'-'
:
'nop'
,
# nop and such
}
def
profile
(
f
,
itypes
=
type_lut
):
...
...
@@ -119,21 +120,27 @@ def profile(f, itypes = type_lut):
results
=
{
k
:
0
for
k
in
set
(
itypes
.
values
())}
i
=
0
with
open
(
f
,
'r'
)
as
of
:
i
+=
1
for
line
in
of
:
if
line
.
startswith
(
'Cyc'
):
#someone change this to a regex.
instruction
=
line
[
124
:
-
1
]
#strip newline
op
=
instruction
.
split
(
" "
)[
0
]
if
'PC='
in
line
:
instruction
=
line
[
124
:].
strip
()
elif
'ExeInst'
in
line
:
instruction
=
line
[
113
:].
strip
()
else
:
raise
(
"Unsuppoted out file."
)
op
=
instruction
.
split
()[
0
]
if
op
not
in
itypes
:
print
(
"Insturction on line {}: {}, is not supported."
.
format
(
print
(
"Insturction on line {}:
'
{}
'
, is not supported."
.
format
(
i
,
op
))
print
(
line
.
strip
())
exit
(
-
5
)
results
[
itypes
[
op
]]
+=
1
return
results
...
...
@@ -142,7 +149,7 @@ if __name__== "__main__":
parser
.
add_argument
(
'outfile'
,
default
=
None
,
nargs
=
'*'
,
help
=
'the .out file to process.'
)
args
=
parser
.
parse_args
()
if
args
.
outfile
==
[]:
parser
.
print_usage
()
exit
(
-
1
)
...
...
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