Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions fud2/rsrc/hls.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
part=xczu3eg-sbva484-1-e

[hls]
clock=7
syn.cflags=-std=c++11 -DVHLS
syn.file=./kernel.cpp
46 changes: 0 additions & 46 deletions fud2/rsrc/hls.tcl

This file was deleted.

17 changes: 12 additions & 5 deletions fud2/scripts/hls.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ export const hls_impl_report_state = state("hls-impl-report", ["json"]);
fn hls_setup(e) {
e.config_var_or("vitis-hls-top", "vitis-hls.top", "kernel");

e.rsrc("hls.tcl");
e.rsrc("hls.cfg");

e.rule("vitis-hls", "vitis_hls -f hls.tcl -tclargs top $vitis-hls-top > /dev/null");
e.rule("vitis-hls-impl", "vitis_hls -f hls.tcl -tclargs top $vitis-hls-top impl > /dev/null");
e.rule(
"vitis-hls",
"v++ -c --mode hls --config hls.cfg --work_dir out --hls.syn.top=$vitis-hls-top > /dev/null",
);
e.rule(
"vitis-hls-impl",
"vitis-run --impl --config hls.cfg --work_dir out --hls.syn.top=$vitis-hls-top > /dev/null",
);

e.rule("extract-hls-json", "synthrep summary -m hls --top $vitis-hls-top > $out");
e.rule("extract-hls-impl-json", "synthrep summary -m hls-impl --top $vitis-hls-top > $out");
Expand All @@ -21,8 +27,9 @@ fn hls_build(e, input, output, impl) {
let suffix = if impl { "-impl" } else { "" };

e.build_cmd(["kernel.cpp"], "copy", [input], []);
e.build_cmd(["IGNOREME"], `vitis-hls${suffix}`, [], ["kernel.cpp", "hls.tcl"]);
e.build_cmd([output], `extract-hls${suffix}-json`, ["IGNOREME"], []);
e.build_cmd(["hls-out"], "vitis-hls", [], ["kernel.cpp", "hls.cfg"]);
e.build_cmd(["hls-impl-out"], "vitis-hls-impl", ["hls-out"], []);
e.build_cmd([output], `extract-hls${suffix}-json`, [`hls${suffix}-out`], []);
}

op(
Expand Down
11 changes: 6 additions & 5 deletions fud2/tests/snapshots/tests__test@plan_vitis-hls-impl.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ rule get-rsrc
command = $build-tool get-rsrc $out

vitis-hls-top = kernel
build hls.tcl: get-rsrc
build hls.cfg: get-rsrc
rule vitis-hls
command = vitis_hls -f hls.tcl -tclargs top $vitis-hls-top > /dev/null
command = v++ -c --mode hls --config hls.cfg --work_dir out --hls.syn.top=$vitis-hls-top > /dev/null
rule vitis-hls-impl
command = vitis_hls -f hls.tcl -tclargs top $vitis-hls-top impl > /dev/null
command = vitis-run --impl --config hls.cfg --work_dir out --hls.syn.top=$vitis-hls-top > /dev/null
rule extract-hls-json
command = synthrep summary -m hls --top $vitis-hls-top > $out
rule extract-hls-impl-json
Expand All @@ -20,7 +20,8 @@ rule copy
command = cp $in $out

build kernel.cpp: copy /input.ext
build IGNOREME: vitis-hls-impl | kernel.cpp hls.tcl
build /output.ext: extract-hls-impl-json IGNOREME
build hls-out: vitis-hls | kernel.cpp hls.cfg
build hls-impl-out: vitis-hls-impl hls-out
build /output.ext: extract-hls-impl-json hls-impl-out

default /output.ext
11 changes: 6 additions & 5 deletions fud2/tests/snapshots/tests__test@plan_vitis-hls.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ rule get-rsrc
command = $build-tool get-rsrc $out

vitis-hls-top = kernel
build hls.tcl: get-rsrc
build hls.cfg: get-rsrc
rule vitis-hls
command = vitis_hls -f hls.tcl -tclargs top $vitis-hls-top > /dev/null
command = v++ -c --mode hls --config hls.cfg --work_dir out --hls.syn.top=$vitis-hls-top > /dev/null
rule vitis-hls-impl
command = vitis_hls -f hls.tcl -tclargs top $vitis-hls-top impl > /dev/null
command = vitis-run --impl --config hls.cfg --work_dir out --hls.syn.top=$vitis-hls-top > /dev/null
rule extract-hls-json
command = synthrep summary -m hls --top $vitis-hls-top > $out
rule extract-hls-impl-json
Expand All @@ -20,7 +20,8 @@ rule copy
command = cp $in $out

build kernel.cpp: copy /input.ext
build IGNOREME: vitis-hls | kernel.cpp hls.tcl
build /output.ext: extract-hls-json IGNOREME
build hls-out: vitis-hls | kernel.cpp hls.cfg
build hls-impl-out: vitis-hls-impl hls-out
build /output.ext: extract-hls-json hls-out

default /output.ext
6 changes: 3 additions & 3 deletions tools/report-parsing/synthrep/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def hls_summary(dir, top):
def hls_impl_summary(dir, top):
print(
place_and_route_extract(
Path(dir, "solution1", "impl", "verilog", "report"),
Path(dir, "hls", "impl", "verilog", "report"),
PurePath(f"{top}_utilization_routed.rpt"),
PurePath(f"{top}_timing_routed.rpt"),
PurePath(f"{top}_utilization_synth.rpt"),
Expand Down Expand Up @@ -148,9 +148,9 @@ def main():
case "hierarchy":
hierarchy_summary(args.directory or "out")
case "hls":
hls_summary(args.directory or "benchmark.prj", args.top)
hls_summary(args.directory or "out", args.top)
case "hls-impl":
hls_impl_summary(args.directory or "benchmark.prj", args.top)
hls_impl_summary(args.directory or "out", args.top)
case "viz":
match args.type:
case "flamegraph":
Expand Down
4 changes: 2 additions & 2 deletions tools/report-parsing/synthrep/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ def place_and_route_extract(


def hls_extract(directory: Path, top: str):
directory = directory / "solution1"
directory = directory / "hls"

try:
parser = rpt.RPTParser(directory / "syn" / "report" / f"{top}_csynth.rpt")
summary_table = parser.get_table(re.compile(r"== Utilization Estimates"), 2)

solution_data = json.load((directory / "solution1_data.json").open())
solution_data = json.load((directory / "hls_data.json").open())
latency = solution_data["ModuleInfo"]["Metrics"][top]["Latency"]

total_row = find_row(summary_table, "Name", "Total")
Expand Down