Skip to content

Commit

Permalink
Synthesize different core versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tilk committed Jun 30, 2023
1 parent f58fd95 commit d046542
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:

jobs:
synthesis:
strategy:
matrix:
config: [basic, full]
name: Synthesis benchmarks
runs-on: ubuntu-latest
timeout-minutes: 20
Expand All @@ -26,7 +29,7 @@ jobs:
pip3 install -r requirements-dev.txt
- name: Synthesize
run: PYTHONHASHSEED=0 ./scripts/synthesize.py --verbose
run: PYTHONHASHSEED=0 ./scripts/synthesize.py --verbose --config ${{ matrix.config }}

- name: Print synthesis information
run: cat ./build/top.tim
Expand All @@ -40,7 +43,7 @@ jobs:
uses: benchmark-action/github-action-benchmark@v1
if: github.ref == 'refs/heads/master'
with:
name: Fmax and LCs
name: Fmax and LCs (${{ matrix.config }})
tool: 'customBiggerIsBetter'
output-file-path: './benchmark.json'
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
28 changes: 24 additions & 4 deletions scripts/synthesize.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@
from coreblocks.core import Core
from coreblocks.transactions import TransactionModule
from coreblocks.peripherals.wishbone import WishboneArbiter, WishboneBus
from coreblocks.params.configurations import basic_core_config
from constants.ecp5_platforms import make_ecp5_platform

from coreblocks.params.configurations import *

str_to_coreconfig: dict[str, CoreConfiguration] = {
"basic": basic_core_config,
"tiny": tiny_core_config,
"full": full_core_config,
}


class TestElaboratable(Elaboratable):
def __init__(self, gen_params: GenParams):
Expand Down Expand Up @@ -50,8 +57,8 @@ def elaborate(self, platform: Platform):
return tm


def synthesize(platform: str):
gen_params = GenParams(basic_core_config)
def synthesize(core_config: CoreConfiguration, platform: str):
gen_params = GenParams(core_config)

if platform == "ecp5":
make_ecp5_platform(gen_params.wb_params)().build(TestElaboratable(gen_params))
Expand All @@ -66,6 +73,16 @@ def main():
choices=["ecp5"],
help="Selects platform to synthesize circuit on. Default: %(default)s",
)

parser.add_argument(
"-c",
"--config",
action="store",
default="basic",
help="Select core configuration. "
+ f"Available configurations: {', '.join(list(str_to_coreconfig.keys()))}. Default: %(default)s",
)

parser.add_argument(
"-v",
"--verbose",
Expand All @@ -77,7 +94,10 @@ def main():

os.environ["AMARANTH_verbose"] = "true" if args.verbose else "false"

synthesize(args.platform)
if args.config not in str_to_coreconfig:
raise KeyError(f"Unknown config '{args.config}'")

synthesize(str_to_coreconfig[args.config], args.platform)


if __name__ == "__main__":
Expand Down

0 comments on commit d046542

Please sign in to comment.