copilot-bluespec 4.8.1 → 4.8.2
raw patch · 3 files changed
+30/−25 lines, 3 filesdep ~copilot-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: copilot-core
API changes (from Hackage documentation)
Files
- CHANGELOG +5/−0
- copilot-bluespec.cabal +2/−2
- src/Copilot/Compile/Bluespec/Expr.hs +23/−23
CHANGELOG view
@@ -1,3 +1,8 @@+2026-11-07+ * Version bump (4.8.2). (#792)+ * Replace tabs in `DESIGN.md`. (#772)+ * Remove trailing spaces. (#775)+ 2026-09-07 * Version bump (4.8.1). (#760) * Replace tab in CHANGELOG. (#755)
copilot-bluespec.cabal view
@@ -1,6 +1,6 @@ cabal-version : >= 1.10 name : copilot-bluespec-version : 4.8.1+version : 4.8.2 synopsis : A compiler for Copilot targeting FPGAs. description : This package is a back-end from Copilot to FPGAs in Bluespec.@@ -51,7 +51,7 @@ , ieee754 >= 0.8.0 && < 0.9 , pretty >= 1.1.2 && < 1.2 - , copilot-core >= 4.8.1 && < 4.9+ , copilot-core >= 4.8.2 && < 4.9 , language-bluespec >= 0.1 && < 0.2 exposed-modules : Copilot.Compile.Bluespec
src/Copilot/Compile/Bluespec/Expr.hs view
@@ -627,43 +627,43 @@ -- | 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 + -- 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") + | isInfinite d = BS.CApply+ (BS.CVar $ BS.mkId BS.NoPos "infinity") [ if d < 0- then BS.CCon BS.idTrue [] + then BS.CCon BS.idTrue [] else BS.CCon BS.idFalse [] ]- - | isNaN d = let - cexpr = BS.CHasType ++ | 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.CQType [] $ BS.TCon $+ BS.TyCon+ (BS.mkId BS.NoPos ctype)+ Nothing BS.TIabstract )- cval = case ty of - Float -> fromIntegral $ + cval = case ty of+ Float -> fromIntegral $ castFloatToWord32 $ uncastDoubleNaNToFloat d- Double -> fromIntegral $ + Double -> fromIntegral $ castDoubleToWord64 d _ -> impossible "constFP" "copilot-bluespec"- ctype = case ty of + 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 [] + | 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@@ -676,13 +676,13 @@ [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 +-- 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) +uncastDoubleNaNToFloat nan = if (isSignaling nan)+ then (setPayloadSignaling payload) else (setPayload payload)- where + where payload = double2Float $ getPayload nan -- | Create a Bluespec expression consisting of a literal.