Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into genwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
krame505 committed Aug 23, 2024
2 parents df0f863 + b4f31db commit d7b1859
Show file tree
Hide file tree
Showing 12 changed files with 245 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ jobs:
uses: ./.github/workflows/build-and-test-ubuntu.yml
with:
os: ${{ matrix.os }}
ghc_version: 9.6.5
hls_version: 2.8.0.0
ghc_version: 9.6.6
hls_version: 2.9.0.1
secrets: inherit

build-and-test-macos:
Expand All @@ -55,8 +55,8 @@ jobs:
uses: ./.github/workflows/build-and-test-macos.yml
with:
os: ${{ matrix.os }}
ghc_version: 9.6.5
hls_version: 2.8.0.0
ghc_version: 9.6.6
hls_version: 2.9.0.1
secrets: inherit

# ------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/BH_ref_guide/BH_lang.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3055,7 +3055,7 @@ \subsection{{\veri} modules}
share a port and it will insert a multiplexer accordingly.

Following a port name there can be port a property,
whic is one of the following:
which is one of the following:
\begindescrlist{xxxxxxx}
\litem{\te{reg}}
specifies that the port is directly connected
Expand Down
91 changes: 91 additions & 0 deletions release/ReleaseNotes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,97 @@ Bluespec Compiler (BSC) Release Notes
:last-update-label!:
:nofooter:

2024.07 Release
---------------

Changes since release 2024.01:

Documentation
~~~~~~~~~~~~~

* Fix the type of `continuousAssert` in the Libraries Reference Guide
(GitHub PR#686)
* Minor typo fix in the BH Reference Guide (GitHub PR#708)
Compiler
~~~~~~~~

* Update source code to compile with GHC 9.10.1 (GitHub PR#705)
Libraries
~~~~~~~~~

* Add BuildList library, analogous to BuildVector (GitHub PR#723)
Bluetcl
~~~~~~~

* Resolve a potential compilation warning by removing the use of
K&R C syntax that is deprecated in newer C standards
(GitHub PR#703)
Bluesim
~~~~~~~

* Add braces to some if-statements in generated {cpp} modules to avoid
dangling-else warnings (GitHub Issue#442, PR#691)
* Resolve a warning during compilation of the Bluesim kernel by fixing
a call to `bk_clock_name` in code that is unused except by
developers for debugging (GitHub Issue#698, PR#702)
* Resolve a compilation error with newer {cpp} compilers by updating the
source code to not use a feature that is deprecated since the C++20
standard (GitHub Issue#698, PR#701)
Utilities
~~~~~~~~~

* Update BSV mode for `emacs` to work with newer versions
(GitHub PR#697)
General
~~~~~~~

* Clean up how the `tcllibs` flags are computed in `platform.sh`
(GitHub PR#703)
** This adds the version number to the flag for macOS
(from `-ltcl` to `-ltcl8.5`)
Test Suite
~~~~~~~~~~

* Add support for querying the `MACHTYPE` so that tests can support
different behavior on, say, `arm64` vs `x86_64`
(GitHub Issue#688, PR#690)
Internal
~~~~~~~~

* Releases now built with GHC 9.6.6 (previously 9.4.8)
(GitHub PR#705, PR#728)
* Updates to GitHub CI (continuous integration)
** Retire the CI for macOS 11 (GitHub PR#700)
** Add CI for macOS 14 (GitHub PR#690)
** Add CI for Ubuntu 24.04 (beta) (GitHub PR#700)
** Expand the number of GHC versions that are tested besides
the version for releases -- previously only a single "latest"
version was being tested (GitHub PR#705)
*** Continue testing with older GHC 9.4.8,
which GHCUP still labels as recommended
*** Continue testing with GHC 9.8 (updated to the latest 9.8.2)
*** Add testing with the new GHC 9.10.1
** Support leaving the `hls_version` field blank to indicate that
the HLS testing step should be skipped (PR#703)
*** This allows for testing newer GHC installations
that don't yet have HLS support in GHCUP
** Ensure that `brew` and `apt-get` are updated before installing,
to avoid failures due to old GitHub runner images (GitHub PR#687)
'''

2024.01 Release
---------------

Expand Down
25 changes: 25 additions & 0 deletions src/Libraries/Base3-Misc/BuildList.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package BuildList where

import List

-- A typeclass used to implement a vector construction function which can take
-- any number of arguments (>0).
-- The type parameter `a` is the type of the elements in the list.
-- The type parameter `r` is the return type of the function, which can be a
-- list (base case) or a function (recursive case) that takes another element
-- and returns a new function.
-- The list here is built in reverse for efficiency, and then reversed.
class BuildList a r | r -> a where
lst' :: List a -> a -> r

instance BuildList a (List a) where
lst' l x = reverse $ x :> l

instance (BuildList a r) => BuildList a (a -> r) where
lst' l x y = lst' (x :> l) y

-- Example usage:
-- lst 1 2 3 4 5 => 1 :> 2 :> 3 :> 4 :> 5 :> nil
-- lst False => False :> nil
lst :: (BuildList a r) => a -> r
lst x = lst' nil x
1 change: 1 addition & 0 deletions src/Libraries/Base3-Misc/Misc.bsv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package Misc;
import Arbiter::*;
import BRAM::*;
import BRAMFIFO::*;
import BuildList::*;
import BuildVector::*;
import BUtils::*;
import BypassReg::*;
Expand Down
8 changes: 8 additions & 0 deletions testsuite/bsc.lib/BuildList/BuildList.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Test functionality
test_veri_only TestBuildList

# Test type check error messages
compile_fail TestBuildListFail.bs
compare_file TestBuildListFail.bs.bsc-out

5 changes: 5 additions & 0 deletions testsuite/bsc.lib/BuildList/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# for "make clean" to work everywhere

CONFDIR = $(realpath ../..)

include $(CONFDIR)/clean.mk
42 changes: 42 additions & 0 deletions testsuite/bsc.lib/BuildList/TestBuildList.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package TestBuildList where

import List
import BuildList

{-# properties sysTestBuildList = { synthesize } #-}

sysTestBuildList :: Module Empty
sysTestBuildList =
module
let
v1 :: List Bool
v1 = lst True False True True

v2 :: List (UInt 8);
v2 = lst 7 32

v3 :: List Bool
v3 = lst False True True

v4 :: List (UInt 4)
v4 = lst 3

done :: Reg Bool <- mkReg False

rules
"r": when not done
==> action
$display "v1[0] -> %b" (v1!!0)
$display "v1[1] -> %b" (v1!!1)
$display "v1[2] -> %b" (v1!!2)
$display "v1[3] -> %b" (v1!!3)
$display "v2[0] -> %d" (v2!!0)
$display "v2[1] -> %d" (v2!!1)
$display "v3[0] -> %b" (v3!!0)
$display "v3[1] -> %b" (v3!!1)
$display "v3[2] -> %b" (v3!!2)
$display "v4[0] -> %d" (v4!!0)
done := True

"r2": when done
==> $finish 0
27 changes: 27 additions & 0 deletions testsuite/bsc.lib/BuildList/TestBuildListFail.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package TestBuildListFail where

import List
import BuildList

-- Test error messages

-- Wrong element type, Literal
fn1 :: Bool
fn1 =
let v :: List Bool
v = lst 0 1 2
in v == v

-- Wrong element type, concrete
fn2 :: Bool
fn2 =
let v :: List Integer
v = lst True False True
in v == v

-- Wrong return type
fn3 :: Bool
fn3 =
let v :: Bit 3
v = lst True False True
in v == v
24 changes: 24 additions & 0 deletions testsuite/bsc.lib/BuildList/TestBuildListFail.bs.bsc-out.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
checking package dependencies
compiling TestBuildListFail.bs
Error: "TestBuildListFail.bs", line 12, column 13: (T0031)
The contexts for this expression could not be resolved because there are no
instances of the form:
Prelude.Literal Prelude.Bool
The context was implied by expressions at the following positions:
"TestBuildListFail.bs", line 12, column 17
Error: "TestBuildListFail.bs", line 18, column 8: (T0032)
This expression requires the following context which could not be resolved:
BuildList.BuildList Prelude.Bool (Prelude.Bool -> Prelude.Bool -> Prelude.List Prelude.Integer)
The context was implied by expressions at the following positions:
"TestBuildListFail.bs", line 19, column 13
An instance for this context exists, but it depends on the following context
for which there is no instance:
BuildList.BuildList Prelude.Bool (Prelude.List Prelude.Integer)
Error: "TestBuildListFail.bs", line 25, column 8: (T0032)
This expression requires the following context which could not be resolved:
BuildList.BuildList Prelude.Bool (Prelude.Bool -> Prelude.Bool -> Prelude.Bit 3)
The context was implied by expressions at the following positions:
"TestBuildListFail.bs", line 26, column 13
An instance for this context exists, but it depends on the following context
for which there is no instance:
BuildList.BuildList Prelude.Bool (Prelude.Bit 3)
10 changes: 10 additions & 0 deletions testsuite/bsc.lib/BuildList/sysTestBuildList.out.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
v1[0] -> 1
v1[1] -> 0
v1[2] -> 1
v1[3] -> 1
v2[0] -> 7
v2[1] -> 32
v3[0] -> 0
v3[1] -> 1
v3[2] -> 1
v4[0] -> 3
13 changes: 7 additions & 6 deletions util/emacs/bsv-mode/bsv-mode-23.el
Original file line number Diff line number Diff line change
Expand Up @@ -3677,8 +3677,9 @@ Key bindings specific to `bsv-mode-map' are:
(set (make-local-variable 'imenu-generic-expression)
bsv-imenu-generic-expression)
;; Tell which-func-modes that imenu knows about bsv
(when (boundp 'which-func-modes)
(add-to-list 'which-func-modes 'bsv-mode))
(when (boundp 'which-func-modes)
(when (eq (type-of which-func-modes) 'cons)
(add-to-list 'which-func-modes 'bsv-mode)))
;; hideshow support
(when (boundp 'hs-special-modes-alist)
(unless (assq 'bsv-mode hs-special-modes-alist)
Expand Down Expand Up @@ -12609,7 +12610,7 @@ See also `bsv-header' for an alternative format."
(define-skeleton bsv-sk-task
"Insert a task definition."
()
> "task " '(bsv-sk-prompt-name) & ?; \n
> "task " '(bsv-sk-prompt-name) & ?\; \n
> _ \n
> "begin" \n
> \n
Expand All @@ -12619,7 +12620,7 @@ See also `bsv-header' for an alternative format."
(define-skeleton bsv-sk-function
"Insert a function definition."
()
> "function [" '(bsv-sk-prompt-width) | -1 '(bsv-sk-prompt-name) ?; \n
> "function [" '(bsv-sk-prompt-width) | -1 '(bsv-sk-prompt-name) ?\; \n
> _ \n
> "begin" \n
> \n
Expand Down Expand Up @@ -12815,13 +12816,13 @@ and the case items."
'(setq input "state")
> "// State registers for " str | -23 \n
'(setq bsv-sk-state str)
> "reg [" '(bsv-sk-prompt-width) | -1 bsv-sk-state ", next_" bsv-sk-state ?; \n
> "reg [" '(bsv-sk-prompt-width) | -1 bsv-sk-state ", next_" bsv-sk-state ?\; \n
'(setq input nil)
> \n
> "// State FF for " bsv-sk-state \n
> "always @ ( " (read-string "clock:" "posedge clk") " or " (bsv-sk-prompt-reset) " ) begin" \n
> "if ( " bsv-sk-reset " ) " bsv-sk-state " = 0; else" \n
> bsv-sk-state " = next_" bsv-sk-state ?; \n
> bsv-sk-state " = next_" bsv-sk-state ?\; \n
> (- bsv-indent-level-behavioral) "end" (progn (electric-bsv-terminate-line) nil)
> \n
> "// Next State Logic for " bsv-sk-state \n
Expand Down

0 comments on commit d7b1859

Please sign in to comment.