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
52e05fde
Commit
52e05fde
authored
Jul 11, 2014
by
Gaurav Kukreja
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working map_cfg on sieve and adpcm :-))
Signed-off-by:
Gaurav Kukreja
<
gaurav@gauravk.in
>
parent
5039a4dd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
49 deletions
+91
-49
cfg_binary.py
map_cfg/cfg_binary.py
+2
-2
map_cfg.py
map_cfg/map_cfg.py
+89
-47
No files found.
map_cfg/cfg_binary.py
View file @
52e05fde
...
@@ -9,9 +9,9 @@ from cfg import *
...
@@ -9,9 +9,9 @@ from cfg import *
re_sectionStart
=
re
.
compile
(
'Disassembly of section .(.*):'
)
re_sectionStart
=
re
.
compile
(
'Disassembly of section .(.*):'
)
re_funcDef
=
re
.
compile
(
'
\
s*([0-9a-f]*)
\
s*<(.*)>:'
)
re_funcDef
=
re
.
compile
(
'
\
s*([0-9a-f]*)
\
s*<(.*)>:'
)
re_instruction
=
re
.
compile
(
'
\
s*([0-9a-f]*):
\
s*([0-9a-f]*)
\
s*(.*)'
)
re_instruction
=
re
.
compile
(
'
\
s*([0-9a-f]*):
\
s*([0-9a-f]*)
\
s*(.*)'
)
re_branchInst
=
re
.
compile
(
'
\
s*(b(?!ic)(?:l|x|lx|xj)?(?:eq|ne|mi|pl|hi|ls|ge|lt|gt|le)?)
\
s*([0-9a-f]*)
\
s*<(.*)>'
)
re_branchInst
=
re
.
compile
(
'
\
s*(b(?!ic)(?:l|x|lx|xj)?(?:eq|ne|
cs|hs|lo|cc|
mi|pl|hi|ls|ge|lt|gt|le)?)
\
s*([0-9a-f]*)
\
s*<(.*)>'
)
re_unconditionalBranchInst
=
re
.
compile
(
'
\
s*(b(?:l|x|lx|xj)?)
\
s*([0-9a-f]*)
\
s*<(.*)>'
)
re_unconditionalBranchInst
=
re
.
compile
(
'
\
s*(b(?:l|x|lx|xj)?)
\
s*([0-9a-f]*)
\
s*<(.*)>'
)
re_conditionalBranchInst
=
re
.
compile
(
'
\
s*(b(?:l|x|lx|xj)?(?:eq|ne|mi|pl|hi|ls|ge|lt|gt|le))
\
s*([0-9a-f]*)
\
s*<(.*)>'
)
re_conditionalBranchInst
=
re
.
compile
(
'
\
s*(b(?:l|x|lx|xj)?(?:eq|ne|
cs|hs|lo|cc|
mi|pl|hi|ls|ge|lt|gt|le))
\
s*([0-9a-f]*)
\
s*<(.*)>'
)
re_returnInst
=
re
.
compile
(
'
\
s*(bx)
\
s*(lr)'
)
re_returnInst
=
re
.
compile
(
'
\
s*(bx)
\
s*(lr)'
)
listFunctionsIgnore
=
[
'__cs3_interrupt_vector'
,
listFunctionsIgnore
=
[
'__cs3_interrupt_vector'
,
...
...
map_cfg/map_cfg.py
View file @
52e05fde
...
@@ -156,30 +156,51 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
...
@@ -156,30 +156,51 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
for
succSucc1BlockISC
in
cfgISC
.
successorBlocks
(
succ1BlockISC
):
for
succSucc1BlockISC
in
cfgISC
.
successorBlocks
(
succ1BlockISC
):
if
succSucc1BlockISC
in
mappingStackISC
:
if
succSucc1BlockISC
in
mappingStackISC
:
continue
continue
if
succSucc1BlockISC
in
(
set
(
listSuccISC
)
-
{
succ1BlockISC
}):
for
succ2BlockISC
in
list
(
set
(
listSuccISC
)
-
{
succ1BlockISC
}):
# case 1
if
succ2BlockISC
in
mappingStackISC
:
print
"
\t\t
case 1"
for
succSuccSucc1BlockISC
in
cfgISC
.
successorBlocks
(
succSucc1BlockISC
):
if
succSuccSucc1BlockISC
in
mappingStackISC
:
continue
for
succBlockObj
in
listSuccObj
:
if
succBlockObj
in
mappingStackObj
:
continue
continue
if
succSucc1BlockISC
==
succ2BlockISC
:
# case 1
print
"
\t\t
case 1"
mappingStackISC
.
append
(
succ1BlockISC
)
mappingStackISC
.
append
(
succ1BlockISC
)
mappingStackISC
.
append
(
succSucc1BlockISC
)
mappingStackObj
.
pop
()
# popping blockIndObj, because mapping it again
if
mapping
(
cfgISC
,
succSuccSucc1BlockISC
,
cfgObj
,
succBlockObj
,
mergedLevelsISC
+
1
)
==
0
:
if
mapping
(
cfgISC
,
succ2BlockISC
,
cfgObj
,
blockIndObj
,
mergedLevelsISC
+
1
)
==
0
:
cfgISC
.
listBlocks
[
blockIndISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
blockIndISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ1BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ1BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succSucc1BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ2BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgObj
.
listBlocks
[
blockIndObj
]
.
mapsTo
.
append
(
succSucc1BlockISC
)
cfgObj
.
listBlocks
[
blockIndObj
]
.
mapsTo
.
append
(
succ2BlockISC
)
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackObj
.
pop
()
return
0
return
0
else
:
else
:
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackObj
.
append
(
blockIndObj
)
# if succSucc1BlockISC in (set(listSuccISC) - {succ1BlockISC}):
# # case 1
# print "\t\tcase 1"
# for succSuccSucc1BlockISC in cfgISC.successorBlocks(succSucc1BlockISC):
# if succSuccSucc1BlockISC in mappingStackISC:
# continue
# for succBlockObj in listSuccObj:
# if succBlockObj in mappingStackObj:
# continue
# mappingStackISC.append(succ1BlockISC)
# mappingStackISC.append(succSucc1BlockISC)
# if mapping(cfgISC, succSuccSucc1BlockISC, cfgObj, succBlockObj, mergedLevelsISC+1) == 0:
# cfgISC.listBlocks[blockIndISC].mapsTo.append(blockIndObj)
# cfgISC.listBlocks[succ1BlockISC].mapsTo.append(blockIndObj)
# cfgISC.listBlocks[succSucc1BlockISC].mapsTo.append(blockIndObj)
# cfgObj.listBlocks[blockIndObj].mapsTo.append(succSucc1BlockISC)
# mappingStackISC.pop()
# mappingStackISC.pop()
# mappingStackISC.pop()
# mappingStackObj.pop()
# return 0
# else:
# mappingStackISC.pop()
# mappingStackISC.pop()
for
succ2BlockISC
in
list
(
set
(
listSuccISC
)
-
{
succ1BlockISC
}):
for
succ2BlockISC
in
list
(
set
(
listSuccISC
)
-
{
succ1BlockISC
}):
if
succ2BlockISC
in
mappingStackISC
:
if
succ2BlockISC
in
mappingStackISC
:
...
@@ -189,17 +210,11 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
...
@@ -189,17 +210,11 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
continue
continue
if
succSucc1BlockISC
==
succSucc2BlockISC
:
if
succSucc1BlockISC
==
succSucc2BlockISC
:
# case 2
# case 2
print
"
\t\t
case 2"
print
"
\t\t
case 2"
for
succSuccSucc1BlockISC
in
cfgISC
.
successorBlocks
(
succSucc1BlockISC
):
if
succSuccSucc1BlockISC
in
mappingStackISC
:
continue
for
succBlockObj
in
listSuccObj
:
if
succBlockObj
in
mappingStackObj
:
continue
mappingStackISC
.
append
(
succ1BlockISC
)
mappingStackISC
.
append
(
succ1BlockISC
)
mappingStackISC
.
append
(
succ2BlockISC
)
mappingStackISC
.
append
(
succ2BlockISC
)
mappingStackISC
.
append
(
succSucc1BlockISC
)
mappingStackObj
.
pop
()
# popping blockIndObj, because mapping it again
if
mapping
(
cfgISC
,
succSuccSucc1BlockISC
,
cfgObj
,
succBlockObj
,
mergedLevelsISC
+
2
)
==
0
:
if
mapping
(
cfgISC
,
succSucc1BlockISC
,
cfgObj
,
blockIndObj
,
mergedLevelsISC
+
2
)
==
0
:
cfgISC
.
listBlocks
[
blockIndISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
blockIndISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ1BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ1BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ2BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
cfgISC
.
listBlocks
[
succ2BlockISC
]
.
mapsTo
.
append
(
blockIndObj
)
...
@@ -208,24 +223,51 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
...
@@ -208,24 +223,51 @@ def mapping(cfgISC, blockIndISC, cfgObj, blockIndObj, mergedLevelsISC):
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackObj
.
pop
()
return
0
return
0
else
:
else
:
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackISC
.
pop
()
mappingStackObj
.
append
(
blockIndObj
)
# for succSuccSucc1BlockISC in cfgISC.successorBlocks(succSucc1BlockISC):
# if succSuccSucc1BlockISC in mappingStackISC:
# continue
# for succBlockObj in listSuccObj:
# if succBlockObj in mappingStackObj:
# continue
# mappingStackISC.append(succ1BlockISC)
# mappingStackISC.append(succ2BlockISC)
# mappingStackISC.append(succSucc1BlockISC)
# if mapping(cfgISC, succSuccSucc1BlockISC, cfgObj, succBlockObj, mergedLevelsISC+2) == 0:
# cfgISC.listBlocks[blockIndISC].mapsTo.append(blockIndObj)
# cfgISC.listBlocks[succ1BlockISC].mapsTo.append(blockIndObj)
# cfgISC.listBlocks[succ2BlockISC].mapsTo.append(blockIndObj)
# cfgISC.listBlocks[succSucc1BlockISC].mapsTo.append(blockIndObj)
# cfgObj.listBlocks[blockIndObj].mapsTo.append(succSucc1BlockISC)
# mappingStackISC.pop()
# mappingStackISC.pop()
# mappingStackISC.pop()
# mappingStackISC.pop()
# mappingStackObj.pop()
# return 0
# else:
# mappingStackISC.pop()
# mappingStackISC.pop()
# mappingStackISC.pop()
else
:
else
:
print
"no. of successors not same, and difference more than one."
print
"no. of successors not same, and difference more than one."
print
"ISC Block
%
d; Obj Block
%
d"
%
(
blockIndISC
,
blockIndObj
)
print
"ISC Block
%
d; Obj Block
%
d"
%
(
blockIndISC
,
blockIndObj
)
exit
(
1
)
exit
(
1
)
for
succBlockISC
in
listSuccISC
:
print
"Successors of ISC:
%
d"
%
(
blockIndISC
),
print
cfgISC
.
successorBlocks
(
blockIndISC
)
for
succBlockISC
in
cfgISC
.
successorBlocks
(
blockIndISC
):
if
succBlockISC
in
mappingStackISC
:
if
succBlockISC
in
mappingStackISC
:
continue
continue
for
succBlockObj
in
listSuccObj
:
for
succBlockObj
in
listSuccObj
:
if
succBlockObj
in
mappingStackObj
:
if
succBlockObj
in
mappingStackObj
:
continue
continue
print
"recursing on mapping"
if
mapping
(
cfgISC
,
succBlockISC
,
cfgObj
,
succBlockObj
,
mergedLevelsISC
)
==
0
:
if
mapping
(
cfgISC
,
succBlockISC
,
cfgObj
,
succBlockObj
,
mergedLevelsISC
)
==
0
:
blockISC
.
mapsTo
.
append
(
blockIndObj
)
blockISC
.
mapsTo
.
append
(
blockIndObj
)
blockObj
.
mapsTo
.
append
(
blockIndISC
)
blockObj
.
mapsTo
.
append
(
blockIndISC
)
...
...
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