mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-06-28 09:16:22 -04:00
make it easier to get started with perf-model (#3008)
Related to issue #3007
This commit is contained in:
parent
2c881cba05
commit
9ab2df9112
2 changed files with 53 additions and 18 deletions
|
@ -347,7 +347,7 @@ class Model:
|
|||
"""Models the scheduling of CVA6"""
|
||||
|
||||
re_instr = re.compile(
|
||||
r"([a-z]+)\s+0:\s*0x00000000([0-9a-f]+)\s*\(([0-9a-fx]+)\)\s*@\s*([0-9]+)\s*(.*)"
|
||||
r"([a-z]+)\s+0:\s*0x0*([0-9a-f]+)\s*\(([0-9a-fx]+)\)\s*(@\s*[0-9]+)?\s*(.*)"
|
||||
)
|
||||
|
||||
def __init__(
|
||||
|
@ -549,14 +549,14 @@ class Model:
|
|||
|
||||
def write_trace(output_file, instructions):
|
||||
"""Write cycle-annotated trace"""
|
||||
pattern = re.compile(r"@\s*[0-9]+")
|
||||
pattern = re.compile(r"\)\s*(@\s*[0-9]+)? ")
|
||||
|
||||
lines = []
|
||||
for instr in instructions:
|
||||
commit_event = instr.events[-1]
|
||||
assert commit_event.kind == EventKind.commit
|
||||
cycle = commit_event.cycle
|
||||
annotated = re.sub(pattern, f"@ {cycle}", instr.line)
|
||||
annotated = re.sub(pattern, f") @ {cycle} ", instr.line)
|
||||
#if EventKind.STRUCT in [e.kind for e in instr.events]:
|
||||
# annotated += " #STRUCT"
|
||||
#if EventKind.RAW in [e.kind for e in instr.events]:
|
||||
|
@ -660,7 +660,9 @@ def main(input_file: str):
|
|||
model.run()
|
||||
|
||||
write_trace('annotated.log', model.retired)
|
||||
print_stats(filter_timed_part(model.retired))
|
||||
|
||||
#print_stats(filter_timed_part(model.retired))
|
||||
print_stats(model.retired)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue