clash-ghc 1.6.3 → 1.6.4
raw patch · 3 files changed
+57/−8 lines, 3 filesdep ~clash-libdep ~clash-preludedep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: clash-lib, clash-prelude, lens
API changes (from Hackage documentation)
Files
- CHANGELOG.md +29/−0
- clash-ghc.cabal +4/−4
- src-ghc/Clash/GHC/Evaluator.hs +24/−4
CHANGELOG.md view
@@ -1,4 +1,33 @@ # Changelog for the Clash project+## 1.6.4 *Aug 30th 2022*+Fixed:++ * Input validation of the used arguments in blackboxes is now complete. [#2184](https://github.com/clash-lang/clash-compiler/pull/2184)+ * `Clash.Annotations.BitRepresentation.Deriving.deriveAnnotation` no longer has quadratic complexity in the size of the constructors and fields. [#2209](https://github.com/clash-lang/clash-compiler/pull/2209)+ * Fully resolve type synonyms when deriving bit representations. [#2209](https://github.com/clash-lang/clash-compiler/pull/2209)+ * Disregard ticks when determining whether terms are shared. Fixes [#2233](https://github.com/clash-lang/clash-compiler/issues/2233).+ * The blackbox parser will make sure it fully parses its input, and report an error when it can't. [#2237](https://github.com/clash-lang/clash-compiler/issues/2237)+ * Wrap ~ARG[n] in parentheses. Fixes [#2213](https://github.com/clash-lang/clash-compiler/issues/2213)+ * The VHDL shift primitives no longer generate bound check failures. Fixes [#2215](https://github.com/clash-lang/clash-compiler/issues/2215)+ * Evaluator fails impredicative type instantiation of error values [#2272](https://github.com/clash-lang/clash-compiler/issues/2272)+ * Fix out of bound errors in toEnum/fromSLV for sum types [#2220](https://github.com/clash-lang/clash-compiler/issues/2220)+ * Netlist generation fails for certain uses of GADTs [#2289](https://github.com/clash-lang/clash-compiler/issues/2289)+ * The documentation for `ANN TestBench` had it backwards; it now correctly indicates the annotation is on the test bench, not the device under test. [#1750](https://github.com/clash-lang/clash-compiler/issues/1750)++Fixes with minor changes:++ * `reduceXor` now produces a result if the argument has undefined bits instead of throwing an `XException` (the result is an undefined bit). `reduceAnd` and `reduceOr` already always produced a result. [#2244](https://github.com/clash-lang/clash-compiler/pull/2244)++Added:++ * Support for symbols in types while deriving bit representations. [#2209](https://github.com/clash-lang/clash-compiler/pull/2209)+ * Support for promoted data types while deriving bit representations. [#2209](https://github.com/clash-lang/clash-compiler/pull/2209)+ * `scanlPar` and `scanrPar` in Clash's Prelude, as well as the `RTree` versions `tscanl` and `tscanr`. These variants of `scanl1` and `scanr1` compile to a binary tree of operations, with a depth of `O(log(n))` (`n` being the length of the vector) rather than a depth of `n` for `scanl1` and `scanr1`. [#2177](https://github.com/clash-lang/clash-compiler/pull/2177)+ * The GADT constructors for `RTree` (`RLeaf` and `RBranch`) are now exported directly in addition to the patterns `LR` and `BR`. [#2177](https://github.com/clash-lang/clash-compiler/pull/2177)+ * Added the `~ISSCALAR` template which can be used to check if an argument is rendered to a scalar in HDL. [#2184](https://github.com/clash-lang/clash-compiler/pull/2184)+ * Added support for records and infix constructors when using `Clash.Annotations.BitRepresentation.Deriving.deriveAnnotation`. [#2191](https://github.com/clash-lang/clash-compiler/pull/2191)+ * Clash now contains instances for `ShowX`, `NFDataX` and `BitPack` on the newtypes from the Data.Functor modules (`Identity`, `Const`, `Compose`, `Product` and `Sum`). [#2218](https://github.com/clash-lang/clash-compiler/issues/2218)+ ## 1.6.3 *Apr 7th 2022* Fixed: * Handle `~ISUNDEFINED` hole in black boxes for `BitVector` and for product types. This means that with `-fclash-aggressive-x-optimization-blackboxes`, resets are now omitted for _undefined_ reset values of such types as well. [#2117](https://github.com/clash-lang/clash-compiler/issues/2117)
clash-ghc.cabal view
@@ -1,6 +1,6 @@ Cabal-version: 2.2 Name: clash-ghc-Version: 1.6.3+Version: 1.6.4 Synopsis: Clash: a functional hardware description language - GHC frontend Description: Clash is a functional hardware description language that borrows both its@@ -144,15 +144,15 @@ process >= 1.2 && < 1.7, hashable >= 1.1.2.3 && < 1.5, haskeline >= 0.7.0.3 && < 0.9,- lens >= 4.10 && < 5.1.0,+ lens >= 4.10 && < 5.2.0, mtl >= 2.1.1 && < 2.3, split >= 0.2.3 && < 0.3, text >= 1.2.2 && < 2.1, transformers >= 0.5.2.0 && < 0.7, unordered-containers >= 0.2.1.0 && < 0.3, - clash-lib == 1.6.3,- clash-prelude == 1.6.3,+ clash-lib == 1.6.4,+ clash-prelude == 1.6.4, concurrent-supply >= 0.1.7 && < 0.2, ghc-typelits-extra >= 0.3.2 && < 0.5, ghc-typelits-knownnat >= 0.6 && < 0.8,
src-ghc/Clash/GHC/Evaluator.hs view
@@ -1,6 +1,6 @@ {-| Copyright : (C) 2017-2022, Google Inc.,- 2021 , QBayLogic B.V.+ 2021-2022, QBayLogic B.V. License : BSD2 (see the file LICENSE) Maintainer : QBayLogic B.V. <devops@qbaylogic.com> @@ -339,11 +339,31 @@ subst = extendTvSubst subst0 x ty subst0 = mkSubst iss0 iss0 = mkInScopeSet (freeVarsOf e `unionUniqSet` freeVarsOf ty)-instantiate tcm pVal@(PrimVal (PrimInfo{primType}) tys []) ty m+-- The evaluator is setup in such a way that under normal conditions anything+-- of type 'forall a . ty' must be a ty-lambda.+--+-- However, sometimes we evaluate to an error /value/. When this happens,+-- instead of doing a regural type substitition we:+--+-- 1. Calculate the 'forall a . ty' type of the error value+-- 2. Substitute the 'a' by the applied type.+-- 3. Create a new error value of the shape: 'undefined @substituted_type'+-- Where this particular 'undefined' has type 'forall a . a'. We destinquish+-- between error values throwing X exceptions and other error values, and+-- create appropriate error values that we return. We make this distinctions+-- in onder to enable conversion of X-exception throwing code to undefined+-- bitvectors.+instantiate tcm pVal@(PrimVal (PrimInfo{primType}) tys es) ty m | isUndefinedXPrimVal pVal- = setTerm (TyApp (Prim NP.undefinedX) (piResultTys tcm primType (tys ++ [ty]))) m+ = setTerm (TyApp (Prim NP.undefinedX) primType1) m | isUndefinedPrimVal pVal- = setTerm (TyApp (Prim NP.undefined) (piResultTys tcm primType (tys ++ [ty]))) m+ = setTerm (TyApp (Prim NP.undefined) primType1) m+ where+ esTys = map (inferCoreTypeOf tcm) es+ -- Calculate the type of: prim @ty0 .. @tyN e0 .. eN @ty+ --+ -- This combines the above-mentioned step 1 and 2+ primType1 = piResultTys tcm primType (tys ++ esTys ++ [ty]) instantiate _ p _ _ = error $ "Evaluator.instantiate: Not a tylambda: " ++ show p