Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
H
hostCompiledSimulation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gaurav Kukreja
hostCompiledSimulation
Commits
70b806db
Commit
70b806db
authored
Sep 14, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged annotation dictionaries
Signed-off-by:
Gaurav Kukreja
<
gaurav@gauravk.in
>
parent
c2e6278f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
23 deletions
+36
-23
cacheSimInstrument.py
instrument/cacheSimInstrument.py
+36
-23
No files found.
instrument/cacheSimInstrument.py
View file @
70b806db
...
@@ -53,7 +53,7 @@ def addAnnotationToDict(dict, lineNum, annot):
...
@@ -53,7 +53,7 @@ def addAnnotationToDict(dict, lineNum, annot):
dict
[
lineNum
]
.
append
(
annot
)
dict
[
lineNum
]
.
append
(
annot
)
def
annotateVarFuncDecl
(
listISCFileNames
,
listISCFunctions
,
listGlobalVariables
,
listLocalVariables
):
def
annotateVarFuncDecl
(
listISCFileNames
,
listISCFunctions
,
listGlobalVariables
,
listLocalVariables
):
dictAnnotVarFuncDecl
=
OrderedDict
({})
dictAnnotVarFuncDecl
=
{}
SPInitAddress
=
0x1234
SPInitAddress
=
0x1234
...
@@ -304,7 +304,7 @@ def annotateVarFuncDecl(listISCFileNames, listISCFunctions, listGlobalVariables,
...
@@ -304,7 +304,7 @@ def annotateVarFuncDecl(listISCFileNames, listISCFunctions, listGlobalVariables,
return
dictAnnotVarFuncDecl
return
dictAnnotVarFuncDecl
def
annotateLoadStore
(
listISCFunctions
,
listObjdumpFunctions
,
listLSInfo
,
listGlobalVariables
,
listLocalVariables
):
def
annotateLoadStore
(
listISCFunctions
,
listObjdumpFunctions
,
listLSInfo
,
listGlobalVariables
,
listLocalVariables
):
dictAnnotLoadStore
=
OrderedDict
({})
dictAnnotLoadStore
=
{}
for
funcISC
in
listISCFunctions
:
for
funcISC
in
listISCFunctions
:
lineNumISC
=
funcISC
.
startLine
lineNumISC
=
funcISC
.
startLine
...
@@ -466,7 +466,30 @@ def generateOutputFileName(insOutputPath, inFileName):
...
@@ -466,7 +466,30 @@ def generateOutputFileName(insOutputPath, inFileName):
insOutputPath
=
inFilePath
insOutputPath
=
inFilePath
return
insOutputPath
+
inFileNameWOExt
+
"."
+
inFileExt
return
insOutputPath
+
inFileNameWOExt
+
"."
+
inFileExt
def
generateAnnotatedSourceFiles
(
dictAnnotVarFuncDecl
,
dictAnnotLoadStore
,
listISCFileNames
,
insOutputPath
):
def
unionDict
(
dict1
,
dict2
):
'''
Both Dictionaries have lists as values!!!
'''
dict
=
{}
for
key
in
list
(
set
(
dict1
.
keys
()
+
dict2
.
keys
())):
if
key
in
dict1
and
key
in
dict2
:
dict
[
key
]
=
dict1
[
key
]
+
dict2
[
key
]
continue
if
key
in
dict1
and
key
not
in
dict2
:
dict
[
key
]
=
dict1
[
key
]
continue
if
key
in
dict2
and
key
not
in
dict1
:
dict
[
key
]
=
dict2
[
key
]
continue
return
dict
def
generateAnnotatedSourceFiles
(
dictAnnot
,
listISCFileNames
,
insOutputPath
):
for
inFileName
in
listISCFileNames
:
for
inFileName
in
listISCFileNames
:
outFileName
=
generateOutputFileName
(
insOutputPath
,
inFileName
)
outFileName
=
generateOutputFileName
(
insOutputPath
,
inFileName
)
inFile
=
open
(
inFileName
,
"r"
)
inFile
=
open
(
inFileName
,
"r"
)
...
@@ -484,35 +507,23 @@ def generateAnnotatedSourceFiles(dictAnnotVarFuncDecl, dictAnnotLoadStore, listI
...
@@ -484,35 +507,23 @@ def generateAnnotatedSourceFiles(dictAnnotVarFuncDecl, dictAnnotLoadStore, listI
assert
(
m
is
not
None
)
assert
(
m
is
not
None
)
indent
=
m
.
group
(
"indent"
)
indent
=
m
.
group
(
"indent"
)
assert
dictAnnotLoadStore
assert
dictAnnot
assert
dictAnnotVarFuncDecl
if
lineNum
not
in
dictAnnot
VarFuncDecl
and
lineNum
not
in
dictAnnotLoadStore
:
if
lineNum
not
in
dictAnnot
:
outFile
.
write
(
line
)
outFile
.
write
(
line
)
continue
continue
replaceLine
=
False
replaceLine
=
False
if
lineNum
in
dictAnnotVarFuncDecl
:
if
lineNum
in
dictAnnot
:
for
annot
in
dictAnnotVarFuncDecl
[
lineNum
]:
for
annot
in
dictAnnot
[
lineNum
]:
if
annot
.
fileName
==
inFileName
and
annot
.
replace
==
True
:
replaceLine
=
True
if
lineNum
in
dictAnnotLoadStore
:
for
annot
in
dictAnnotLoadStore
[
lineNum
]:
if
annot
.
fileName
==
inFileName
and
annot
.
replace
==
True
:
if
annot
.
fileName
==
inFileName
and
annot
.
replace
==
True
:
replaceLine
=
True
replaceLine
=
True
if
replaceLine
==
False
:
if
replaceLine
==
False
:
outFile
.
write
(
line
)
outFile
.
write
(
line
)
if
lineNum
in
dictAnnotVarFuncDecl
:
for
annot
in
dictAnnot
[
lineNum
]:
for
annot
in
dictAnnotVarFuncDecl
[
lineNum
]:
if
annot
.
fileName
==
inFileName
:
outFile
.
write
(
indent
+
annot
.
annotation
+
"
\n
"
)
if
lineNum
in
dictAnnotLoadStore
:
for
annot
in
dictAnnotLoadStore
[
lineNum
]:
if
annot
.
fileName
==
inFileName
:
if
annot
.
fileName
==
inFileName
:
outFile
.
write
(
indent
+
annot
.
annotation
+
"
\n
"
)
outFile
.
write
(
indent
+
annot
.
annotation
+
"
\n
"
)
...
@@ -542,7 +553,9 @@ def instrumentCache(listISCFileNames, listObjdumpFileNames, listBinaryFileNames,
...
@@ -542,7 +553,9 @@ def instrumentCache(listISCFileNames, listObjdumpFileNames, listBinaryFileNames,
dictAnnotLoadStore
=
annotateLoadStore
(
listISCFunctions
,
listObjdumpFunctions
,
listLSInfo
,
listGlobalVariables
,
listLocalVariables
)
dictAnnotLoadStore
=
annotateLoadStore
(
listISCFunctions
,
listObjdumpFunctions
,
listLSInfo
,
listGlobalVariables
,
listLocalVariables
)
generateAnnotatedSourceFiles
(
dictAnnotVarFuncDecl
,
dictAnnotLoadStore
,
listISCFileNames
,
insOutputPath
)
dictAnnot
=
unionDict
(
dictAnnotVarFuncDecl
,
dictAnnotLoadStore
)
generateAnnotatedSourceFiles
(
dictAnnot
,
listISCFileNames
,
insOutputPath
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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