Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synthesize different core versions #407

Merged
merged 1 commit into from
Jun 30, 2023
Merged
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
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