Skip to content

Commit 05f5ac2

Browse files
Initial version of copilot-bluespec
This is an implementation of a Copilot Bluespec backend, based off of an original prototype written by Ivan Perez. The design of `copilot-bluespec` is described in more detail in `DESIGN.md`. The code that it generates is very similar to the style of code that `copilot-c99` generates: each stream is represented as a ring buffer with a corresponding index tracking the latest entry in the buffer, and invocation of the `step` function (or, in the case of `copilot-bluespec`, the `step` rule) computes a new entry and increments the index. I've added unit tests (again, inspired by `copilot-bluespec`) that test all of the operations that `copilot-bluespec` currently supports. The operations that `copilot-bluespec` supports are largely determined by what the Bluespec language itself supports; see the `DESIGN.md` document for more discussion on this point. Co-authored-by: Ivan Perez <ivan.perezdominguez@nasa.gov>
0 parents  commit 05f5ac2

19 files changed

Lines changed: 3347 additions & 0 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: copilot-bluespec
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
# The CACHE_VERSION can be updated to force the use of a new cache if
10+
# the current cache contents become corrupted/invalid. This can
11+
# sometimes happen when (for example) the OS version is changed but
12+
# older .so files are cached, which can have various effects
13+
# (e.g. cabal complains it can't find a valid version of the "happy"
14+
# tool).
15+
CACHE_VERSION: 1
16+
BSC_VERSION: "2023.07"
17+
18+
jobs:
19+
build:
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: [ubuntu-22.04]
25+
ghc-version: ["8.10.7", "9.2.8", "9.4.8"]
26+
cabal: [ '3.10.2.0' ]
27+
steps:
28+
- uses: actions/checkout@v2
29+
with:
30+
submodules: true
31+
32+
- uses: haskell/actions/setup@v1
33+
id: setup-haskell
34+
with:
35+
ghc-version: ${{ matrix.ghc-version }}
36+
cabal-version: ${{ matrix.cabal }}
37+
38+
- uses: actions/cache/restore@v3
39+
name: Restore cabal store cache
40+
with:
41+
path: |
42+
${{ steps.setup-haskell.outputs.cabal-store }}
43+
dist-newstyle
44+
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc-version }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc-version)) }}-${{ github.sha }}
45+
restore-keys: |
46+
${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc-version }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc-version)) }}-
47+
48+
- shell: bash
49+
name: Install bsc
50+
run: |
51+
curl -o bsc.tar.gz -sL "https://github.com/B-Lang-org/bsc/releases/download/${{ env.BSC_VERSION }}/bsc-${{ env.BSC_VERSION }}-ubuntu-22.04.tar.gz"
52+
unzip -o bsc.tar.gz
53+
rm bsc.tar.gz
54+
echo "$PWD/bsc/bin" >> $GITHUB_PATH
55+
56+
- shell: bash
57+
name: Update
58+
run: cabal update
59+
60+
- shell: bash
61+
name: Configure
62+
run: cabal configure --enable-tests -j2 all
63+
64+
- shell: bash
65+
name: Build copilot-bluespec
66+
run: cabal build pkg:copilot-bluespec
67+
68+
- shell: bash
69+
name: Test copilot-bluespec
70+
run: cabal test pkg:copilot-bluespec
71+
72+
- shell: bash
73+
name: Check copilot-bluespec.cabal
74+
run: cabal check
75+
76+
- uses: actions/cache/save@v3
77+
name: Save cabal store cache
78+
if: always()
79+
with:
80+
path: |
81+
${{ steps.setup-haskell.outputs.cabal-store }}
82+
dist-newstyle
83+
key: ${{ env.CACHE_VERSION }}-cabal-${{ matrix.os }}-${{ matrix.ghc-version }}-${{ hashFiles(format('cabal.GHC-{0}.config', matrix.ghc-version)) }}-${{ github.sha }}

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
dist
2+
dist-*
3+
cabal-dev
4+
*.o
5+
*.hi
6+
*.chi
7+
*.chs.h
8+
*.dyn_o
9+
*.dyn_hi
10+
.hpc
11+
.hsenv
12+
.cabal-sandbox/
13+
cabal.sandbox.config
14+
*.prof
15+
*.aux
16+
*.hp
17+
*.eventlog
18+
.stack-work/
19+
cabal.project.local
20+
cabal.project.local~
21+
.HTF/
22+
.ghc.environment.*
23+
copilot-profiling
24+
.DS_Store
25+
.log

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2024-02-08
2+
* Create new library for Bluespec backend.

0 commit comments

Comments
 (0)