diff --git a/copilot-bluespec/CHANGELOG b/copilot-bluespec/CHANGELOG index 5365300c..9235a2a2 100644 --- a/copilot-bluespec/CHANGELOG +++ b/copilot-bluespec/CHANGELOG @@ -1,3 +1,8 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + * Disable test suite via newly added manual cabal flag. (#673) + * Fix translation of constant floating-point values. (#696) + 2025-11-07 * Version bump (4.6). (#679) * Flip direction of interface inputs and outputs in Bluespec. (#677) diff --git a/copilot-bluespec/copilot-bluespec.cabal b/copilot-bluespec/copilot-bluespec.cabal index 975868ac..b727af7f 100644 --- a/copilot-bluespec/copilot-bluespec.cabal +++ b/copilot-bluespec/copilot-bluespec.cabal @@ -1,6 +1,6 @@ cabal-version : >= 1.10 name : copilot-bluespec -version : 4.6 +version : 4.6.1 synopsis : A compiler for Copilot targeting FPGAs. description : This package is a back-end from Copilot to FPGAs in Bluespec. @@ -34,6 +34,11 @@ source-repository head type: git location: https://github.com/Copilot-Language/copilot-bluespec.git +flag test-bluespec + description: Enable tests that require the Bluespec compiler (bsc) + default: False + manual: True + library default-language : Haskell2010 hs-source-dirs : src @@ -42,10 +47,12 @@ library build-depends : base >= 4.9 && < 5 , directory >= 1.3 && < 1.4 , filepath >= 1.4 && < 1.6 + , fp-ieee >= 0.1.0 && < 0.2 + , ieee754 >= 0.8.0 && < 0.9 , pretty >= 1.1.2 && < 1.2 - , copilot-core >= 4.6 && < 4.7 - , language-bluespec >= 0.1 && < 0.2 + , copilot-core >= 4.6.1 && < 4.7 + , language-bluespec >= 0.1 && < 0.2 exposed-modules : Copilot.Compile.Bluespec @@ -98,3 +105,8 @@ test-suite tests ghc-options: -Wall + + if flag(test-bluespec) + buildable: True + else + buildable: False diff --git a/copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs b/copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs index 7297fad2..39ff1ad2 100644 --- a/copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs +++ b/copilot-bluespec/src/Copilot/Compile/Bluespec/Expr.hs @@ -17,6 +17,8 @@ import Data.Foldable (foldl') import Data.String (IsString (..)) import qualified Language.Bluespec.Classic.AST as BS import qualified Language.Bluespec.Classic.AST.Builtin.Ids as BS +import Numeric.Floating.IEEE.NaN (isSignaling, setPayloadSignaling, setPayload, getPayload) +import GHC.Float (double2Float, castFloatToWord32, castDoubleToWord64) -- Internal imports: Copilot import Copilot.Core @@ -611,14 +613,63 @@ constInt ty i -- | Translate a Copilot floating-point literal into a Bluespec expression. constFP :: Type ty -> Double -> BS.CExpr constFP ty d + -- Bluespec internally represents all IEEE floating-point values as structs + -- so special symbols have to be called for constructing special values, + -- e.g. NaN, inf, and -0.0. See + -- https://github.com/B-Lang-org/bsc/blob/main/src/Libraries/Base3-Math/FloatingPoint.bsv#L441 + | isInfinite d = BS.CApply + (BS.CVar $ BS.mkId BS.NoPos "infinity") + [ if d < 0 + then BS.CCon BS.idTrue [] + else BS.CCon BS.idFalse [] + ] + + | isNaN d = let + cexpr = BS.CHasType + ( BS.CLit $ BS.CLiteral BS.NoPos $ BS.LInt $ + BS.IntLit Nothing 10 cval + ) + ( BS.CQType [] $ BS.TCon $ + BS.TyCon + (BS.mkId BS.NoPos ctype) + Nothing + BS.TIabstract + ) + cval = case ty of + Float -> fromIntegral $ + castFloatToWord32 $ uncastDoubleNaNToFloat d + Double -> fromIntegral $ + castDoubleToWord64 d + _ -> impossible "constFP" "copilot-bluespec" + ctype = case ty of + Float -> "Bit 32" + Double -> "Bit 64" + _ -> impossible "constFP" "copilot-bluespec" + in BS.CApply (BS.CVar $ BS.mkId BS.NoPos "unpack") [cexpr] + | d == 0 = BS.CApply + (BS.CVar $ BS.mkId BS.NoPos "zero") + [ if isNegativeZero d + then BS.CCon BS.idTrue [] + else BS.CCon BS.idFalse [] + ] + | d > 0 = withTypeAnnotation ty $ cLit $ BS.LReal d -- Bluespec intentionally does not support negative literal syntax (e.g., -- -42.5), so we must create negative floating-point literals using the -- `negate` function. - | d >= 0 = withTypeAnnotation ty $ cLit $ BS.LReal d - | otherwise = withTypeAnnotation ty $ - BS.CApply - (BS.CVar $ BS.idNegateAt BS.NoPos) - [cLit $ BS.LReal $ negate d] + | otherwise = withTypeAnnotation ty $ + BS.CApply + (BS.CVar $ BS.idNegateAt BS.NoPos) + [cLit $ BS.LReal $ negate d] + +-- Because NaNs are specially placed as bit-representations by `constfp` and `constfp` requires Doubles as inputs, +-- we need to convert NaN doubles safely into NaN floats. GHC Double2Float does not preserve signal nor payload +-- internals of NaNs so in this case we need a special conversion. +uncastDoubleNaNToFloat :: Double -> Float +uncastDoubleNaNToFloat nan = if (isSignaling nan) + then (setPayloadSignaling payload) + else (setPayload payload) + where + payload = double2Float $ getPayload nan -- | Create a Bluespec expression consisting of a literal. cLit :: BS.Literal -> BS.CExpr diff --git a/copilot-c99/CHANGELOG b/copilot-c99/CHANGELOG index 8b7be686..7a2ef8da 100644 --- a/copilot-c99/CHANGELOG +++ b/copilot-c99/CHANGELOG @@ -1,3 +1,6 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-c99/copilot-c99.cabal b/copilot-c99/copilot-c99.cabal index e5efd5f2..40407cec 100644 --- a/copilot-c99/copilot-c99.cabal +++ b/copilot-c99/copilot-c99.cabal @@ -1,6 +1,6 @@ cabal-version : >= 1.10 name : copilot-c99 -version : 4.6 +version : 4.6.1 synopsis : A compiler for Copilot targeting C99. description : This package is a back-end from Copilot to C. @@ -45,7 +45,7 @@ library , mtl >= 2.2 && < 2.4 , pretty >= 1.1 && < 1.2 - , copilot-core >= 4.6 && < 4.7 + , copilot-core >= 4.6.1 && < 4.7 , language-c99 >= 0.2.0 && < 0.3 , language-c99-simple >= 0.3 && < 0.4 diff --git a/copilot-core/CHANGELOG b/copilot-core/CHANGELOG index b0b94a73..c00db088 100644 --- a/copilot-core/CHANGELOG +++ b/copilot-core/CHANGELOG @@ -1,3 +1,6 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-core/copilot-core.cabal b/copilot-core/copilot-core.cabal index 6c18d6ca..336db0f2 100644 --- a/copilot-core/copilot-core.cabal +++ b/copilot-core/copilot-core.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-core -version: 4.6 +version: 4.6.1 synopsis: An intermediate representation for Copilot. description: Intermediate representation for Copilot. diff --git a/copilot-interpreter/CHANGELOG b/copilot-interpreter/CHANGELOG index c6f5b6cb..1827da72 100644 --- a/copilot-interpreter/CHANGELOG +++ b/copilot-interpreter/CHANGELOG @@ -1,3 +1,6 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-interpreter/copilot-interpreter.cabal b/copilot-interpreter/copilot-interpreter.cabal index e8b9fad4..7395226a 100644 --- a/copilot-interpreter/copilot-interpreter.cabal +++ b/copilot-interpreter/copilot-interpreter.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-interpreter -version: 4.6 +version: 4.6.1 synopsis: Interpreter for Copilot. description: Interpreter for Copilot. @@ -44,7 +44,7 @@ library base >= 4.9 && < 5, pretty >= 1.0 && < 1.2, - copilot-core >= 4.6 && < 4.7 + copilot-core >= 4.6.1 && < 4.7 exposed-modules: diff --git a/copilot-language/CHANGELOG b/copilot-language/CHANGELOG index c2242629..eca06453 100644 --- a/copilot-language/CHANGELOG +++ b/copilot-language/CHANGELOG @@ -1,3 +1,7 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + * Relax version constraint on containers. (#603) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-language/copilot-language.cabal b/copilot-language/copilot-language.cabal index 543a1177..0b65b579 100644 --- a/copilot-language/copilot-language.cabal +++ b/copilot-language/copilot-language.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-language -version: 4.6 +version: 4.6.1 synopsis: A Haskell-embedded DSL for monitoring hard real-time distributed systems. description: @@ -38,13 +38,13 @@ library build-depends: base >= 4.9 && < 5 , array >= 0.5 && < 0.6 - , containers >= 0.4 && < 0.8 + , containers >= 0.4 && < 0.9 , data-reify >= 0.6 && < 0.7 , mtl >= 2.0 && < 3 - , copilot-core >= 4.6 && < 4.7 - , copilot-interpreter >= 4.6 && < 4.7 - , copilot-theorem >= 4.6 && < 4.7 + , copilot-core >= 4.6.1 && < 4.7 + , copilot-interpreter >= 4.6.1 && < 4.7 + , copilot-theorem >= 4.6.1 && < 4.7 exposed-modules: Copilot.Language , Copilot.Language.Operators.BitWise diff --git a/copilot-libraries/CHANGELOG b/copilot-libraries/CHANGELOG index 6f6a6a6b..6ae010b9 100644 --- a/copilot-libraries/CHANGELOG +++ b/copilot-libraries/CHANGELOG @@ -1,3 +1,7 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + * Relax version constraint on containers. (#603) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-libraries/copilot-libraries.cabal b/copilot-libraries/copilot-libraries.cabal index 9b17524f..c864c9cd 100644 --- a/copilot-libraries/copilot-libraries.cabal +++ b/copilot-libraries/copilot-libraries.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-libraries -version: 4.6 +version: 4.6.1 synopsis: Libraries for the Copilot language. description: Libraries for the Copilot language. @@ -38,10 +38,10 @@ library build-depends: base >= 4.9 && < 5 - , containers >= 0.4 && < 0.8 + , containers >= 0.4 && < 0.9 , mtl >= 2.0 && < 2.4 , parsec >= 2.0 && < 3.2 - , copilot-language >= 4.6 && < 4.7 + , copilot-language >= 4.6.1 && < 4.7 exposed-modules: Copilot.Library.Libraries diff --git a/copilot-prettyprinter/CHANGELOG b/copilot-prettyprinter/CHANGELOG index 26b0500a..ed0b61ad 100644 --- a/copilot-prettyprinter/CHANGELOG +++ b/copilot-prettyprinter/CHANGELOG @@ -1,3 +1,6 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-prettyprinter/copilot-prettyprinter.cabal b/copilot-prettyprinter/copilot-prettyprinter.cabal index 0f413f63..b303db95 100644 --- a/copilot-prettyprinter/copilot-prettyprinter.cabal +++ b/copilot-prettyprinter/copilot-prettyprinter.cabal @@ -1,6 +1,6 @@ cabal-version: >=1.10 name: copilot-prettyprinter -version: 4.6 +version: 4.6.1 synopsis: A prettyprinter of Copilot Specifications. description: A prettyprinter of Copilot specifications. @@ -45,7 +45,7 @@ library base >= 4.9 && < 5, pretty >= 1.0 && < 1.2, - copilot-core >= 4.6 && < 4.7 + copilot-core >= 4.6.1 && < 4.7 exposed-modules: diff --git a/copilot-theorem/CHANGELOG b/copilot-theorem/CHANGELOG index 463ef02c..f3dd23d6 100644 --- a/copilot-theorem/CHANGELOG +++ b/copilot-theorem/CHANGELOG @@ -1,3 +1,7 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + * Relax version constraint on containers, random. (#603) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-theorem/copilot-theorem.cabal b/copilot-theorem/copilot-theorem.cabal index b830f91a..173e90ec 100644 --- a/copilot-theorem/copilot-theorem.cabal +++ b/copilot-theorem/copilot-theorem.cabal @@ -14,7 +14,7 @@ description: . -version : 4.6 +version : 4.6.1 license : BSD3 license-file : LICENSE maintainer : Ivan Perez @@ -48,7 +48,7 @@ library build-depends : base >= 4.9 && < 5 , bimap (>= 0.3 && < 0.4) || (>= 0.5 && < 0.6) , bv-sized >= 1.0.2 && < 1.1 - , containers >= 0.4 && < 0.8 + , containers >= 0.4 && < 0.9 , data-default >= 0.7 && < 0.9 , directory >= 1.3 && < 1.4 , libBF >= 0.6.2 && < 0.7 @@ -57,13 +57,13 @@ library , parameterized-utils >= 2.1.1 && < 2.2 , pretty >= 1.0 && < 1.2 , process >= 1.6 && < 1.7 - , random >= 1.1 && < 1.3 + , random >= 1.1 && < 1.4 , transformers >= 0.5 && < 0.7 , xml >= 1.3 && < 1.4 , what4 >= 1.3 && < 1.8 - , copilot-core >= 4.6 && < 4.7 - , copilot-prettyprinter >= 4.6 && < 4.7 + , copilot-core >= 4.6.1 && < 4.7 + , copilot-prettyprinter >= 4.6.1 && < 4.7 exposed-modules : Copilot.Theorem , Copilot.Theorem.Prove diff --git a/copilot-verifier/CHANGELOG b/copilot-verifier/CHANGELOG index e4b2f954..ca874028 100644 --- a/copilot-verifier/CHANGELOG +++ b/copilot-verifier/CHANGELOG @@ -1,3 +1,6 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-verifier/copilot-verifier.cabal b/copilot-verifier/copilot-verifier.cabal index 9c6bed8d..f77ebfca 100644 --- a/copilot-verifier/copilot-verifier.cabal +++ b/copilot-verifier/copilot-verifier.cabal @@ -1,6 +1,6 @@ Cabal-version: 2.2 Name: copilot-verifier -Version: 4.6 +Version: 4.6.1 Author: Galois Inc. Maintainer: rscott@galois.com Copyright: (c) Galois, Inc 2021-2024 @@ -45,9 +45,9 @@ common bldflags bv-sized >= 1.0.0 && < 1.1, bytestring, containers >= 0.5.9.0, - copilot-c99 >= 4.6 && < 4.7, - copilot-core >= 4.6 && < 4.7, - copilot-theorem >= 4.6 && < 4.7, + copilot-c99 >= 4.6.1 && < 4.7, + copilot-core >= 4.6.1 && < 4.7, + copilot-theorem >= 4.6.1 && < 4.7, crucible >= 0.7.1 && < 0.8, crucible-llvm >= 0.7 && < 0.8, crux >= 0.7.1 && < 0.8, @@ -80,10 +80,10 @@ library copilot-verifier-examples hs-source-dirs: examples build-depends: case-insensitive, - copilot >= 4.6 && < 4.7, - copilot-language >= 4.6 && < 4.7, - copilot-libraries >= 4.6 && < 4.7, - copilot-prettyprinter >= 4.6 && < 4.7, + copilot >= 4.6.1 && < 4.7, + copilot-language >= 4.6.1 && < 4.7, + copilot-libraries >= 4.6.1 && < 4.7, + copilot-prettyprinter >= 4.6.1 && < 4.7, copilot-verifier exposed-modules: Copilot.Verifier.Examples diff --git a/copilot-visualizer/CHANGELOG b/copilot-visualizer/CHANGELOG index 2dbe2a7a..85bc4173 100644 --- a/copilot-visualizer/CHANGELOG +++ b/copilot-visualizer/CHANGELOG @@ -1,3 +1,6 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot-visualizer/copilot-visualizer.cabal b/copilot-visualizer/copilot-visualizer.cabal index 6afd9070..c481a8d0 100644 --- a/copilot-visualizer/copilot-visualizer.cabal +++ b/copilot-visualizer/copilot-visualizer.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: copilot-visualizer -version: 4.6 +version: 4.6.1 synopsis: Visualizer for Copilot. description: Visualizer for Copilot. @@ -65,10 +65,10 @@ library text >= 1.2.3.1 && < 2.2, websockets >= 0.12.7 && < 0.14, - copilot >= 4.6 && < 4.7, - copilot-core >= 4.6 && < 4.7, - copilot-interpreter >= 4.6 && < 4.7, - copilot-language >= 4.6 && < 4.7 + copilot >= 4.6.1 && < 4.7, + copilot-core >= 4.6.1 && < 4.7, + copilot-interpreter >= 4.6.1 && < 4.7, + copilot-language >= 4.6.1 && < 4.7 exposed-modules: @@ -121,7 +121,7 @@ executable tikz-example build-depends: base >= 4.9 && < 5, - copilot >= 4.6 && < 4.7, + copilot >= 4.6.1 && < 4.7, copilot-visualizer if flag(examples) diff --git a/copilot/CHANGELOG b/copilot/CHANGELOG index 11069c98..15678af7 100644 --- a/copilot/CHANGELOG +++ b/copilot/CHANGELOG @@ -1,3 +1,7 @@ +2026-01-07 + * Version bump (4.6.1). (#705) + * Relax version constraint on optparse-applicative. (#603) + 2025-11-07 * Version bump (4.6). (#679) diff --git a/copilot/copilot.cabal b/copilot/copilot.cabal index f52eecc4..66304a0f 100644 --- a/copilot/copilot.cabal +++ b/copilot/copilot.cabal @@ -1,5 +1,5 @@ name: copilot -version: 4.6 +version: 4.6.1 cabal-version: >= 1.10 license: BSD3 license-file: LICENSE @@ -48,16 +48,16 @@ library -fno-warn-orphans build-depends: base >= 4.9 && < 5 - , optparse-applicative >= 0.14 && < 0.19 + , optparse-applicative >= 0.14 && < 0.20 , directory >= 1.3 && < 1.4 , filepath >= 1.4 && < 1.6 - , copilot-core >= 4.6 && < 4.7 - , copilot-theorem >= 4.6 && < 4.7 - , copilot-language >= 4.6 && < 4.7 - , copilot-libraries >= 4.6 && < 4.7 - , copilot-c99 >= 4.6 && < 4.7 - , copilot-prettyprinter >= 4.6 && < 4.7 + , copilot-core >= 4.6.1 && < 4.7 + , copilot-theorem >= 4.6.1 && < 4.7 + , copilot-language >= 4.6.1 && < 4.7 + , copilot-libraries >= 4.6.1 && < 4.7 + , copilot-c99 >= 4.6.1 && < 4.7 + , copilot-prettyprinter >= 4.6.1 && < 4.7 exposed-modules: Language.Copilot, Language.Copilot.Main