Skip to content

Commit

Permalink
Update CPU output format
Browse files Browse the repository at this point in the history
  • Loading branch information
minseongg committed Sep 5, 2024
1 parent 5da3c5c commit 44e50e1
Show file tree
Hide file tree
Showing 11 changed files with 627,881 additions and 627,868 deletions.
18 changes: 15 additions & 3 deletions hazardflow-designs/src/cpu/wb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,24 @@ pub fn wb(i: I<VrH<MemEP, WbR>, { Dep::Demanding }>) {
if let Some(p) = ip {
match p.wb {
Some(r) => {
display!("retire=[1] pc=[%x] write=[r%d=%x]", ip.map(|x| x.debug_pc).unwrap_or(0), r.addr, r.data)
display!(
"retire=[1] pc=[%x] inst=[%x] write=[r%d=%x]",
ip.map(|x| x.debug_pc).unwrap_or(0),
ip.map(|x| x.debug_inst).unwrap_or(0),
r.addr,
r.data
);
}
None => {
display!(
"retire=[1] pc=[%x] inst=[%x]",
ip.map(|x| x.debug_pc).unwrap_or(0),
ip.map(|x| x.debug_inst).unwrap_or(0)
);
}
None => display!("retire=[1] pc=[%x]", ip.map(|x| x.debug_pc).unwrap_or(0)),
}
} else {
display!("retire=[0] pc=[%x]", ip.map(|x| x.debug_pc).unwrap_or(0))
display!("retire=[0]");
}

(ir, rf_next)
Expand Down
22 changes: 11 additions & 11 deletions scripts/cpu/cpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

from constants import *

# Match on committed instructions
CHISEL_INST_RE = re.compile(r"[^\[]*\[1\].*DASM\(([0-9A-Fa-f]+)\)")


class SodorCpiCalculator:
# Initialize your new counters to 0 here
Expand Down Expand Up @@ -40,7 +37,8 @@ def calculate_cpi(arg):
logger.info("Comparing CPI with baseline")

tracer = SodorCpiCalculator()
hf_retire_template = compile("[{}] retire=[{}] pc=[{}]{}")

hf_retire_template = compile("[{}] retire=[1] pc=[{}]{}\n")

failed = False
for bench in BENCHES:
Expand All @@ -50,18 +48,20 @@ def calculate_cpi(arg):
file = f"{cpu_script_dir}/output/{bench}.txt"
with open(file, "r") as f:
for line in f:
if "retire" in line:
if "retire=[1]" in line:
parsed = hf_retire_template.parse(line)
pc = parsed[2]
pc = parsed[1]
if pc == "80000000":
start_benchmark = True
if not start_benchmark:
continue
retired = int(parsed[1])
if retired:
tracer.retire()
else:
tracer.bubble()
tracer.retire()
elif "retire=[0]" in line:
if not start_benchmark:
continue
tracer.bubble()
else:
pass
cpi = tracer.cpi()

ratio = cpi / BASELINE_CPI[bench]
Expand Down
Loading

0 comments on commit 44e50e1

Please sign in to comment.