Skip to content

Commit

Permalink
Merge pull request #583 from bittide/lucas/add-gild
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnbastiaan authored Jul 31, 2024
2 parents 8ccec67 + 512be01 commit e81fb30
Show file tree
Hide file tree
Showing 21 changed files with 682 additions and 379 deletions.
4 changes: 1 addition & 3 deletions .github/cabal.project
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-- SPDX-FileCopyrightText: 2022 Google LLC
-- SPDX-FileCopyrightText: 2022-2024 Google LLC
--
-- SPDX-License-Identifier: CC0-1.0

package bittide
ghc-options: -Werror

Expand All @@ -17,6 +16,5 @@ package bittide-shake
-- TODO: Fix upstream
-- package clash-vexriscv
-- ghc-options: -Werror

package elastic-buffer-sim
ghc-options: -Werror
9 changes: 9 additions & 0 deletions .github/scripts/cabal-gild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2024 Google LLC
#
# SPDX-License-Identifier: Apache-2.0
set -euf -o pipefail

git ls-files *.cabal cabal.project \
| grep --extended-regexp --invert-match '^clash-vexriscv/' \
| xargs --max-procs=0 -I {} cabal-gild -i "{}" -o "{}"
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 = 1
GLOBAL_CACHE_BUST = 2

CARGO_CACHE_BUST = 2
CARGO_KEY_PREFIX = f"cargo-g{GLOBAL_CACHE_BUST}-l{CARGO_CACHE_BUST}-"
Expand Down
46 changes: 28 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
run:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_SHA" --keep "S3_PASSWORD"
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g
steps:
- name: Checkout
Expand Down Expand Up @@ -77,8 +77,13 @@ jobs:
lint:
name: Basic linting
runs-on: [self-hosted, compute]

defaults:
run:
shell: git-nix-shell {0} --option connect-timeout 360

container:
image: ubuntu:22.04
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -107,6 +112,11 @@ jobs:
run: |
.github/scripts/all_check.py
- name: Check that all cabal files are formatted correctly
run: |
.github/scripts/cabal-gild.sh check
git diff --exit-code
build:
name: Build dependencies
runs-on: [self-hosted, compute]
Expand All @@ -115,7 +125,7 @@ jobs:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_SHA" --keep "S3_PASSWORD"

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -155,7 +165,7 @@ jobs:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_OUTPUT"

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -195,7 +205,7 @@ jobs:
fail-fast: false

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -245,7 +255,7 @@ jobs:
needs: [build, lint, cc-sim-topologies-matrix, cc-sim-topologies, bittide-instances-hardware-in-the-loop]

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -318,7 +328,7 @@ jobs:
needs: [build, lint]

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand All @@ -345,7 +355,7 @@ jobs:
needs: [build, lint]

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -386,7 +396,7 @@ jobs:
run:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_SHA" --keep "S3_PASSWORD"
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g
needs: [build]

Expand All @@ -411,7 +421,7 @@ jobs:
run:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_SHA" --keep "S3_PASSWORD"
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g
needs: [build]

Expand Down Expand Up @@ -439,7 +449,7 @@ jobs:
run:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_SHA" --keep "S3_PASSWORD"
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g
needs: [build]

Expand All @@ -465,7 +475,7 @@ jobs:
run:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_SHA" --keep "S3_PASSWORD"
container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g
needs: [build]

Expand Down Expand Up @@ -498,7 +508,7 @@ jobs:
needs: [build, lint]

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand All @@ -525,7 +535,7 @@ jobs:
needs: [build, lint]

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand All @@ -551,7 +561,7 @@ jobs:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_OUTPUT"

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -584,7 +594,7 @@ jobs:
shell: git-nix-shell {0} --option connect-timeout 360 --pure --keep "GITHUB_OUTPUT"

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
options: --memory=11g

steps:
Expand Down Expand Up @@ -627,7 +637,7 @@ jobs:
fail-fast: false

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
volumes:
- /opt/tools:/opt/tools
options: --init --mac-address="6c:5a:b0:6c:13:0b" --memory=11g
Expand Down Expand Up @@ -707,7 +717,7 @@ jobs:
fail-fast: false

container:
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-04-06
image: ghcr.io/clash-lang/nixos-bittide-hardware:2024-07-30
volumes:
- /opt/tools:/opt/tools
- /dev:/dev
Expand Down
126 changes: 72 additions & 54 deletions bittide-experiments/bittide-experiments.cabal
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
cabal-version: 2.4
name: bittide-experiments
synopsis: Infrastructure and configurations needed for running
experiments with the Bittide systems under development
version: 0.1
License: Apache-2.0
license-file: LICENSE
author: QBayLogic B.V.
maintainer: [email protected]
Copyright: Copyright © 2024 Google LLC
cabal-version: 2.4
name: bittide-experiments
synopsis:
Infrastructure and configurations needed for running
experiments with the Bittide systems under development

version: 0.1
license: Apache-2.0
license-file: LICENSE
author: QBayLogic B.V.
maintainer: [email protected]
copyright: Copyright © 2024 Google LLC

common common-options
default-extensions:
-- TemplateHaskell is used to support convenience functions such as
-- 'listToVecTH' and 'bLit'.
--
-- `NoImplicitPrelude` is used because Clash offers Clash.Prelude
BangPatterns
BinaryLiterals
ConstraintKinds
Expand All @@ -28,49 +34,48 @@ common common-options
InstanceSigs
KindSignatures
LambdaCase
NoImplicitPrelude
NoStarIsType
PolyKinds
QuasiQuotes
RankNTypes
ScopedTypeVariables
StandaloneDeriving
TemplateHaskell
TupleSections
TypeApplications
TypeFamilies
TypeOperators
ViewPatterns

-- TemplateHaskell is used to support convenience functions such as
-- 'listToVecTH' and 'bLit'.
TemplateHaskell
QuasiQuotes

-- Prelude isn't imported by default as Clash offers Clash.Prelude
NoImplicitPrelude
ghc-options:
-Wall -Wcompat
-haddock

-- Plugins to support type-level constraint solving on naturals
-fplugin GHC.TypeLits.Extra.Solver
-fplugin GHC.TypeLits.Normalise
-fplugin GHC.TypeLits.KnownNat.Solver

-- Clash needs access to the source code in compiled modules
-fexpose-all-unfoldings

-- Plugins to support type-level constraint solving on naturals:
-- - GHC.TypeLits.Extra.Solver
-- - GHC.TypeLits.Normalise
-- - GHC.TypeLits.KnownNat.Solver
-- Clash needs access to the source code in compiled modules:
-- -fexpose-all-unfoldings
-- Worker wrappers introduce unstable names for functions that might have
-- blackboxes attached for them. You can disable this, but be sure to add
-- a no-specialize pragma to every function with a blackbox.
-- -fno-worker-wrapper
-Wall
-Wcompat
-haddock
-fplugin=GHC.TypeLits.Extra.Solver
-fplugin=GHC.TypeLits.Normalise
-fplugin=GHC.TypeLits.KnownNat.Solver
-fexpose-all-unfoldings
-fno-worker-wrapper
build-depends:
base,
Cabal,

build-depends:
-- clash-prelude will set suitable version bounds for the plugins
clash-prelude >= 1.7.0 && < 1.10,
ghc-typelits-natnormalise,
Cabal,
base,
clash-prelude >=1.7.0 && <1.10,
ghc-typelits-extra,
ghc-typelits-knownnat
ghc-typelits-knownnat,
ghc-typelits-natnormalise,

library
import: common-options
Expand Down Expand Up @@ -98,7 +103,8 @@ library
temporary,
text,
typelits-witnesses,
vector
vector,

exposed-modules:
Bittide.Github.Artifacts
Bittide.Hitl
Expand All @@ -111,35 +117,47 @@ library
Bittide.Simulate.Topology
Bittide.Simulate.TunableClockGen
Bittide.Topology

default-language: Haskell2010

test-suite unittests
import: common-options
type: exitcode-stdio-1.0
main-is: unittests.hs
ghc-options: -Wall -Wcompat -threaded
-rtsopts "-with-rtsopts=-N"
import: common-options
type: exitcode-stdio-1.0
main-is: unittests.hs
ghc-options:
-Wall
-Wcompat
-threaded
-rtsopts
-with-rtsopts=-N

default-language: Haskell2010
hs-source-dirs: tests
hs-source-dirs: tests
other-modules:
Tests.Bittide.Simulate

build-depends:
base
, bittide
, bittide-experiments
, clash-prelude
, tasty
, tasty-hedgehog
, tasty-hunit
base,
bittide,
bittide-experiments,
clash-prelude,
tasty,
tasty-hedgehog,
tasty-hunit,

test-suite doctests
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: doctests.hs
ghc-options: -threaded
ghc-options: -Wall -Wcompat -threaded
type: exitcode-stdio-1.0
hs-source-dirs: tests
main-is: doctests.hs
ghc-options: -threaded
ghc-options:
-Wall
-Wcompat
-threaded

build-depends:
base,
bittide-experiments,
doctest-parallel >= 0.3.0.1 && < 0.4,
doctest-parallel >=0.3.0.1 && <0.4,

default-language: Haskell2010
Loading

0 comments on commit e81fb30

Please sign in to comment.