Skip to content

Commit

Permalink
Merge branch 'master' into lekcyjna/autumn-cleaning-4
Browse files Browse the repository at this point in the history
  • Loading branch information
lekcyjna123 authored Oct 23, 2023
2 parents 26559a9 + dfd451e commit bb5d161
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 38 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
name: Synthesis benchmarks
runs-on: ubuntu-latest
timeout-minutes: 40
container: ghcr.io/kuznia-rdzeni/amaranth-synth:ecp5
container: ghcr.io/kuznia-rdzeni/amaranth-synth:ecp5-3.11
steps:
- uses: actions/checkout@v3

Expand All @@ -23,19 +23,29 @@ jobs:
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
python3 -m pip install -r requirements-dev.txt
- name: Synthesize
run: PYTHONHASHSEED=0 ./scripts/synthesize.py --verbose --config ${{ matrix.config }}
run: |
. venv/bin/activate
PYTHONHASHSEED=0 ./scripts/synthesize.py --verbose --config ${{ matrix.config }}
- name: Print synthesis information
run: cat ./build/top.tim

- name: Collect Benchmark information
run: |
. venv/bin/activate
./scripts/parse_benchmark_info.py
cat ./benchmark.json
Expand All @@ -53,7 +63,7 @@ jobs:
build-perf-benchmarks:
name: Build performance benchmarks
runs-on: ubuntu-latest
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2023.05.14
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2023.10.08_v
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -73,7 +83,7 @@ jobs:
name: Run performance benchmarks
runs-on: ubuntu-latest
timeout-minutes: 60
container: ghcr.io/kuznia-rdzeni/verilator:v5.008
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-3.11
needs: build-perf-benchmarks
steps:
- name: Checkout
Expand All @@ -84,13 +94,22 @@ jobs:
# https://github.com/actions/runner/issues/2033
chown -R $(id -u):$(id -g) $PWD
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
python3 -m pip install -r requirements-dev.txt
- name: Generate Verilog
run: PYTHONHASHSEED=0 ./scripts/gen_verilog.py --verbose --config full
run: |
. venv/bin/activate
PYTHONHASHSEED=0 ./scripts/gen_verilog.py --verbose --config full
- uses: actions/download-artifact@v3
with:
Expand All @@ -99,6 +118,7 @@ jobs:

- name: Run benchmarks
run: |
. venv/bin/activate
scripts/run_benchmarks.py
- name: Store benchmark result (IPC)
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/deploy_gh_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
requirements.txt
requirements-dev.txt
python-version: "3.11"

- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
python -m pip install -r requirements-dev.txt
- name: Build documentation
run: ./ci/build_docs.sh
run: |
. venv/bin/activate
./ci/build_docs.sh
- name: Push documentation
# Deploy documentation only when on master
if: github.ref == 'refs/heads/master'
run: ./ci/push_gh_pages.sh
run: |
. venv/bin/activate
./ci/push_gh_pages.sh
22 changes: 16 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
build-regression-tests:
name: Build regression tests
runs-on: ubuntu-latest
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2023.05.14
container: ghcr.io/kuznia-rdzeni/riscv-toolchain:2023.10.08_v
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -35,19 +35,28 @@ jobs:
name: Run regression tests
runs-on: ubuntu-latest
timeout-minutes: 10
container: ghcr.io/kuznia-rdzeni/verilator:v5.008
container: ghcr.io/kuznia-rdzeni/verilator:v5.008-3.11
needs: build-regression-tests
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python3 -m venv venv
. venv/bin/activate
python3 -m pip install --upgrade pip
pip3 install -r requirements-dev.txt
python3 -m pip install -r requirements-dev.txt
- name: Generate Verilog
run: PYTHONHASHSEED=0 ./scripts/gen_verilog.py --verbose --config full
run: |
. venv/bin/activate
PYTHONHASHSEED=0 ./scripts/gen_verilog.py --verbose --config full
- uses: actions/download-artifact@v3
with:
Expand All @@ -56,6 +65,7 @@ jobs:

- name: Run tests
run: |
. venv/bin/activate
scripts/run_tests.py -a regression
- name: Test Report
Expand All @@ -76,7 +86,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
Expand Down Expand Up @@ -105,7 +115,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
cache: 'pip'
cache-dependency-path: |
requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions docker/AmaranthSynthECP5.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ubuntu:22.10
FROM ubuntu:23.04

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
python3.10 python3-pip git yosys \
python3.11 python3-pip git yosys lsb-release \
build-essential cmake python3-dev libboost-all-dev libeigen3-dev && \
rm -rf /var/lib/apt/lists/*

Expand Down
4 changes: 2 additions & 2 deletions docker/Verilator.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ubuntu:22.10
FROM ubuntu:23.04

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
python3.10 libpython3.10 python3-pip git \
python3.11 libpython3.11 python3-pip git lsb-release \
perl perl-doc help2man make autoconf g++ flex bison ccache numactl \
libgoogle-perftools-dev libfl-dev zlib1g-dev && \
rm -rf /var/lib/apt/lists/*
Expand Down
4 changes: 2 additions & 2 deletions docker/riscv-toolchain.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ubuntu:22.10
FROM ubuntu:23.04

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
autoconf automake autotools-dev curl python3 bc \
autoconf automake autotools-dev curl python3 bc lsb-release \
libmpc-dev libmpfr-dev libgmp-dev gawk build-essential \
bison flex texinfo gperf libtool patchutils zlib1g-dev \
libexpat-dev ninja-build git ca-certificates python-is-python3 && \
Expand Down
2 changes: 1 addition & 1 deletion docs/Development_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

In order to prepare the development environment, please follow the steps below:

1. Install the Python 3.10 interpreter and pip package manager.
1. Install the Python 3.11 interpreter and pip package manager.
* Optionally create a Python virtual environment with `python3 -m venv venv` in the project directory and activate it using generated script: `. venv/bin/activate`.
2. Install all required libraries with `pip3 install -r requirements-dev.txt`.
3. Install `riscv64-unknown-elf` binutils using your favourite package manager. On Debian-based distros the package is called `binutils-riscv64-unknown-elf`, on Arch-based - `riscv64-unknown-elf-binutils`.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
amaranth-yosys==0.10.0.dev46
amaranth-yosys==0.25.0.0.post77
git+https://github.com/amaranth-lang/amaranth@ccf7aaf00db54c7647b2f0f0cfdf34835c16fa8f
27 changes: 21 additions & 6 deletions transactron/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
from collections.abc import Sequence, Iterable, Callable, Mapping, Iterator
from contextlib import contextmanager
from enum import Enum, auto
from typing import ClassVar, NoReturn, TypeAlias, TypedDict, Union, Optional, Tuple
from typing import (
ClassVar,
NoReturn,
TypeAlias,
TypedDict,
Union,
Optional,
Tuple,
TypeVar,
Protocol,
runtime_checkable,
)
from graphlib import TopologicalSorter
from typing_extensions import Self
from amaranth import *
Expand Down Expand Up @@ -38,6 +49,7 @@
TransactionScheduler: TypeAlias = Callable[["MethodMap", TransactionGraph, TransactionGraphCC, PriorityOrder], Module]
RecordDict: TypeAlias = ValueLike | Mapping[str, "RecordDict"]
TransactionOrMethod: TypeAlias = Union["Transaction", "Method"]
TransactionOrMethodBound = TypeVar("TransactionOrMethodBound", "Transaction", "Method")


class Priority(Enum):
Expand Down Expand Up @@ -670,15 +682,20 @@ def elaborate(self, platform):
return self.main_module


class TransactionBase(Owned):
@runtime_checkable
class TransactionBase(Owned, Protocol):
stack: ClassVar[list[Union["Transaction", "Method"]]] = []
def_counter: ClassVar[count] = count()
def_order: int
defined: bool = False
name: str
method_uses: dict["Method", Tuple[ValueLike, ValueLike]]
relations: list[RelationBase]
simultaneous_list: list[TransactionOrMethod]
independent_list: list[TransactionOrMethod]

def __init__(self):
self.method_uses: dict[Method, Tuple[ValueLike, ValueLike]] = dict()
self.method_uses: dict["Method", Tuple[ValueLike, ValueLike]] = dict()
self.relations: list[RelationBase] = []
self.simultaneous_list: list[TransactionOrMethod] = []
self.independent_list: list[TransactionOrMethod] = []
Expand Down Expand Up @@ -769,9 +786,7 @@ def _independent(self, *others: TransactionOrMethod) -> None:
self.independent_list += others

@contextmanager
def context(self, m: TModule) -> Iterator[Self]:
assert isinstance(self, Transaction) or isinstance(self, Method) # for typing

def context(self: TransactionOrMethodBound, m: TModule) -> Iterator[TransactionOrMethodBound]:
parent = TransactionBase.peek()
if parent is not None:
parent.schedule_before(self)
Expand Down
5 changes: 2 additions & 3 deletions transactron/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
"""

from enum import IntFlag
from abc import ABC
from collections import defaultdict
from typing import Literal, Optional
from typing import Literal, Optional, Protocol

from amaranth.hdl.ir import Elaboratable, Fragment
from .tracing import TracingFragment


class Owned(ABC):
class Owned(Protocol):
name: str
owner: Optional[Elaboratable]

Expand Down

0 comments on commit bb5d161

Please sign in to comment.