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
1 change: 1 addition & 0 deletions .github/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ FROM ubuntu:22.04
RUN \
apt-get update && \
apt-get install -y curl xz-utils sudo git && \
apt-get install -y libc6-dev-i386 net-tools graphviz make unzip zip g++ libtinfo5 xvfb git libncurses5-dev libc6-dev-i386 libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2 openssl fdisk libsecret-1-dev ; \
rm -rf /var/lib/apt/lists/*

RUN \
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
CLEAR_AFTER=f"{CLEAR_AFTER_DAYS}d00h00m00s"
TOUCH_AFTER=datetime.timedelta(days=1)

GLOBAL_CACHE_BUST = 15
GLOBAL_CACHE_BUST = 17

CARGO_CACHE_BUST = 2
CARGO_KEY_PREFIX = f"cargo-g{GLOBAL_CACHE_BUST}-l{CARGO_CACHE_BUST}-"
Expand Down
37 changes: 35 additions & 2 deletions .github/scripts/with_vivado.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,44 @@
set -euo pipefail
IFS=$'\n\t'

if [[ "$#" -eq 0 ]]; then
echo "Usage: $0 [options] <command>"
echo "Options:"
echo " -v, --vivado_version <version> Specify Vivado version (default: 2025.2)"
exit 1
fi

case "$1" in
-v|--vivado_version)
VERSION="$2"
shift 2
;;

*)
VERSION=2025.2
echo "No Vivado version specified, defaulting to $VERSION"
;;
esac

case "$VERSION" in
2022.*|2023.*)
VIVADO_PATH="/opt/tools/Xilinx/VivadoEnterprise/Vivado/$VERSION/settings64.sh"
;;
2025.*)
VIVADO_PATH="/opt/tools/Xilinx/$VERSION/Vivado/settings64.sh"
;;
*)
echo "Unsupported Vivado version: $VERSION"
exit 1
;;
esac

# Get Vivado environment in scope
source /opt/tools/Xilinx/VivadoEnterprise/Vivado/2022.1/settings64.sh
echo "Sourcing Vivado environment for version $VERSION from $VIVADO_PATH"
source "$VIVADO_PATH"

# Work around https://support.xilinx.com/s/question/0D52E000079NURRSA4/synthesis-failed-abnormal-termination-tcmalloc-large-allocation?language=en_US
export LD_PRELOAD=/lib/x86_64-linux-gnu/libudev.so.1

# Run command given as argument
# Run command given as argument without VERSION
"$@"
32 changes: 32 additions & 0 deletions .github/synthesis/debug.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{"top": "counterReducedPins", "stage": "pnr", "cc_report": false},
{"top": "elasticBufferWb", "stage": "pnr", "cc_report": false},
{"top": "freeze", "stage": "pnr", "cc_report": false},
{"top": "gatherUnit1KReducedPins", "stage": "pnr", "cc_report": false},
{"top": "safeDffSynchronizer", "stage": "pnr", "cc_report": false},
{"top": "scatterUnit1KReducedPins", "stage": "pnr", "cc_report": false},
{"top": "si5391Spi", "stage": "pnr", "cc_report": false},
{"top": "switchExampleReducedPins", "stage": "pnr", "cc_report": false},

{"top": "asciiDebugMux", "stage": "hdl", "cc_report": false},
{"top": "gatherUnit1K", "stage": "hdl", "cc_report": false},
{"top": "scatterUnit1K", "stage": "hdl", "cc_report": false},
{"top": "switchExample", "stage": "hdl", "cc_report": false},

{"top": "vexRiscvTcpTest", "stage": "bitstream", "cc_report": false},

{"top": "boardTestExtended", "stage": "test", "cc_report": false},
{"top": "boardTestSimple", "stage": "test", "cc_report": false},
{"top": "ddr4Test", "stage": "test", "cc_report": false},
{"top": "dnaOverSerial", "stage": "test", "cc_report": false},
{"top": "fincFdecTests", "stage": "test", "cc_report": false},
{"top": "linkConfigurationTest", "stage": "test", "cc_report": false},
{"top": "si539xConfigTest", "stage": "test", "cc_report": false},
{"top": "softUgnDemoTest", "stage": "test", "cc_report": true},
{"top": "switchDemoTest", "stage": "test", "cc_report": true},
{"top": "switchDemoGppeTest", "stage": "test", "cc_report": true},
{"top": "syncInSyncOut", "stage": "test", "cc_report": false},
{"top": "temperatureMonitor", "stage": "test", "cc_report": false},
{"top": "transceiversUpTest", "stage": "test", "cc_report": false},
{"top": "vexRiscvTest", "stage": "test", "cc_report": false}
]
2 changes: 1 addition & 1 deletion .github/systemd/vivado-hw-server.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Before=actions.runner.bittide-bittide-hardware.hoeve-1.service

[Service]
Type=simple
ExecStart=/bin/bash -c "source /opt/tools/Xilinx/VivadoEnterprise/Vivado/2022.1/settings64.sh && hw_server"
ExecStart=/bin/bash -c "source /opt/tools/Xilinx/VivadoEnterprise/Vivado/2025.2/settings64.sh && hw_server"
Restart=always
User=graaf
# XXX: We actually want to run the hw_server as another user. However, it seems
Expand Down
59 changes: 30 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
run:
shell: git-nix-shell {0}
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
steps:
- uses: actions/checkout@v4

Expand All @@ -76,8 +76,8 @@ jobs:
shell: git-nix-shell {0}

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g

steps:
- name: Checkout
Expand Down Expand Up @@ -126,8 +126,8 @@ jobs:
shell: git-nix-shell {0} --ignore-environment

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g

steps:
- name: Checkout
Expand Down Expand Up @@ -179,8 +179,8 @@ jobs:
fail-fast: false

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -242,8 +242,8 @@ jobs:
run:
shell: git-nix-shell {0}
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
outputs:
run_tests: ${{ steps.check.outputs.run_tests }}
steps:
Expand Down Expand Up @@ -274,8 +274,8 @@ jobs:
if: ${{ needs.should-run-haskell-tests.outputs.run_tests == 'true' }}

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
volumes:
- /opt/tools:/opt/tools

Expand Down Expand Up @@ -332,7 +332,7 @@ jobs:
if: ${{ matrix.with_vivado }}
run: |
# We need to run with '-j2', because Vivado takes up a lot of memory
.github/scripts/with_vivado.sh \
.github/scripts/with_vivado.sh --vivado_version 2025.2 \
cabal run ${{ matrix.package }}:${{ matrix.test_suite }} -- -j2

- name: Run ${{ matrix.test_suite }}
Expand All @@ -348,8 +348,8 @@ jobs:
run:
shell: git-nix-shell {0} --ignore-environment
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
needs: [build]

steps:
Expand All @@ -374,8 +374,8 @@ jobs:
run:
shell: git-nix-shell {0} --ignore-environment
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
needs: [build]

steps:
Expand Down Expand Up @@ -407,8 +407,8 @@ jobs:
run:
shell: git-nix-shell {0} --ignore-environment
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
needs: [build]

steps:
Expand Down Expand Up @@ -488,10 +488,10 @@ jobs:
fail-fast: false

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
volumes:
- /opt/tools:/opt/tools
options: --init --mac-address="6c:5a:b0:6c:13:0b" --memory=11g
options: --init --mac-address="28:87:ba:f3:e0:77" --memory=50g

steps:
- name: Checkout
Expand Down Expand Up @@ -579,7 +579,7 @@ jobs:
if [[ ! -d "${VIVADO_HS_LOG_DIR} " ]]; then
mkdir -p "${VIVADO_HS_LOG_DIR}"
fi
.github/scripts/with_vivado.sh \
.github/scripts/with_vivado.sh --vivado_version 2025.2 \
shake ${{ matrix.target.top }}:"${target}"

# Pushing synthesis results to cache
Expand Down Expand Up @@ -614,8 +614,8 @@ jobs:
shell: git-nix-shell {0} --ignore-environment

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g

strategy:
matrix:
Expand Down Expand Up @@ -657,7 +657,7 @@ jobs:
fail-fast: false

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
volumes:
- /opt/tools:/opt/tools
- /dev:/dev
Expand All @@ -669,7 +669,7 @@ jobs:
# files as 'root' and the runner software will be unable to run
# cleaning jobs.
options: >-
--memory=11g
--memory=50g
--userns host
--privileged
--user 1001:1001
Expand All @@ -696,7 +696,8 @@ jobs:
if [[ ! -d "${VIVADO_HS_LOG_DIR} " ]]; then
mkdir -p "${VIVADO_HS_LOG_DIR}"
fi
.github/scripts/with_vivado.sh \
# XXX: Run older version of Vivado, 2025.2's hw_server does not work 90% of the time.
.github/scripts/with_vivado.sh --vivado_version 2022.1 \
shake ${{ matrix.target.top }}:test

- name: Archive HITL data
Expand All @@ -717,8 +718,8 @@ jobs:
run:
shell: git-nix-shell {0} --ignore-environment
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
image: ghcr.io/clash-lang/nixos-bittide-hardware:2026-03-23
options: --memory=50g
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
shell: git-nix-shell {0} --ignore-environment
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2025-12-17
options: --memory=11g
options: --memory=50g
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion bittide-cpus/data/Riscv32imc0.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Riscv32imc0 extends App {
),

new CsrPlugin(
CsrPluginConfig.smallest.copy(
CsrPluginConfig.all.copy(
ebreakGen = true,
mtvecAccess = CsrAccess.READ_WRITE,
withPrivilegedDebug = true
Expand Down
2 changes: 1 addition & 1 deletion bittide-cpus/data/Riscv32imc1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Riscv32imc1 extends App {
),

new CsrPlugin(
CsrPluginConfig.smallest.copy(
CsrPluginConfig.all.copy(
ebreakGen = true,
mtvecAccess = CsrAccess.READ_WRITE,
withPrivilegedDebug = true
Expand Down
2 changes: 1 addition & 1 deletion bittide-cpus/data/Riscv32imc2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Riscv32imc2 extends App {
),

new CsrPlugin(
CsrPluginConfig.smallest.copy(
CsrPluginConfig.all.copy(
ebreakGen = true,
mtvecAccess = CsrAccess.READ_WRITE,
withPrivilegedDebug = true
Expand Down
2 changes: 1 addition & 1 deletion bittide-cpus/data/Riscv32imc3.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Riscv32imc3 extends App {
),

new CsrPlugin(
CsrPluginConfig.smallest.copy(
CsrPluginConfig.all.copy(
ebreakGen = true,
mtvecAccess = CsrAccess.READ_WRITE,
withPrivilegedDebug = true
Expand Down
25 changes: 25 additions & 0 deletions bittide-extra/src/Protocols/ReqResp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import Protocols.BiDf (BiDf)
import Protocols.Idle

import qualified Clash.Prelude as C
import qualified Protocols as Df
import qualified Protocols.BiDf as BiDf

{- |
Expand Down Expand Up @@ -66,6 +67,30 @@ instance IdleCircuit (ReqResp dom req resp) where
idleFwd _ = pure Nothing
idleBwd _ = pure Nothing

instance
( C.KnownDomain dom
, C.NFDataX req
, C.NFDataX resp
, Show req
, Show resp
, ShowX req
, ShowX resp
) =>
Simulate (ReqResp dom req resp)
where
type SimulateFwdType (ReqResp dom req resp) = [Maybe req]
type SimulateBwdType (ReqResp dom req resp) = [Maybe resp]
type SimulateChannels (ReqResp dom req resp) = 1
simToSigFwd _ = C.fromList_lazy
simToSigBwd _ = C.fromList_lazy
sigToSimFwd _ = C.sample_lazy
sigToSimBwd _ = C.sample_lazy
stallC conf stalls = C.withClockResetEnable clockGen resetGen enableGen $ circuit $ \rr0 -> do
reqs0 <- toDfs -< (rr0, resps)
reqs1 <- Df.stallC conf stalls -< reqs0
(rr1, resps) <- fromDfs -< reqs1
idC -< rr1

leftToMaybe :: Either a b -> Maybe a
leftToMaybe (Left x) = Just x
leftToMaybe (Right _) = Nothing
Expand Down
2 changes: 2 additions & 0 deletions bittide-instances/bittide-instances.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ library
Bittide.Instances.Pnr.Si539xSpi
Bittide.Instances.Pnr.Switch
Bittide.Instances.Pnr.Synchronizer
Bittide.Instances.Tests.AddressableBytesWb
Bittide.Instances.Tests.ElasticBufferWb
Bittide.Instances.Tests.NestedInterconnect
Bittide.Instances.Tests.RegisterWb
Expand Down Expand Up @@ -314,6 +315,7 @@ test-suite unittests
Tests.Bittide.Instances.Hitl.Utils.OpenOcd
Tests.Bittide.Instances.Hitl.Utils.Picocom
Tests.ClockControlWb
Wishbone.AddressableBytesWb
Wishbone.Axi
Wishbone.CaptureUgn
Wishbone.DnaPortE2
Expand Down
Loading
Loading