Skip to content

Commit

Permalink
Merge branch 'main' into debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoeders authored Sep 27, 2024
2 parents e621396 + 8a65545 commit 44d251a
Show file tree
Hide file tree
Showing 37 changed files with 94 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# Build a matrix run of all experiments generated in previous job
run-test:
needs: collect-experiments
runs-on: [self-hosted, linux]
runs-on: [self-hosted, linux, bfasst]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
build/**/*.log
unittest:
runs-on: [self-hosted, linux]
runs-on: [self-hosted, linux, bfasst]
steps:
- name: 'Cleanup build folder'
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weeklytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run-tests:
needs: collect-tests
runs-on: [self-hosted, linux]
runs-on: [self-hosted, linux, bfasst]
strategy:
matrix:
experiment: ${{ fromJson(needs.collect-tests.outputs.matrix) }}
Expand Down
4 changes: 2 additions & 2 deletions bfasst/flows/vivado_structural_error_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class VivadoStructuralErrorInjection(Flow):
"""Inject an error into a xrev netlist and run a structural compare to detect it."""

def __init__(self, design, num_runs=100, seed=None, synth_options="", logging_level="INFO"):
def __init__(self, design, *, num_runs=100, seed=None, synth_options="", logging_level="INFO"):
# pylint: disable=duplicate-code
super().__init__(design)
self.design = design
Expand Down Expand Up @@ -51,7 +51,7 @@ def __init__(self, design, num_runs=100, seed=None, synth_options="", logging_le
bitstream=self.vivado_impl_tool.outputs["bitstream"],
)
self.default_comparison_tool = Structural(self, design)
self.default_injection_tool = ErrorInjector(self, design, logging_level)
self.default_injection_tool = ErrorInjector(self, design, logging_level=logging_level)
# pylint: enable=duplicate-code

def create_build_snippets(self):
Expand Down
2 changes: 1 addition & 1 deletion bfasst/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
STRUCTURAL_TOOLS_PATH = COMPARE_TOOLS_PATH / "structural"
YOSYS_TOOLS_PATH = COMPARE_TOOLS_PATH / "yosys"

NINJA_BUILD_PATH = ROOT_PATH / "build.ninja"
NINJA_BUILD_PATH = pathlib.Path().cwd() / "build.ninja"

IC2_RESOURCES = RESOURCES_PATH / "iCEcube2"
LSE_PRJ_TEMPLATE = IC2_RESOURCES / "template_lse_prj.mustache"
Expand Down
2 changes: 1 addition & 1 deletion bfasst/tools/common/vivado_rules.ninja.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rule vivado

{{#in_context}}
rule vivado_ioparse
command = python bfasst/utils/vivado_ioparse.py <$in >$out
command = python {{ bfasst_path }}/bfasst/utils/vivado_ioparse.py <$in >$out
description = vivado_ioparse <$in >$out

{{/in_context}}
4 changes: 3 additions & 1 deletion bfasst/tools/compare/structural/structural.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def __init__(
self.debug = debug
self.logging_level = logging_level
self._init_outputs()
self.rule_snippet_path = COMPARE_TOOLS_PATH / "structural" / "structural_rules.ninja"
self.rule_snippet_path = (
COMPARE_TOOLS_PATH / "structural" / "structural_rules.ninja.mustache"
)

def create_build_snippets(self):
self._append_build_snippets_default(
Expand Down
4 changes: 0 additions & 4 deletions bfasst/tools/compare/structural/structural_rules.ninja

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rule compare
command = python {{ bfasst_path }}/bfasst/utils/structural.py --netlists $in --log_path $out $expect_fail $debug $logging_level
description = structurally compare $in

11 changes: 9 additions & 2 deletions bfasst/tools/compare/wafove/wafove.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ class Wafove(Tool):
"""Create the rule and build snippets for structural comparison."""

def __init__(
self, flow, design, std_out_log_name, std_err_log_name, golden_netlist, rev_netlist
self,
flow,
design,
golden_netlist,
rev_netlist,
*,
std_out_log_name="wafove.log",
std_err_log_name="wafove_err.log",
):
super().__init__(flow, design)

Expand All @@ -19,7 +26,7 @@ def __init__(

self.build_path = self.design_build_path / "wafove"
self._init_outputs(self.std_out_log_name, self.std_err_log_name)
self.rule_snippet_path = COMPARE_TOOLS_PATH / "wafove" / "wafove_rules.ninja"
self.rule_snippet_path = COMPARE_TOOLS_PATH / "wafove" / "wafove_rules.ninja.mustache"

def create_build_snippets(self):
self._append_build_snippets_default(
Expand Down
4 changes: 0 additions & 4 deletions bfasst/tools/compare/wafove/wafove_rules.ninja

This file was deleted.

4 changes: 4 additions & 0 deletions bfasst/tools/compare/wafove/wafove_rules.ninja.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rule wafove
command = python {{ bfasst_path }}/third_party/WaFoVe/wafove/compare_waveforms.py --top $top --base $base_path --fullScreen --newTests $in >$log_path 2>$std_err_log
description = run wafove on the netlists specified as inputs to the rule

2 changes: 1 addition & 1 deletion bfasst/tools/compare/yosys/yosys_rules.ninja.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rule yosys
command = cd third_party/yosys; ./yosys $in >$out 2>>$out
command = cd {{ bfasst_path }}/third_party/yosys; ./yosys $in >$out 2>>$out
description = running yosys compare with $in

2 changes: 1 addition & 1 deletion bfasst/tools/design_create/rand_soc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, flow, num_designs, config_path):
self.num_designs = num_designs
self.config_path = config_path
self._init_outputs()
self.rule_snippet_path = TOOLS_PATH / "design_create" / "rand_soc_rules.ninja"
self.rule_snippet_path = TOOLS_PATH / "design_create" / "rand_soc_rules.ninja.mustache"

def create_build_snippets(self):
rand_soc_pkg_files = list((GMT_TOOLS_PATH / "rand_soc" / "rand_soc").glob("**/*.py"))
Expand Down
4 changes: 0 additions & 4 deletions bfasst/tools/design_create/rand_soc_rules.ninja

This file was deleted.

4 changes: 4 additions & 0 deletions bfasst/tools/design_create/rand_soc_rules.ninja.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rule rand_soc
command = python {{ bfasst_path }}/third_party/gmt_tools/rand_soc/main.py $design_dir_path $config_path --seed $seed --part $part
description = generate a random SoC in $design_dir_path

2 changes: 1 addition & 1 deletion bfasst/tools/rev_bit/icestorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, flow, design_path, constraints_file, bitstream):

# outputs must be initialized AFTER output paths are set
self._init_outputs()
self.rule_snippet_path = REV_BIT_TOOLS_PATH / "icestorm_rules.ninja"
self.rule_snippet_path = REV_BIT_TOOLS_PATH / "icestorm_rules.ninja.mustache"

def create_build_snippets(self):
self._append_build_snippets_default(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ rule icestorm_ascii_to_netlist
description = convert icestorm $asciifile to verilog equivalent circuit

rule icestorm_netlist_rpt
command = python bfasst/utils/icestorm_rpt.py --netlist $in --report $out
command = python {{ bfasst_path }}/bfasst/utils/icestorm_rpt.py --netlist $in --report $out
description = count luts, carries, ffs, etc for $in and write to $out

5 changes: 3 additions & 2 deletions bfasst/tools/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import chevron
from bfasst.flows.flow import FlowBase

from bfasst.paths import BUILD_PATH, DESIGNS_PATH, NINJA_BUILD_PATH
from bfasst.paths import BUILD_PATH, DESIGNS_PATH, NINJA_BUILD_PATH, ROOT_PATH
from bfasst.yaml_parser import DesignParser


Expand All @@ -25,12 +25,13 @@ def __init__(self, flow):
def create_rule_snippets(self):
"""Create the rule snippets for the flow and append them to build.ninja"""
rules_path = self.rule_snippet_path if hasattr(self, "rule_snippet_path") else None
rules_render_dict = self.rules_render_dict if hasattr(self, "rules_render_dict") else None
rules_render_dict = self.rules_render_dict if hasattr(self, "rules_render_dict") else {}
if rules_path in self.flow.rule_paths:
return

self.flow.rule_paths.append(rules_path)

rules_render_dict["bfasst_path"] = ROOT_PATH
with open(rules_path, "r") as f:
if rules_render_dict:
rules = chevron.render(f, rules_render_dict)
Expand Down
5 changes: 3 additions & 2 deletions bfasst/tools/transform/error_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def __init__(
self,
flow,
design,
logging_level,
*,
logging_level="INFO",
error_type=None,
num=None,
multiplier=None,
Expand All @@ -33,7 +34,7 @@ def __init__(
self.injection_log = None
self.corrupt_netlist = None
self._init_outputs(self.injection_log, self.corrupt_netlist)
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "error_injector_rules.ninja"
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "error_injector_rules.ninja.mustache"

def create_build_snippets(self):
with open(NINJA_TRANSFORM_TOOLS_PATH / "error_injector_build.ninja.mustache", "r") as f:
Expand Down
4 changes: 0 additions & 4 deletions bfasst/tools/transform/error_injector_rules.ninja

This file was deleted.

4 changes: 4 additions & 0 deletions bfasst/tools/transform/error_injector_rules.ninja.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rule inject
command = python {{ bfasst_path }}/bfasst/utils/error_injector.py --build_dir $build_dir --log_path $log_path --seed $seed --error_type $error_type --reversed_netlist $reversed_netlist $logging_level
description = inject a $error_type into xrev netlist for $build_dir

2 changes: 1 addition & 1 deletion bfasst/tools/transform/netlist_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, flow, design, rev_netlist, logging_level):

self.build_path = self.design_build_path / "netlist_cleanup"
self._init_outputs()
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "netlist_cleanup_rules.ninja"
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "netlist_cleanup_rules.ninja.mustache"

def _init_outputs(self):
self.outputs["netlist_cleaned_path"] = self.build_path / (
Expand Down
3 changes: 0 additions & 3 deletions bfasst/tools/transform/netlist_cleanup_rules.ninja

This file was deleted.

3 changes: 3 additions & 0 deletions bfasst/tools/transform/netlist_cleanup_rules.ninja.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rule netlist_cleanup
command = python {{ bfasst_path }}/bfasst/utils/netlist_cleanup.py $build_path $netlist_in $netlist_out $logging_level
description = netlist cleanup for $in
4 changes: 3 additions & 1 deletion bfasst/tools/transform/netlist_phys_to_logical.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def __init__(self, flow, design, cleaned_netlist):

self.build_path = self.design_build_path / "netlist_phys_to_logical"
self._init_outputs()
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "netlist_phys_to_logical_rules.ninja"
self.rule_snippet_path = (
NINJA_TRANSFORM_TOOLS_PATH / "netlist_phys_to_logical_rules.ninja.mustache"
)

def _init_outputs(self):
self.outputs["netlist_phys_to_logical_path"] = self.build_path / (
Expand Down
3 changes: 0 additions & 3 deletions bfasst/tools/transform/netlist_phys_to_logical_rules.ninja

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rule netlist_phys_to_logical
command = python {{ bfasst_path }}/third_party/gmt_tools/netlist_phys_to_logical.py $build_path $netlist_in $netlist_out
description = netlist physical to logical for $in
4 changes: 2 additions & 2 deletions bfasst/tools/transform/phys_netlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class PhysNetlist(Tool):
"""Create rule and build snippets for phys netlist creation."""

def __init__(self, flow, design, impl_checkpoint, impl_edf, logging_level):
def __init__(self, flow, design, impl_checkpoint, impl_edf, *, logging_level="INFO"):
super().__init__(flow, design)

self.impl_checkpoint = impl_checkpoint
Expand All @@ -25,7 +25,7 @@ def __init__(self, flow, design, impl_checkpoint, impl_edf, logging_level):
self.build_path = self.design_build_path / "vivado_phys_netlist"

self._init_outputs()
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "phys_netlist_rules.ninja"
self.rule_snippet_path = NINJA_TRANSFORM_TOOLS_PATH / "phys_netlist_rules.ninja.mustache"

def create_build_snippets(self):
self.__write_json_file()
Expand Down
4 changes: 0 additions & 4 deletions bfasst/tools/transform/phys_netlist_rules.ninja

This file was deleted.

4 changes: 4 additions & 0 deletions bfasst/tools/transform/phys_netlist_rules.ninja.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rule phys_netlist
command = python {{ bfasst_path }}/bfasst/utils/rw_phys_netlist.py --build_dir $build_dir --impl_dcp $impl_dcp --impl_edf $impl_edf $logging_level
description = generate physical netlist for $build_dir

1 change: 0 additions & 1 deletion bfasst/utils/netlist_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def remove_unused_instances(self, top):
for instance_wrapper in netlist_wrapper.instances
if instance_wrapper.instance.reference.name == instance_type
]:

connected_pins = (
netlist_wrapper.wire_to_net[
instance_wrapper.get_pin(pin_name).pin.wire
Expand Down
6 changes: 3 additions & 3 deletions bfasst/utils/structural.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ def __init__(
named_netlist_path,
reversed_netlist_path,
log_path,
debug,
logging_level,
*,
debug=False,
logging_level="INFO",
) -> None:
self.reversed_netlist_path = reversed_netlist_path
self.named_netlist_path = named_netlist_path
Expand Down Expand Up @@ -819,7 +820,6 @@ def check_for_potential_mapping(self, instance_name: str) -> set[str]:
instances_matching_connections = self.eliminate_redundant_matches(instance_name)

for pin in instance.pins:

if pin.net not in self.net_mapping:
continue

Expand Down
20 changes: 20 additions & 0 deletions resources/randsoc/randsoc_configs/ci_small.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
available_ip:
- class: Accumulator
- class: AxiCdma
- class: AxiHwicap
max: 1
- class: AxiTimer
- class: Dft
- class: Emc
- class: Gpio
- class: Microblaze
- class: Uartlite
- class: XadcWiz
max: 1
- class: AxiEthernetLite
- class: AxiIic
- class: AxiQuadSpi


min_ip: 3
max_ip: 5
7 changes: 3 additions & 4 deletions scripts/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from bfasst.flows.ninja_flow_manager import NinjaFlowManager
from bfasst.yaml_parser import FlowDescriptionParser, RunParser
from bfasst.utils import error, ensure_tuple
from bfasst.paths import ROOT_PATH


class ApplicationRunner:
Expand All @@ -23,7 +22,7 @@ def __init__(self):
self.flow_arguments = None
self.num_threads = None

def run_flow(self, flow, designs, flow_arguments, check_tools, num_threads):
def run_flow(self, flow, designs, *, flow_arguments="", check_tools=True, num_threads=1):
"""Run one ore more designs with a given flow."""
self.designs = ensure_tuple(designs)
self.flow = flow
Expand Down Expand Up @@ -61,7 +60,7 @@ def __run_ninja(self):
cmd = ["ninja"]
if self.num_threads:
cmd += ["-j", str(self.num_threads)]
proc = subprocess.Popen(cmd, cwd=ROOT_PATH)
proc = subprocess.Popen(cmd)
proc.communicate()
return_code = proc.wait()

Expand Down Expand Up @@ -142,7 +141,7 @@ def parse_args(args):
ApplicationRunner().run_flow(
parsed_args.flow,
parsed_args.design,
parsed_args.flow_arguments,
flow_arguments=parsed_args.flow_arguments,
check_tools=not parsed_args.no_tool_checks,
num_threads=parsed_args.jobs,
)
Expand Down
4 changes: 3 additions & 1 deletion tests/ci/rand_soc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ flow: RandSoc

num_designs: 3

part: xc7a200tlffv1156-2L
part: xc7a200tlffv1156-2L

randsoc_config_path: resources/randsoc/randsoc_configs/ci_small.yaml
4 changes: 3 additions & 1 deletion tests/ci/randsoc_dumped.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ flow: RandSocDumped

num_designs: 2

part: xc7a200tlffv1156-2L
part: xc7a200tlffv1156-2L

randsoc_config_path: resources/randsoc/randsoc_configs/ci_small.yaml
2 changes: 1 addition & 1 deletion third_party/gmt_tools

0 comments on commit 44d251a

Please sign in to comment.