clash-prelude 1.2.1 → 1.2.2
raw patch · 20 files changed
+195/−42 lines, 20 filesdep +interpolatedep +uniplatedep ~doctestdep ~ghc-primdep ~tastyPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: interpolate, uniplate
Dependency ranges changed: doctest, ghc-prim, tasty, template-haskell
API changes (from Hackage documentation)
- Clash.Sized.Fixed: instance (size Data.Type.Equality.~ (int GHC.TypeNats.+ frac), GHC.TypeNats.KnownNat frac, GHC.Enum.Bounded (rep size), GHC.Real.Integral (rep size)) => GHC.Read.Read (Clash.Sized.Fixed.Fixed rep int frac)
- Clash.Sized.Fixed: instance (size Data.Type.Equality.~ (int GHC.TypeNats.+ frac), GHC.TypeNats.KnownNat frac, GHC.Real.Integral (rep size)) => Clash.XException.ShowX (Clash.Sized.Fixed.Fixed rep int frac)
- Clash.Sized.Fixed: instance (size Data.Type.Equality.~ (int GHC.TypeNats.+ frac), GHC.TypeNats.KnownNat frac, GHC.Real.Integral (rep size)) => GHC.Show.Show (Clash.Sized.Fixed.Fixed rep int frac)
+ Clash.Explicit.Prelude: liftTyped :: Lift t => t -> Q (TExp t)
+ Clash.HaskellPrelude: class Monad m => MonadFail (m :: Type -> Type)
+ Clash.Prelude: liftTyped :: Lift t => t -> Q (TExp t)
+ Clash.Signal.Internal: instance Clash.XException.NFDataX a => Clash.XException.NFDataX (Clash.Signal.Internal.Signal domain a)
+ Clash.Sized.Fixed: instance (size GHC.Types.~ (int GHC.TypeNats.+ frac), GHC.TypeNats.KnownNat frac, GHC.Enum.Bounded (rep size), GHC.Real.Integral (rep size)) => GHC.Read.Read (Clash.Sized.Fixed.Fixed rep int frac)
+ Clash.Sized.Fixed: instance (size GHC.Types.~ (int GHC.TypeNats.+ frac), GHC.TypeNats.KnownNat frac, GHC.Real.Integral (rep size)) => Clash.XException.ShowX (Clash.Sized.Fixed.Fixed rep int frac)
+ Clash.Sized.Fixed: instance (size GHC.Types.~ (int GHC.TypeNats.+ frac), GHC.TypeNats.KnownNat frac, GHC.Real.Integral (rep size)) => GHC.Show.Show (Clash.Sized.Fixed.Fixed rep int frac)
- Clash.Class.HasDomain: type DomEq (n :: Domain) (m :: Domain) = IfStuck (DomEqWorker n m) ( 'NotFound) (Pure (DomEqWorker n m))
+ Clash.Class.HasDomain: type DomEq (n :: Domain) (m :: Domain) = IfStuck (DomEqWorker n m) ('NotFound) (Pure (DomEqWorker n m))
- Clash.Class.HasDomain.HasSpecificDomain: type DomEq (n :: Domain) (m :: Domain) = IfStuck (DomEqWorker n m) ( 'NotFound) (Pure (DomEqWorker n m))
+ Clash.Class.HasDomain.HasSpecificDomain: type DomEq (n :: Domain) (m :: Domain) = IfStuck (DomEqWorker n m) ('NotFound) (Pure (DomEqWorker n m))
- Clash.Class.HasDomain.HasSpecificDomain: type NotFoundError (dom :: Domain) (t :: Type) = "Could not find domain '" :<<>>: 'ShowType dom :<<>>: "' in the following type:" :$$$: "" :$$$: " " :<<>>: t :$$$: "" :$$$: "If that type contains that domain anyway, you might need to provide an" :$$$: "additional type instance of HasDomain. Example implementations:" :$$$: "" :$$$: " * type instance HasDomain dom (MyVector n a) = HasDomain dom a" :$$$: " * type instance HasDomain dom1 (MyCircuit dom2 a) = DomEq dom1 dom2" :$$$: " * type instance HasDomain dom1 (MyTuple a b) = Merge dom a b" :$$$: "" :$$$: Outro
+ Clash.Class.HasDomain.HasSpecificDomain: type NotFoundError (dom :: Domain) (t :: Type) = "Could not find domain '" :<<>>: 'ShowType dom :<<>>: "' in the following type:" :$$$: "" :$$$: " " :<<>>: t :$$$: "" :$$$: "If that type contains that domain anyway, you might need to provide an" :$$$: "additional type instance of HasDomain. Example implementations:" :$$$: "" :$$$: " * type instance HasDomain dom (MyVector n a) = HasDomain dom a" :$$$: " * type instance HasDomain dom1 (MyCircuit dom2 a) = DomEq dom1 dom2" :$$$: " * type instance HasDomain dom1 (MyTuple a b) = Merge dom a b" :$$$: "" :$$$: Outro
- Clash.Explicit.BlockRam: [ClearOnReset] :: ResetStrategy 'True
+ Clash.Explicit.BlockRam: [ClearOnReset] :: ResetStrategy 'True
- Clash.Explicit.BlockRam: [NoClearOnReset] :: ResetStrategy 'False
+ Clash.Explicit.BlockRam: [NoClearOnReset] :: ResetStrategy 'False
- Clash.Explicit.DDR: ddrIn :: (HasCallStack, NFDataX a, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> (a, a, a) -> Signal fast a -> Signal slow (a, a)
+ Clash.Explicit.DDR: ddrIn :: (HasCallStack, NFDataX a, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> (a, a, a) -> Signal fast a -> Signal slow (a, a)
- Clash.Explicit.DDR: ddrIn# :: forall a slow fast fPeriod polarity edge reset init. (HasCallStack, NFDataX a, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> a -> a -> a -> Signal fast a -> Signal slow (a, a)
+ Clash.Explicit.DDR: ddrIn# :: forall a slow fast fPeriod polarity edge reset init. (HasCallStack, NFDataX a, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> a -> a -> a -> Signal fast a -> Signal slow (a, a)
- Clash.Explicit.DDR: ddrOut :: (HasCallStack, NFDataX a, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> a -> Signal slow (a, a) -> Signal fast a
+ Clash.Explicit.DDR: ddrOut :: (HasCallStack, NFDataX a, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> a -> Signal slow (a, a) -> Signal fast a
- Clash.Explicit.DDR: ddrOut# :: (HasCallStack, NFDataX a, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> a -> Signal slow a -> Signal slow a -> Signal fast a
+ Clash.Explicit.DDR: ddrOut# :: (HasCallStack, NFDataX a, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity)) => Clock slow -> Reset slow -> Enable slow -> a -> Signal slow a -> Signal slow a -> Signal fast a
- Clash.Explicit.Prelude: [ClearOnReset] :: ResetStrategy 'True
+ Clash.Explicit.Prelude: [ClearOnReset] :: ResetStrategy 'True
- Clash.Explicit.Prelude: [NoClearOnReset] :: ResetStrategy 'False
+ Clash.Explicit.Prelude: [NoClearOnReset] :: ResetStrategy 'False
- Clash.Explicit.Prelude: class Lift t
+ Clash.Explicit.Prelude: class Lift (t :: TYPE r)
- Clash.Explicit.Prelude: outputVerifier' :: forall l a dom. (KnownNat l, KnownDomain dom, DomainResetKind dom ~ 'Asynchronous, Eq a, ShowX a) => Clock dom -> Reset dom -> Vec l a -> Signal dom a -> Signal dom Bool
+ Clash.Explicit.Prelude: outputVerifier' :: forall l a dom. (KnownNat l, KnownDomain dom, DomainResetKind dom ~ 'Asynchronous, Eq a, ShowX a) => Clock dom -> Reset dom -> Vec l a -> Signal dom a -> Signal dom Bool
- Clash.Explicit.Signal: TaggedEmptyTuple :: TaggedEmptyTuple
+ Clash.Explicit.Signal: TaggedEmptyTuple :: TaggedEmptyTuple (dom :: Domain)
- Clash.Explicit.Signal: [SActiveHigh] :: SResetPolarity 'ActiveHigh
+ Clash.Explicit.Signal: [SActiveHigh] :: SResetPolarity 'ActiveHigh
- Clash.Explicit.Signal: [SActiveLow] :: SResetPolarity 'ActiveLow
+ Clash.Explicit.Signal: [SActiveLow] :: SResetPolarity 'ActiveLow
- Clash.Explicit.Signal: [SAsynchronous] :: SResetKind 'Asynchronous
+ Clash.Explicit.Signal: [SAsynchronous] :: SResetKind 'Asynchronous
- Clash.Explicit.Signal: [SDefined] :: SInitBehavior 'Defined
+ Clash.Explicit.Signal: [SDefined] :: SInitBehavior 'Defined
- Clash.Explicit.Signal: [SDomainConfiguration] :: SSymbol dom -> SNat period -> SActiveEdge edge -> SResetKind reset -> SInitBehavior init -> SResetPolarity polarity -> SDomainConfiguration dom ( 'DomainConfiguration dom period edge reset init polarity)
+ Clash.Explicit.Signal: [SDomainConfiguration] :: SSymbol dom -> SNat period -> SActiveEdge edge -> SResetKind reset -> SInitBehavior init -> SResetPolarity polarity -> SDomainConfiguration dom ('DomainConfiguration dom period edge reset init polarity)
- Clash.Explicit.Signal: [SFalling] :: SActiveEdge 'Falling
+ Clash.Explicit.Signal: [SFalling] :: SActiveEdge 'Falling
- Clash.Explicit.Signal: [SRising] :: SActiveEdge 'Rising
+ Clash.Explicit.Signal: [SRising] :: SActiveEdge 'Rising
- Clash.Explicit.Signal: [SSynchronous] :: SResetKind 'Synchronous
+ Clash.Explicit.Signal: [SSynchronous] :: SResetKind 'Synchronous
- Clash.Explicit.Signal: [SUnknown] :: SInitBehavior 'Unknown
+ Clash.Explicit.Signal: [SUnknown] :: SInitBehavior 'Unknown
- Clash.Explicit.Testbench: biTbClockGen :: forall testDom circuitDom. (KnownDomain testDom, KnownDomain circuitDom, DomainResetKind testDom ~ 'Asynchronous) => Signal testDom Bool -> (Clock testDom, Clock circuitDom)
+ Clash.Explicit.Testbench: biTbClockGen :: forall testDom circuitDom. (KnownDomain testDom, KnownDomain circuitDom, DomainResetKind testDom ~ 'Asynchronous) => Signal testDom Bool -> (Clock testDom, Clock circuitDom)
- Clash.Explicit.Testbench: outputVerifier :: forall l a testDom circuitDom. (KnownNat l, KnownDomain testDom, KnownDomain circuitDom, DomainResetKind testDom ~ 'Asynchronous, Eq a, ShowX a) => Clock testDom -> Reset testDom -> Vec l a -> Signal circuitDom a -> Signal testDom Bool
+ Clash.Explicit.Testbench: outputVerifier :: forall l a testDom circuitDom. (KnownNat l, KnownDomain testDom, KnownDomain circuitDom, DomainResetKind testDom ~ 'Asynchronous, Eq a, ShowX a) => Clock testDom -> Reset testDom -> Vec l a -> Signal circuitDom a -> Signal testDom Bool
- Clash.Explicit.Testbench: outputVerifier' :: forall l a dom. (KnownNat l, KnownDomain dom, DomainResetKind dom ~ 'Asynchronous, Eq a, ShowX a) => Clock dom -> Reset dom -> Vec l a -> Signal dom a -> Signal dom Bool
+ Clash.Explicit.Testbench: outputVerifier' :: forall l a dom. (KnownNat l, KnownDomain dom, DomainResetKind dom ~ 'Asynchronous, Eq a, ShowX a) => Clock dom -> Reset dom -> Vec l a -> Signal dom a -> Signal dom Bool
- Clash.Explicit.Testbench: outputVerifierBitVector :: forall l n testDom circuitDom. (KnownNat l, KnownNat n, KnownDomain testDom, KnownDomain circuitDom, DomainResetKind testDom ~ 'Asynchronous) => Clock testDom -> Reset testDom -> Vec l (BitVector n) -> Signal circuitDom (BitVector n) -> Signal testDom Bool
+ Clash.Explicit.Testbench: outputVerifierBitVector :: forall l n testDom circuitDom. (KnownNat l, KnownNat n, KnownDomain testDom, KnownDomain circuitDom, DomainResetKind testDom ~ 'Asynchronous) => Clock testDom -> Reset testDom -> Vec l (BitVector n) -> Signal circuitDom (BitVector n) -> Signal testDom Bool
- Clash.Explicit.Testbench: outputVerifierBitVector' :: forall l n dom. (KnownNat l, KnownNat n, KnownDomain dom, DomainResetKind dom ~ 'Asynchronous) => Clock dom -> Reset dom -> Vec l (BitVector n) -> Signal dom (BitVector n) -> Signal dom Bool
+ Clash.Explicit.Testbench: outputVerifierBitVector' :: forall l n dom. (KnownNat l, KnownNat n, KnownDomain dom, DomainResetKind dom ~ 'Asynchronous) => Clock dom -> Reset dom -> Vec l (BitVector n) -> Signal dom (BitVector n) -> Signal dom Bool
- Clash.HaskellPrelude: ($!) :: () => (a -> b) -> a -> b
+ Clash.HaskellPrelude: ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- Clash.HaskellPrelude: ($) :: () => (a -> b) -> a -> b
+ Clash.HaskellPrelude: ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
- Clash.HaskellPrelude: (.) :: () => (b -> c) -> (a -> b) -> a -> c
+ Clash.HaskellPrelude: (.) :: (b -> c) -> (a -> b) -> a -> c
- Clash.HaskellPrelude: asTypeOf :: () => a -> a -> a
+ Clash.HaskellPrelude: asTypeOf :: a -> a -> a
- Clash.HaskellPrelude: break :: () => (a -> Bool) -> [a] -> ([a], [a])
+ Clash.HaskellPrelude: break :: (a -> Bool) -> [a] -> ([a], [a])
- Clash.HaskellPrelude: const :: () => a -> b -> a
+ Clash.HaskellPrelude: const :: a -> b -> a
- Clash.HaskellPrelude: curry :: () => ((a, b) -> c) -> a -> b -> c
+ Clash.HaskellPrelude: curry :: ((a, b) -> c) -> a -> b -> c
- Clash.HaskellPrelude: cycle :: () => [a] -> [a]
+ Clash.HaskellPrelude: cycle :: [a] -> [a]
- Clash.HaskellPrelude: dropWhile :: () => (a -> Bool) -> [a] -> [a]
+ Clash.HaskellPrelude: dropWhile :: (a -> Bool) -> [a] -> [a]
- Clash.HaskellPrelude: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
+ Clash.HaskellPrelude: either :: (a -> c) -> (b -> c) -> Either a b -> c
- Clash.HaskellPrelude: error :: HasCallStack => [Char] -> a
+ Clash.HaskellPrelude: error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
- Clash.HaskellPrelude: errorWithoutStackTrace :: () => [Char] -> a
+ Clash.HaskellPrelude: errorWithoutStackTrace :: forall (r :: RuntimeRep) (a :: TYPE r). [Char] -> a
- Clash.HaskellPrelude: fail :: Monad m => String -> m a
+ Clash.HaskellPrelude: fail :: MonadFail m => String -> m a
- Clash.HaskellPrelude: filter :: () => (a -> Bool) -> [a] -> [a]
+ Clash.HaskellPrelude: filter :: (a -> Bool) -> [a] -> [a]
- Clash.HaskellPrelude: flip :: () => (a -> b -> c) -> b -> a -> c
+ Clash.HaskellPrelude: flip :: (a -> b -> c) -> b -> a -> c
- Clash.HaskellPrelude: fst :: () => (a, b) -> a
+ Clash.HaskellPrelude: fst :: (a, b) -> a
- Clash.HaskellPrelude: id :: () => a -> a
+ Clash.HaskellPrelude: id :: a -> a
- Clash.HaskellPrelude: infixl 6 -
+ Clash.HaskellPrelude: infixl 6 +
- Clash.HaskellPrelude: ioError :: () => IOError -> IO a
+ Clash.HaskellPrelude: ioError :: IOError -> IO a
- Clash.HaskellPrelude: maybe :: () => b -> (a -> b) -> Maybe a -> b
+ Clash.HaskellPrelude: maybe :: b -> (a -> b) -> Maybe a -> b
- Clash.HaskellPrelude: readParen :: () => Bool -> ReadS a -> ReadS a
+ Clash.HaskellPrelude: readParen :: Bool -> ReadS a -> ReadS a
- Clash.HaskellPrelude: scanl1 :: () => (a -> a -> a) -> [a] -> [a]
+ Clash.HaskellPrelude: scanl1 :: (a -> a -> a) -> [a] -> [a]
- Clash.HaskellPrelude: scanr1 :: () => (a -> a -> a) -> [a] -> [a]
+ Clash.HaskellPrelude: scanr1 :: (a -> a -> a) -> [a] -> [a]
- Clash.HaskellPrelude: seq :: () => a -> b -> b
+ Clash.HaskellPrelude: seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b
- Clash.HaskellPrelude: snd :: () => (a, b) -> b
+ Clash.HaskellPrelude: snd :: (a, b) -> b
- Clash.HaskellPrelude: span :: () => (a -> Bool) -> [a] -> ([a], [a])
+ Clash.HaskellPrelude: span :: (a -> Bool) -> [a] -> ([a], [a])
- Clash.HaskellPrelude: takeWhile :: () => (a -> Bool) -> [a] -> [a]
+ Clash.HaskellPrelude: takeWhile :: (a -> Bool) -> [a] -> [a]
- Clash.HaskellPrelude: uncurry :: () => (a -> b -> c) -> (a, b) -> c
+ Clash.HaskellPrelude: uncurry :: (a -> b -> c) -> (a, b) -> c
- Clash.HaskellPrelude: until :: () => (a -> Bool) -> (a -> a) -> a -> a
+ Clash.HaskellPrelude: until :: (a -> Bool) -> (a -> a) -> a -> a
- Clash.Intel.DDR: altddioIn :: (HasCallStack, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => SSymbol deviceFamily -> Clock slow -> Reset slow -> Enable slow -> Signal fast (BitVector m) -> Signal slow (BitVector m, BitVector m)
+ Clash.Intel.DDR: altddioIn :: (HasCallStack, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => SSymbol deviceFamily -> Clock slow -> Reset slow -> Enable slow -> Signal fast (BitVector m) -> Signal slow (BitVector m, BitVector m)
- Clash.Intel.DDR: altddioOut :: (HasCallStack, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => SSymbol deviceFamily -> Clock slow -> Reset slow -> Enable slow -> Signal slow (BitVector m, BitVector m) -> Signal fast (BitVector m)
+ Clash.Intel.DDR: altddioOut :: (HasCallStack, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => SSymbol deviceFamily -> Clock slow -> Reset slow -> Enable slow -> Signal slow (BitVector m, BitVector m) -> Signal fast (BitVector m)
- Clash.Prelude: [ClearOnReset] :: ResetStrategy 'True
+ Clash.Prelude: [ClearOnReset] :: ResetStrategy 'True
- Clash.Prelude: [NoClearOnReset] :: ResetStrategy 'False
+ Clash.Prelude: [NoClearOnReset] :: ResetStrategy 'False
- Clash.Prelude: class Lift t
+ Clash.Prelude: class Lift (t :: TYPE r)
- Clash.Prelude.BlockRam: [ClearOnReset] :: ResetStrategy 'True
+ Clash.Prelude.BlockRam: [ClearOnReset] :: ResetStrategy 'True
- Clash.Prelude.BlockRam: [NoClearOnReset] :: ResetStrategy 'False
+ Clash.Prelude.BlockRam: [NoClearOnReset] :: ResetStrategy 'False
- Clash.Prelude.Testbench: outputVerifier' :: (KnownNat l, Eq a, ShowX a, DomainResetKind dom ~ 'Asynchronous, HiddenClock dom, HiddenReset dom) => Vec l a -> Signal dom a -> Signal dom Bool
+ Clash.Prelude.Testbench: outputVerifier' :: (KnownNat l, Eq a, ShowX a, DomainResetKind dom ~ 'Asynchronous, HiddenClock dom, HiddenReset dom) => Vec l a -> Signal dom a -> Signal dom Bool
- Clash.Prelude.Testbench: outputVerifierBitVector' :: (KnownNat l, KnownNat n, DomainResetKind dom ~ 'Asynchronous, HiddenClock dom, HiddenReset dom) => Vec l (BitVector n) -> Signal dom (BitVector n) -> Signal dom Bool
+ Clash.Prelude.Testbench: outputVerifierBitVector' :: (KnownNat l, KnownNat n, DomainResetKind dom ~ 'Asynchronous, HiddenClock dom, HiddenReset dom) => Vec l (BitVector n) -> Signal dom (BitVector n) -> Signal dom Bool
- Clash.Signal: TaggedEmptyTuple :: TaggedEmptyTuple
+ Clash.Signal: TaggedEmptyTuple :: TaggedEmptyTuple (dom :: Domain)
- Clash.Signal: [SActiveHigh] :: SResetPolarity 'ActiveHigh
+ Clash.Signal: [SActiveHigh] :: SResetPolarity 'ActiveHigh
- Clash.Signal: [SActiveLow] :: SResetPolarity 'ActiveLow
+ Clash.Signal: [SActiveLow] :: SResetPolarity 'ActiveLow
- Clash.Signal: [SAsynchronous] :: SResetKind 'Asynchronous
+ Clash.Signal: [SAsynchronous] :: SResetKind 'Asynchronous
- Clash.Signal: [SDefined] :: SInitBehavior 'Defined
+ Clash.Signal: [SDefined] :: SInitBehavior 'Defined
- Clash.Signal: [SDomainConfiguration] :: SSymbol dom -> SNat period -> SActiveEdge edge -> SResetKind reset -> SInitBehavior init -> SResetPolarity polarity -> SDomainConfiguration dom ( 'DomainConfiguration dom period edge reset init polarity)
+ Clash.Signal: [SDomainConfiguration] :: SSymbol dom -> SNat period -> SActiveEdge edge -> SResetKind reset -> SInitBehavior init -> SResetPolarity polarity -> SDomainConfiguration dom ('DomainConfiguration dom period edge reset init polarity)
- Clash.Signal: [SFalling] :: SActiveEdge 'Falling
+ Clash.Signal: [SFalling] :: SActiveEdge 'Falling
- Clash.Signal: [SRising] :: SActiveEdge 'Rising
+ Clash.Signal: [SRising] :: SActiveEdge 'Rising
- Clash.Signal: [SSynchronous] :: SResetKind 'Synchronous
+ Clash.Signal: [SSynchronous] :: SResetKind 'Synchronous
- Clash.Signal: [SUnknown] :: SInitBehavior 'Unknown
+ Clash.Signal: [SUnknown] :: SInitBehavior 'Unknown
- Clash.Signal.Bundle: TaggedEmptyTuple :: TaggedEmptyTuple
+ Clash.Signal.Bundle: TaggedEmptyTuple :: TaggedEmptyTuple (dom :: Domain)
- Clash.Signal.Delayed.Bundle: TaggedEmptyTuple :: TaggedEmptyTuple
+ Clash.Signal.Delayed.Bundle: TaggedEmptyTuple :: TaggedEmptyTuple (dom :: Domain) (d :: Nat)
- Clash.Signal.Delayed.Internal: DSignal :: Signal dom a -> DSignal a
+ Clash.Signal.Delayed.Internal: DSignal :: Signal dom a -> DSignal (dom :: Domain) (delay :: Nat) a
- Clash.Signal.Delayed.Internal: [toSignal] :: DSignal a -> Signal dom a
+ Clash.Signal.Delayed.Internal: [toSignal] :: DSignal (dom :: Domain) (delay :: Nat) a -> Signal dom a
- Clash.Signal.Internal: (:-) :: a -> Signal dom a -> Signal a
+ Clash.Signal.Internal: (:-) :: a -> Signal dom a -> Signal (dom :: Domain) a
- Clash.Signal.Internal: Clock :: SSymbol dom -> Clock
+ Clash.Signal.Internal: Clock :: SSymbol dom -> Clock (dom :: Domain)
- Clash.Signal.Internal: Reset :: Signal dom Bool -> Reset
+ Clash.Signal.Internal: Reset :: Signal dom Bool -> Reset (dom :: Domain)
- Clash.Signal.Internal: [SActiveHigh] :: SResetPolarity 'ActiveHigh
+ Clash.Signal.Internal: [SActiveHigh] :: SResetPolarity 'ActiveHigh
- Clash.Signal.Internal: [SActiveLow] :: SResetPolarity 'ActiveLow
+ Clash.Signal.Internal: [SActiveLow] :: SResetPolarity 'ActiveLow
- Clash.Signal.Internal: [SAsynchronous] :: SResetKind 'Asynchronous
+ Clash.Signal.Internal: [SAsynchronous] :: SResetKind 'Asynchronous
- Clash.Signal.Internal: [SDefined] :: SInitBehavior 'Defined
+ Clash.Signal.Internal: [SDefined] :: SInitBehavior 'Defined
- Clash.Signal.Internal: [SDomainConfiguration] :: SSymbol dom -> SNat period -> SActiveEdge edge -> SResetKind reset -> SInitBehavior init -> SResetPolarity polarity -> SDomainConfiguration dom ( 'DomainConfiguration dom period edge reset init polarity)
+ Clash.Signal.Internal: [SDomainConfiguration] :: SSymbol dom -> SNat period -> SActiveEdge edge -> SResetKind reset -> SInitBehavior init -> SResetPolarity polarity -> SDomainConfiguration dom ('DomainConfiguration dom period edge reset init polarity)
- Clash.Signal.Internal: [SFalling] :: SActiveEdge 'Falling
+ Clash.Signal.Internal: [SFalling] :: SActiveEdge 'Falling
- Clash.Signal.Internal: [SRising] :: SActiveEdge 'Rising
+ Clash.Signal.Internal: [SRising] :: SActiveEdge 'Rising
- Clash.Signal.Internal: [SSynchronous] :: SResetKind 'Synchronous
+ Clash.Signal.Internal: [SSynchronous] :: SResetKind 'Synchronous
- Clash.Signal.Internal: [SUnknown] :: SInitBehavior 'Unknown
+ Clash.Signal.Internal: [SUnknown] :: SInitBehavior 'Unknown
- Clash.Sized.Fixed: Fixed :: rep (int + frac) -> Fixed
+ Clash.Sized.Fixed: Fixed :: rep (int + frac) -> Fixed (rep :: Nat -> Type) (int :: Nat) (frac :: Nat)
- Clash.Sized.Fixed: [unFixed] :: Fixed -> rep (int + frac)
+ Clash.Sized.Fixed: [unFixed] :: Fixed (rep :: Nat -> Type) (int :: Nat) (frac :: Nat) -> rep (int + frac)
- Clash.Sized.Internal.BitVector: BV :: !Natural -> !Natural -> BitVector
+ Clash.Sized.Internal.BitVector: BV :: !Natural -> !Natural -> BitVector (n :: Nat)
- Clash.Sized.Internal.BitVector: [unsafeMask] :: BitVector -> !Natural
+ Clash.Sized.Internal.BitVector: [unsafeMask] :: BitVector (n :: Nat) -> !Natural
- Clash.Sized.Internal.BitVector: [unsafeToNatural] :: BitVector -> !Natural
+ Clash.Sized.Internal.BitVector: [unsafeToNatural] :: BitVector (n :: Nat) -> !Natural
- Clash.Sized.Internal.Index: I :: Integer -> Index
+ Clash.Sized.Internal.Index: I :: Integer -> Index (n :: Nat)
- Clash.Sized.Internal.Index: [unsafeToInteger] :: Index -> Integer
+ Clash.Sized.Internal.Index: [unsafeToInteger] :: Index (n :: Nat) -> Integer
- Clash.Sized.Internal.Signed: S :: Integer -> Signed
+ Clash.Sized.Internal.Signed: S :: Integer -> Signed (n :: Nat)
- Clash.Sized.Internal.Signed: [unsafeToInteger] :: Signed -> Integer
+ Clash.Sized.Internal.Signed: [unsafeToInteger] :: Signed (n :: Nat) -> Integer
- Clash.Sized.Internal.Unsigned: U :: Natural -> Unsigned
+ Clash.Sized.Internal.Unsigned: U :: Natural -> Unsigned (n :: Nat)
- Clash.Sized.Internal.Unsigned: [unsafeToNatural] :: Unsigned -> Natural
+ Clash.Sized.Internal.Unsigned: [unsafeToNatural] :: Unsigned (n :: Nat) -> Natural
- Clash.Sized.Vector: iterateI :: KnownNat n => (a -> a) -> a -> Vec n a
+ Clash.Sized.Vector: iterateI :: forall n a. KnownNat n => (a -> a) -> a -> Vec n a
- Clash.Sized.Vector: select :: CmpNat (i + s) (s * n) ~ 'GT => SNat f -> SNat s -> SNat n -> Vec (f + i) a -> Vec n a
+ Clash.Sized.Vector: select :: CmpNat (i + s) (s * n) ~ 'GT => SNat f -> SNat s -> SNat n -> Vec (f + i) a -> Vec n a
- Clash.Sized.Vector: selectI :: (CmpNat (i + s) (s * n) ~ 'GT, KnownNat n) => SNat f -> SNat s -> Vec (f + i) a -> Vec n a
+ Clash.Sized.Vector: selectI :: (CmpNat (i + s) (s * n) ~ 'GT, KnownNat n) => SNat f -> SNat s -> Vec (f + i) a -> Vec n a
- Clash.Xilinx.ClockGen: clockWizard :: forall domIn domOut periodIn periodOut edge init polarity name. (KnownConfiguration domIn ( 'DomainConfiguration domIn periodIn edge 'Asynchronous init polarity), KnownConfiguration domOut ( 'DomainConfiguration domOut periodOut edge 'Asynchronous init polarity)) => SSymbol name -> Clock domIn -> Reset domIn -> (Clock domOut, Enable domOut)
+ Clash.Xilinx.ClockGen: clockWizard :: forall domIn domOut periodIn periodOut edge init polarity name. (KnownConfiguration domIn ('DomainConfiguration domIn periodIn edge 'Asynchronous init polarity), KnownConfiguration domOut ('DomainConfiguration domOut periodOut edge 'Asynchronous init polarity)) => SSymbol name -> Clock domIn -> Reset domIn -> (Clock domOut, Enable domOut)
- Clash.Xilinx.ClockGen: clockWizardDifferential :: forall domIn domOut periodIn periodOut edge init polarity name. (KnownConfiguration domIn ( 'DomainConfiguration domIn periodIn edge 'Asynchronous init polarity), KnownConfiguration domOut ( 'DomainConfiguration domOut periodOut edge 'Asynchronous init polarity)) => SSymbol name -> Clock domIn -> Clock domIn -> Reset domIn -> (Clock domOut, Enable domOut)
+ Clash.Xilinx.ClockGen: clockWizardDifferential :: forall domIn domOut periodIn periodOut edge init polarity name. (KnownConfiguration domIn ('DomainConfiguration domIn periodIn edge 'Asynchronous init polarity), KnownConfiguration domOut ('DomainConfiguration domOut periodOut edge 'Asynchronous init polarity)) => SSymbol name -> Clock domIn -> Clock domIn -> Reset domIn -> (Clock domOut, Enable domOut)
- Clash.Xilinx.DDR: iddr :: (HasCallStack, KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => Clock slow -> Reset slow -> Enable slow -> Signal fast (BitVector m) -> Signal slow (BitVector m, BitVector m)
+ Clash.Xilinx.DDR: iddr :: (HasCallStack, KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => Clock slow -> Reset slow -> Enable slow -> Signal fast (BitVector m) -> Signal slow (BitVector m, BitVector m)
- Clash.Xilinx.DDR: oddr :: (KnownConfiguration fast ( 'DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ( 'DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => Clock slow -> Reset slow -> Enable slow -> Signal slow (BitVector m, BitVector m) -> Signal fast (BitVector m)
+ Clash.Xilinx.DDR: oddr :: (KnownConfiguration fast ('DomainConfiguration fast fPeriod edge reset init polarity), KnownConfiguration slow ('DomainConfiguration slow (2 * fPeriod) edge reset init polarity), KnownNat m) => Clock slow -> Reset slow -> Enable slow -> Signal slow (BitVector m, BitVector m) -> Signal fast (BitVector m)
Files
- CHANGELOG.md +35/−8
- clash-prelude.cabal +7/−5
- src/Clash/Annotations/TH.hs +30/−15
- src/Clash/Annotations/TopEntity.hs +8/−1
- src/Clash/Class/BitPack/Internal.hs +3/−3
- src/Clash/Clocks/Deriving.hs +2/−1
- src/Clash/Promoted/Nat.hs +6/−0
- src/Clash/Promoted/Symbol.hs +4/−0
- src/Clash/Signal/Bundle/Internal.hs +3/−2
- src/Clash/Signal/Internal.hs +13/−2
- src/Clash/Sized/Fixed.hs +7/−0
- src/Clash/Sized/Internal/BitVector.hs +9/−0
- src/Clash/Sized/Internal/Index.hs +6/−0
- src/Clash/Sized/Internal/Signed.hs +6/−0
- src/Clash/Sized/Internal/Unsigned.hs +6/−0
- src/Clash/Sized/RTree.hs +6/−0
- src/Clash/Sized/Vector.hs +15/−2
- src/Clash/XException/TH.hs +3/−2
- src/Language/Haskell/TH/Compat.hs +13/−1
- tests/Clash/Tests/TopEntityGeneration.hs +13/−0
CHANGELOG.md view
@@ -1,9 +1,36 @@ # Changelog for the Clash project +## 1.2.2 *June 12th 2020*+++* Changed:+ * The hardwired functions to unroll primitive definitions for 'zipWith', 'map', 'foldr', and 'init' have been changed to only unroll a single step, whereas they would previously unroll the whole definition in one step. This allows Clash to take advantage of the lazy nature of these functions, in turn speeding up compilation speeds significantly in some cases. Part of [PR 1354](https://github.com/clash-lang/clash-compiler/pull/1354).++* Added:+ * Support for GHC 8.10+ * Ability to load designs from precompiled modules (i.e., stored in a package database). See [#1172](https://github.com/clash-lang/clash-compiler/pull/1172)+ * Support for '-main-is' when used with `--vhdl`, `--verilog`, or `--systemverilog`+ * A partial instance for `NFDataX (Signal domain a)`++* Fixed:+ * Clash's evaluator now inlines work free definitions, preventing [situations where it would otherwise get stuck in an infinite loop](https://github.com/clash-lang/clash-compiler/pull/1354#issuecomment-635430374)+ * `caseCon` doesn't apply type-substitution correctly [#1340](https://github.com/clash-lang/clash-compiler/issues/1340)+ * Clash generates illegal SystemVerilog slice [#1313](https://github.com/clash-lang/clash-compiler/issues/1313)+ * Fix result type of head and tail Verilog blackboxes [#1351](https://github.com/clash-lang/clash-compiler/issues/1351)+ * Certain recursive let-expressions in side a alternatives of a case-expression throw the Clash compiler into an infinite loop [#1316](https://github.com/clash-lang/clash-compiler/issues/1316)+ * Fixes issue with one of Clash's transformations, `inlineCleanup`, introducing free variables [#1337](https://github.com/clash-lang/clash-compiler/issues/1337)+ * Fails to propagate type information of existential type [#1310](https://github.com/clash-lang/clash-compiler/issues/1310)+ * Certain case-expressions throw the Clash compiler into an infinite loop [#1320](https://github.com/clash-lang/clash-compiler/issues/1320)+ * Added blackbox implementation for 'Clash.Sized.Vector.iterateI', hence making it usable as a register reset value [#1240](https://github.com/clash-lang/clash-compiler/issues/1240)+ * `iterate` and `iterateI` can now be used in reset values [#1240](https://github.com/clash-lang/clash-compiler/issues/1240)+ * Prim evaluation fails on undefined arguments [#1297](https://github.com/clash-lang/clash-compiler/issues/1297)+ * Missing re-indexing in (Un)Signed fromSLV conversion [#1292](https://github.com/clash-lang/clash-compiler/issues/1292)+ * VHDL: generate a type qualification inside ~TOBV, fixes [#1360](https://github.com/clash-lang/clash-compiler/issues/1360)+ ## 1.2.1 *April 23rd 2020* * Changed:- * Treat `Signed 0`, `Unsigned 0`, `Index 1`, `BitVector 0` as unit. In effect this means that 'minBound' and 'maxBound' return 0, whereas previously they might crash [#1183](https://github.com/clash-lang/clash-compiler/issues/1183)- * Infix use of `deepseqX` is now right-associative+ * Treat `Signed 0`, `Unsigned 0`, `Index 1`, `BitVector 0` as unit. In effect this means that 'minBound' and 'maxBound' return 0, whereas previously they might crash [#1183](https://github.com/clash-lang/clash-compiler/issues/1183)+ * Infix use of `deepseqX` is now right-associative * Added: * Add 'natToInteger', 'natToNatural', and 'natToNum'. Similar to 'snatTo*', but works solely on a type argument instead of an SNat.@@ -11,12 +38,12 @@ * Added NFDataX instances for `Data.Monoid.{First,Last}` * Fixed:- * The Verilog backend can now deal with non-contiguous ranges in custom bit-representations.- * Synthesizing BitPack instances for type with phantom parameter fails [#1242](https://github.com/clash-lang/clash-compiler/issues/1242)- * Synthesis of `fromBNat (toBNat d5)` failed due to `unsafeCoerce` coercing from `Any`- * Memory leak in register primitives [#1256](https://github.com/clash-lang/clash-compiler/issues/1256)- * Illegal VHDL slice when projecting nested SOP type [#1254](https://github.com/clash-lang/clash-compiler/issues/1254)- * Vivado VHDL code path (`-fclash-hdlsyn Vivado`) generates illegal VHDL [#1264](https://github.com/clash-lang/clash-compiler/issues/1264)+ * The Verilog backend can now deal with non-contiguous ranges in custom bit-representations.+ * Synthesizing BitPack instances for type with phantom parameter fails [#1242](https://github.com/clash-lang/clash-compiler/issues/1242)+ * Synthesis of `fromBNat (toBNat d5)` failed due to `unsafeCoerce` coercing from `Any`+ * Memory leak in register primitives [#1256](https://github.com/clash-lang/clash-compiler/issues/1256)+ * Illegal VHDL slice when projecting nested SOP type [#1254](https://github.com/clash-lang/clash-compiler/issues/1254)+ * Vivado VHDL code path (`-fclash-hdlsyn Vivado`) generates illegal VHDL [#1264](https://github.com/clash-lang/clash-compiler/issues/1264) ## 1.2.0 *March 5th 2020* As promised when releasing 1.0, we've tried our best to keep the API stable. We
clash-prelude.cabal view
@@ -1,6 +1,6 @@ Cabal-version: 2.2 Name: clash-prelude-Version: 1.2.1+Version: 1.2.2 Synopsis: CAES Language for Synchronous Hardware - Prelude library Description: Clash is a functional hardware description language that borrows both its@@ -316,18 +316,19 @@ data-default-class >= 0.1.2 && < 0.2, integer-gmp >= 0.5.1.0 && < 1.1, deepseq >= 1.4.1.0 && < 1.5,- ghc-prim >= 0.5.1.0 && < 0.6,+ ghc-prim >= 0.5.1.0 && < 0.7, ghc-typelits-extra >= 0.3.3 && < 0.5, ghc-typelits-knownnat >= 0.7.2 && < 0.8, ghc-typelits-natnormalise >= 0.7.2 && < 0.8, hashable >= 1.2.1.0 && < 1.4, half >= 0.2.2.3 && < 1.0,+ interpolate >= 0.2 && < 0.3, lens >= 4.10 && < 4.20, recursion-schemes >= 5.1 && < 5.2, QuickCheck >= 2.7 && < 2.15, reflection >= 2 && < 2.2, singletons >= 1.0 && < 3.0,- template-haskell >= 2.12.0.0 && < 2.16,+ template-haskell >= 2.12.0.0 && < 2.17, th-abstraction >= 0.2.10 && < 0.4.0, th-lift >= 0.7.0 && < 0.9, th-orphans >= 0.13.1 && < 1.0,@@ -336,6 +337,7 @@ time >= 1.8 && < 1.11, transformers >= 0.5.2.0 && < 0.6, type-errors >= 0.2.0.0 && < 0.3,+ uniplate >= 1.6.12 && < 1.7, vector >= 0.11 && < 1.0 test-suite doctests@@ -352,7 +354,7 @@ else build-depends: base,- doctest >= 0.9.1 && < 0.17,+ doctest >= 0.9.1 && < 0.18, clash-prelude if impl(ghc >= 8.6) build-depends:@@ -376,7 +378,7 @@ base, hint >= 0.7 && < 0.10, quickcheck-classes-base >= 0.6 && < 1.0,- tasty >= 1.2 && < 1.3,+ tasty >= 1.2 && < 1.4, tasty-hunit, tasty-quickcheck, template-haskell
src/Clash/Annotations/TH.hs view
@@ -73,6 +73,7 @@ #if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup as Semigroup #endif+import Data.Maybe ( catMaybes ) import Language.Haskell.TH import Data.Functor.Foldable ( para )@@ -80,11 +81,13 @@ import Control.Lens ( (%~), (&), (.~) , _1, _2, _3, view )-import Control.Monad (mfilter, liftM2)+import Control.Monad (mfilter, liftM2, forM, zipWithM) import Control.Monad.Trans.Reader (ReaderT(..), asks, local) import Control.Monad.Trans.Class (lift) import Language.Haskell.TH.Instances ( ) import Language.Haskell.TH.Datatype+import Language.Haskell.TH.Syntax (qRecover)+import Data.Generics.Uniplate.Data (rewrite) import Clash.Annotations.TopEntity ( PortName(..) , TopEntity(..)@@ -241,6 +244,15 @@ xs -> BackTrack xs _ -> return names +-- This shouldn't reduce+type family PortLabel where++-- Replace (:::) annotations with a stuck type family, to inhibit unifyTypes to reduce it+guardPorts :: Type -> Type+guardPorts = rewrite $ \case+ AppT (ConT split) name@(LitT (StrTyLit _)) | split == ''(:::) -> Just $ AppT (ConT ''PortLabel) name+ _ -> Nothing+ -- | Recursively walking a 'Type' tree and building a list of 'PortName's. typeTreeToPorts :: TypeF (Type, Tracked Q (Naming [PortName]))@@ -248,7 +260,7 @@ -> Tracked Q (Naming [PortName]) typeTreeToPorts (AppTF (AppT (ConT split) (LitT (StrTyLit name)), _) (_,c)) -- Is there a '<String> ::: <something>' annotation?- | split == ''(:::)+ | split == ''PortLabel -- We found our split. If: -- - We only have no names from children: use split name as PortName -- - We have children reporting names: use split name as name to PortProduct@@ -295,18 +307,15 @@ -- 2. Match argument lengths, substitute types, and then insert the port -- tree FamilyI (ClosedTypeFamilyD (TypeFamilyHead _ bds _ _) eqs) _- | length bds == length xs ->- case filter ((==) xs . applyFamilyBindings xs info . tySynArgs) eqs of-#if MIN_VERSION_template_haskell(2,15,0)- [TySynEqn _ _ r] ->-#else- [TySynEqn _ r] ->-#endif- gatherNames (applyFamilyBindings xs info r)-- -- We didn't find a (single) matching instance so give up. Is this- -- impossible?- _ -> return $ Complete []+ | length bds == length xs -> do+ matches <- lift $ forM eqs $ \eq -> qRecover (return Nothing) . fmap Just $ do+ sub <- mconcat <$> zipWithM (\l r -> unifyTypes [l, r]) xs (tySynArgs eq)+ return $ applySubstitution sub $ tySynRHS eq+ case catMaybes matches of+ (r:_) -> gatherNames r+ -- We didn't find any matching instances (i.e. the+ -- type family application is stuck) so give up.+ [] -> return $ Complete [] -- 3. Match argument lengths then: -- - Substitute port tree for type family@@ -373,6 +382,12 @@ tySynArgs (TySynEqn args _) = args #endif +#if MIN_VERSION_template_haskell(2,15,0)+ tySynRHS (TySynEqn _ _ r) = r+#else+ tySynRHS (TySynEqn _ r) = r+#endif+ familyBindings (FamilyI (ClosedTypeFamilyD (TypeFamilyHead _ xs _ _) _) _) = Just xs familyBindings (FamilyI (OpenTypeFamilyD (TypeFamilyHead _ xs _ _)) _) = Just xs familyBindings (FamilyI (DataFamilyD _ xs _) _) = Just xs@@ -390,7 +405,7 @@ -- ^ Type to investigate -> Tracked Q (Naming [PortName]) gatherNames =- para typeTreeToPorts+ para typeTreeToPorts . guardPorts -- | Build a possible failing 'PortName' tree and unwrap the 'Naming' result. buildPorts
src/Clash/Annotations/TopEntity.hs view
@@ -197,6 +197,7 @@ -} +{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskellQuotes #-} {-# LANGUAGE Safe #-}@@ -214,7 +215,10 @@ import GHC.Generics import qualified Language.Haskell.TH as TH-import Language.Haskell.TH.Syntax (Lift(lift))+import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Data.Data -- | TopEntity annotation@@ -260,6 +264,9 @@ , lift output ] lift (TestBench _) = error "Cannot lift a TestBench"+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif -- | Give port names for arguments/results. --
src/Clash/Class/BitPack/Internal.hs view
@@ -9,7 +9,7 @@ module Clash.Class.BitPack.Internal (deriveBitPackTuples) where import Clash.CPP (maxTupleSize)-import Language.Haskell.TH.Compat (mkTySynInstD)+import Language.Haskell.TH.Compat (mkTySynInstD,mkTupE) import Control.Monad (replicateM) import Data.List (foldl') import GHC.TypeLits (KnownNat)@@ -69,7 +69,7 @@ [ Clause [ TupP $ map VarP names ] ( let (e:es) = map VarE names- in NormalB (TupE [e,TupE es])+ in NormalB (mkTupE [e,mkTupE es]) ) [] ]@@ -94,7 +94,7 @@ ( NormalB $ VarE unpackName `AppE` VarE y ) [] ]- ( TupE $ map VarE names )+ ( mkTupE $ map VarE names ) ) [] ]
src/Clash/Clocks/Deriving.hs view
@@ -13,6 +13,7 @@ import Control.Monad (foldM) import Clash.Signal.Internal+import Language.Haskell.TH.Compat import Language.Haskell.TH.Syntax import Language.Haskell.TH.Lib import Unsafe.Coerce (unsafeCoerce)@@ -40,7 +41,7 @@ -- Implementation of 'clocks' let noInline = PragmaD $ InlineP (mkName "clocks") NoInline FunLike AllPhases let clkImpls = replicate n (clkImpl clk)- let instTuple = TupE $ clkImpls ++ [AppE (VarE 'unsafeCoerce) (VarE rst)]+ let instTuple = mkTupE $ clkImpls ++ [AppE (VarE 'unsafeCoerce) (VarE rst)] let funcBody = NormalB instTuple let instFunc = FunD (mkName "clocks") [Clause [VarP clk, VarP rst] funcBody []]
src/Clash/Promoted/Nat.hs view
@@ -77,6 +77,9 @@ import GHC.Natural (naturalFromInteger) import Language.Haskell.TH (appT, conT, litT, numTyLit, sigE) import Language.Haskell.TH.Syntax (Lift (..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Numeric.Natural (Natural) import Unsafe.Coerce (unsafeCoerce) import Clash.XException (ShowX (..), showsPrecXWith)@@ -97,6 +100,9 @@ instance Lift (SNat n) where lift s = sigE [| SNat |] (appT (conT ''SNat) (litT $ numTyLit (snatToInteger s)))+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif -- | Create an @`SNat` n@ from a proxy for /n/ snatProxy :: KnownNat n => proxy n -> SNat n
src/Clash/Promoted/Symbol.hs view
@@ -4,6 +4,7 @@ Maintainer : Christiaan Baaij <christiaan.baaij@gmail.com> -} +{-# LANGUAGE CPP #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE TemplateHaskellQuotes #-} @@ -29,6 +30,9 @@ where tt = LitT (StrTyLit (ssymbolToString t)) +#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = unsafeTExpCoerce . lift+#endif instance Show (SSymbol s) where showsPrec d s@SSymbol = showParen (d > appPrec) $
src/Clash/Signal/Bundle/Internal.hs view
@@ -11,6 +11,7 @@ import Data.List (foldl') import qualified Language.Haskell.TH.Syntax as TH import Language.Haskell.TH+import Language.Haskell.TH.Compat idPrimitive :: TH.Name -> DecQ idPrimitive nm =@@ -103,7 +104,7 @@ (TupP (map VarP asNames)) (NormalB ( tNm `seqXE` (sNm `seqE` (VarE unbundlePrimName `AppE` VarE sTailNm)))) []]- (TupE+ (mkTupE (zipWith (\a as -> UInfixE (VarE a) (ConE '(:-)) (VarE as)) aNames@@ -131,7 +132,7 @@ bundleFmap = UInfixE- (LamE (map VarP aPrimeNames) (TupE (map VarE aPrimeNames)))+ (LamE (map VarP aPrimeNames) (mkTupE (map VarE aPrimeNames))) (VarE '(<$>)) (VarE (head aNames))
src/Clash/Signal/Internal.hs view
@@ -146,7 +146,7 @@ import GHC.Stack (HasCallStack) import GHC.TypeLits (KnownSymbol, Nat, Symbol, type (<=)) import Language.Haskell.TH.Syntax -- (Lift (..), Q, Dec)-import Language.Haskell.TH.Compat (mkTySynInstD)+import Language.Haskell.TH.Compat import Numeric.Natural (Natural) import Test.QuickCheck (Arbitrary (..), CoArbitrary(..), Property, property)@@ -155,7 +155,7 @@ import Clash.Promoted.Nat (SNat (..), snatToNum, snatToNatural) import Clash.Promoted.Symbol (SSymbol (..), ssymbolToString) import Clash.XException- (NFDataX, errorX, deepseqX, defaultSeqX, deepErrorX, seqX)+ (NFDataX(..), errorX, isX, deepseqX, defaultSeqX, seqX) {- $setup >>> :set -XDataKinds@@ -646,6 +646,9 @@ instance Lift a => Lift (Signal dom a) where lift ~(x :- _) = [| signal# x |]+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif instance Default a => Default (Signal dom a) where def = signal# def@@ -675,6 +678,14 @@ appSignal# (f :- fs) xs@(~(a :- as)) = f a :- (xs `seq` appSignal# fs as) -- See [NOTE: Lazy ap] {-# NOINLINE appSignal# #-} {-# ANN appSignal# hasBlackBox #-}++instance NFDataX a => NFDataX (Signal domain a) where+ deepErrorX = pure . deepErrorX+ ensureSpine s = case isX s of+ Left e -> deepErrorX e+ Right (a :- s') -> ensureSpine a :- ensureSpine s'+ hasUndefined = error "hasUndefined on (Signal domain a): No sensible implementation exists"+ rnfX = error "rnfX on (Signal domain a): No sensible implementation exists" {- NOTE: Lazy ap Signal's ap, i.e (Applicative.<*>), must be lazy in it's second argument:
src/Clash/Sized/Fixed.hs view
@@ -64,6 +64,7 @@ -} +{-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}@@ -123,6 +124,9 @@ import Language.Haskell.TH (Q, TExp, TypeQ, appT, conT, litT, mkName, numTyLit, sigE) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Test.QuickCheck (Arbitrary, CoArbitrary) import Clash.Class.BitPack (BitPack (..))@@ -538,6 +542,9 @@ (decFixed (typeRep (asRepProxy f)) (natVal (asIntProxy f)) (natVal f))+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif decFixed :: TypeRep -> Integer -> Integer -> TypeQ decFixed r i f = do
src/Clash/Sized/Internal/BitVector.hs view
@@ -148,6 +148,9 @@ import GHC.TypeLits.Extra (Max) import Language.Haskell.TH (Q, TExp, TypeQ, appT, conT, litT, numTyLit, sigE, Lit(..), litE, Pat, litP) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Test.QuickCheck.Arbitrary (Arbitrary (..), CoArbitrary (..), arbitraryBoundedIntegral, coarbitraryIntegral, shrinkIntegral)@@ -232,6 +235,9 @@ instance Lift Bit where lift (Bit m i) = [| fromInteger## $(litE (WordPrimL (toInteger m))) i |] {-# NOINLINE lift #-}+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif instance Eq Bit where (==) = eq##@@ -924,6 +930,9 @@ instance KnownNat n => Lift (BitVector n) where lift bv@(BV m i) = sigE [| fromInteger# m $(litE (IntegerL (toInteger i))) |] (decBitVector (natVal bv)) {-# NOINLINE lift #-}+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif decBitVector :: Integer -> TypeQ decBitVector n = appT (conT ''BitVector) (litT $ numTyLit n)
src/Clash/Sized/Internal/Index.hs view
@@ -75,6 +75,9 @@ import Text.Read (Read (..), ReadPrec) import Language.Haskell.TH (TypeQ, appT, conT, litT, numTyLit, sigE) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import GHC.Generics (Generic) import GHC.Natural (Natural, naturalFromInteger) #if MIN_VERSION_base(4,12,0)@@ -399,6 +402,9 @@ instance KnownNat n => Lift (Index n) where lift u@(I i) = sigE [| fromInteger# i |] (decIndex (natVal u)) {-# NOINLINE lift #-}+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif decIndex :: Integer -> TypeQ decIndex n = appT (conT ''Index) (litT $ numTyLit n)
src/Clash/Sized/Internal/Signed.hs view
@@ -99,6 +99,9 @@ import GHC.TypeLits.Extra (Max) import Language.Haskell.TH (TypeQ, appT, conT, litT, numTyLit, sigE) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Test.QuickCheck.Arbitrary (Arbitrary (..), CoArbitrary (..), arbitraryBoundedIntegral, coarbitraryIntegral, shrinkIntegral)@@ -568,6 +571,9 @@ instance KnownNat n => Lift (Signed n) where lift s@(S i) = sigE [| fromInteger# i |] (decSigned (natVal s)) {-# NOINLINE lift #-}+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif decSigned :: Integer -> TypeQ decSigned n = appT (conT ''Signed) (litT $ numTyLit n)
src/Clash/Sized/Internal/Unsigned.hs view
@@ -97,6 +97,9 @@ import GHC.Word (Word (..), Word8 (..), Word16 (..), Word32 (..)) import Language.Haskell.TH (TypeQ, appT, conT, litT, numTyLit, sigE) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Test.QuickCheck.Arbitrary (Arbitrary (..), CoArbitrary (..), arbitraryBoundedIntegral, coarbitraryIntegral)@@ -458,6 +461,9 @@ instance KnownNat n => Lift (Unsigned n) where lift u@(U i) = sigE [| fromInteger# i |] (decUnsigned (natVal u)) {-# NOINLINE lift #-}+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif decUnsigned :: Integer -> TypeQ decUnsigned n = appT (conT ''Unsigned) (litT $ numTyLit n)
src/Clash/Sized/RTree.hs view
@@ -59,6 +59,9 @@ import Data.Proxy (Proxy (..)) import GHC.TypeLits (KnownNat, Nat, type (+), type (^), type (*)) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Prelude hiding ((++), (!!)) import Test.QuickCheck (Arbitrary (..), CoArbitrary (..)) @@ -210,6 +213,9 @@ instance Lift a => Lift (RTree d a) where lift (LR_ a) = [| LR_ a |] lift (BR_ t1 t2) = [| BR_ $(lift t1) $(lift t2) |]+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif instance (KnownNat d, Arbitrary a) => Arbitrary (RTree d a) where arbitrary = sequenceA (trepeat arbitrary)
src/Clash/Sized/Vector.hs view
@@ -13,6 +13,7 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE Trustworthy #-} @@ -115,12 +116,16 @@ import GHC.Prim ((==#),(<#),(-#)) import Language.Haskell.TH (ExpQ) import Language.Haskell.TH.Syntax (Lift(..))+#if MIN_VERSION_template_haskell(2,16,0)+import Language.Haskell.TH.Compat+#endif import Prelude hiding ((++), (!!), concat, concatMap, drop, foldl, foldl1, foldr, foldr1, head, init, iterate, last, length, map, repeat, replicate, reverse, scanl, scanr, splitAt, tail, take, unzip, unzip3, zip, zip3, zipWith, zipWith3)+import qualified Data.String.Interpolate as I import qualified Prelude as P import Test.QuickCheck (Arbitrary (..), CoArbitrary (..)) import Unsafe.Coerce (unsafeCoerce)@@ -1489,12 +1494,17 @@ -- \"'iterateI' @f z@\" corresponds to the following circuit layout: -- -- <<doc/iterate.svg>>-iterateI :: KnownNat n => (a -> a) -> a -> Vec n a+iterateI :: forall n a. KnownNat n => (a -> a) -> a -> Vec n a iterateI f a = xs where xs = init (a `Cons` ws) ws = map f (lazyV xs)-{-# INLINE iterateI #-}+{-# NOINLINE iterateI #-}+{-# ANN iterateI (InlinePrimitive [VHDL,Verilog,SystemVerilog] [I.i| [{+ "BlackBoxHaskell": {+ "name": "Clash.Sized.Vector.iterateI"+ , "templateFunction": "Clash.Primitives.Sized.Vector.iterateBBF"+ }}] |]) #-} -- | \"'unfoldr @n f s@\" builds a vector of length @n@ from a seed value @s@, -- where every element @a@ is created by successive calls of @f@ on @s@. Unlike@@ -2282,6 +2292,9 @@ instance Lift a => Lift (Vec n a) where lift Nil = [| Nil |] lift (x `Cons` xs) = [| x `Cons` $(lift xs) |]+#if MIN_VERSION_template_haskell(2,16,0)+ liftTyped = liftTypedFromUntyped+#endif instance (KnownNat n, Arbitrary a) => Arbitrary (Vec n a) where arbitrary = traverse# id $ repeat arbitrary
src/Clash/XException/TH.hs view
@@ -13,6 +13,7 @@ import Data.Either (isLeft) import Data.List (intersperse)+import Language.Haskell.TH.Compat import Language.Haskell.TH.Syntax -- Spliced in in XException, so these names should be in scope:@@ -139,14 +140,14 @@ ensureSpineDecl = FunD ensureSpineName [ Clause [TildeP (TupP (map VarP names))]- (NormalB (TupE (map (AppE (VarE ensureSpineName) . VarE) names)))+ (NormalB (mkTupE (map (AppE (VarE ensureSpineName) . VarE) names))) [] ] deepErrorXDecl = FunD deepErrorXName [ Clause [VarP s]- (NormalB (TupE (replicate n (VarE deepErrorXName `AppE` VarE s))))+ (NormalB (mkTupE (replicate n (VarE deepErrorXName `AppE` VarE s)))) [] ]
src/Language/Haskell/TH/Compat.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} module Language.Haskell.TH.Compat where-import Language.Haskell.TH+import Language.Haskell.TH.Syntax -- | Compatibility helper to create TySynInstD mkTySynInstD :: Name -> [Type] -> Type -> Dec@@ -14,4 +14,16 @@ TySynInstD tyConNm (TySynEqn tyArgs rhs)+#endif++-- | Compatibility helper to create (total) tuple expressions+mkTupE :: [Exp] -> Exp+mkTupE = TupE+#if MIN_VERSION_template_haskell(2,16,0)+ . map Just+#endif++#if MIN_VERSION_template_haskell(2,16,0)+liftTypedFromUntyped :: Lift a => a -> Q (TExp a)+liftTypedFromUntyped = unsafeTExpCoerce . lift #endif
tests/Clash/Tests/TopEntityGeneration.hs view
@@ -43,6 +43,11 @@ type family CF x y z where CF Int Int Int = ("cfiii" ::: Single) CF Bool Int Int = ("cfbii" ::: Single)++type family OrderedCF b f a where+ OrderedCF 'True f a = f a+ OrderedCF b f a = ()+ type family OF x y z type instance OF Int Int Int = ("ofiii" ::: Single) type instance OF Bool Int Int = ("ofbii" ::: Single)@@ -58,6 +63,12 @@ data Passthrough a b = Passthrough a b +data HKD f = HKD+ { fd1 :: OrderedCF 'True f ("fd1" ::: Int)+ , fd2 :: OrderedCF 'True f ("fd2" ::: Bool)+ }++ topEntity1 :: "in1" ::: Signal System Int -> "in2" ::: Signal System Bool -> "out" ::: Signal System Int@@ -129,6 +140,7 @@ -> Signal System (OF Bool Int Int) -> Signal System (X Int Int Int) -> Signal System (X Bool Int Int)+ -> "hkd" ::: HKD (Signal System) -> Signal System Single topEntity4 = undefined makeTopEntity 'topEntity4@@ -144,6 +156,7 @@ , PortName "ofbii_s" , PortProduct "" [PortName "xiii", PortName "xiii2"] , PortName "xbii"+ , PortProduct "hkd" [PortName "fd1", PortName "fd2"] ] (PortName "s")