clash-lib 0.5 → 0.5.1
raw patch · 16 files changed
+126/−262 lines, 16 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- CLaSH.Core.DataCon: MkData :: DcName -> ConTag -> Type -> [TyName] -> [TyName] -> [Type] -> DataCon
- CLaSH.Core.DataCon: dcArgTys :: DataCon -> [Type]
- CLaSH.Core.DataCon: dcExtTyVars :: DataCon -> [TyName]
- CLaSH.Core.DataCon: dcName :: DataCon -> DcName
- CLaSH.Core.DataCon: dcTag :: DataCon -> ConTag
- CLaSH.Core.DataCon: dcType :: DataCon -> Type
- CLaSH.Core.DataCon: dcUnivTyVars :: DataCon -> [TyName]
- CLaSH.Core.DataCon: instance NFData (Name DataCon)
- CLaSH.Core.DataCon: instance Subst Term DataCon
- CLaSH.Core.DataCon: instance Subst Type DataCon
- CLaSH.Core.DataCon: instance Typeable DataCon
- CLaSH.Core.Literal: IntegerLiteral :: Integer -> Literal
- CLaSH.Core.Literal: RationalLiteral :: Rational -> Literal
- CLaSH.Core.Literal: StringLiteral :: String -> Literal
- CLaSH.Core.Literal: instance Subst Term Literal
- CLaSH.Core.Literal: instance Subst Type Literal
- CLaSH.Core.Literal: instance Subst b Rational
- CLaSH.Core.Term: App :: Term -> Term -> Term
- CLaSH.Core.Term: Case :: Term -> Type -> [Bind Pat Term] -> Term
- CLaSH.Core.Term: Data :: DataCon -> Term
- CLaSH.Core.Term: DataPat :: (Embed DataCon) -> (Rebind [TyVar] [Id]) -> Pat
- CLaSH.Core.Term: DefaultPat :: Pat
- CLaSH.Core.Term: Lam :: (Bind Id Term) -> Term
- CLaSH.Core.Term: Letrec :: (Bind (Rec [LetBinding]) Term) -> Term
- CLaSH.Core.Term: LitPat :: (Embed Literal) -> Pat
- CLaSH.Core.Term: Literal :: Literal -> Term
- CLaSH.Core.Term: Prim :: Text -> Type -> Term
- CLaSH.Core.Term: TyApp :: Term -> Type -> Term
- CLaSH.Core.Term: TyLam :: (Bind TyVar Term) -> Term
- CLaSH.Core.Term: Var :: Type -> TmName -> Term
- CLaSH.Core.Term: instance Alpha Text
- CLaSH.Core.Term: instance NFData (Name Term)
- CLaSH.Core.Term: instance Subst Term Text
- CLaSH.Core.Term: instance Subst Type Text
- CLaSH.Core.Term: instance Typeable Pat
- CLaSH.Core.Term: instance Typeable Term
- CLaSH.Core.TyCon: AlgTyCon :: TyConName -> Kind -> Int -> AlgTyConRhs -> TyCon
- CLaSH.Core.TyCon: DataTyCon :: [DataCon] -> AlgTyConRhs
- CLaSH.Core.TyCon: FunTyCon :: TyConName -> Kind -> Int -> [([Type], Type)] -> TyCon
- CLaSH.Core.TyCon: NewTyCon :: DataCon -> ([TyName], Type) -> AlgTyConRhs
- CLaSH.Core.TyCon: PrimTyCon :: TyConName -> Kind -> Int -> TyCon
- CLaSH.Core.TyCon: SuperKindTyCon :: TyConName -> TyCon
- CLaSH.Core.TyCon: algTcRhs :: TyCon -> AlgTyConRhs
- CLaSH.Core.TyCon: dataCon :: AlgTyConRhs -> DataCon
- CLaSH.Core.TyCon: dataCons :: AlgTyConRhs -> [DataCon]
- CLaSH.Core.TyCon: instance NFData (Name TyCon)
- CLaSH.Core.TyCon: instance Subst Term AlgTyConRhs
- CLaSH.Core.TyCon: instance Subst Term TyCon
- CLaSH.Core.TyCon: instance Subst Type AlgTyConRhs
- CLaSH.Core.TyCon: instance Subst Type TyCon
- CLaSH.Core.TyCon: instance Typeable TyCon
- CLaSH.Core.TyCon: ntEtadRhs :: AlgTyConRhs -> ([TyName], Type)
- CLaSH.Core.TyCon: tyConArity :: TyCon -> Int
- CLaSH.Core.TyCon: tyConKind :: TyCon -> Kind
- CLaSH.Core.TyCon: tyConName :: TyCon -> TyConName
- CLaSH.Core.TyCon: tyConSubst :: TyCon -> [([Type], Type)]
- CLaSH.Core.Type: AppTy :: Type -> Type -> Type
- CLaSH.Core.Type: Arrow :: ConstTy
- CLaSH.Core.Type: ConstTy :: ConstTy -> Type
- CLaSH.Core.Type: ForAllTy :: (Bind TyVar Type) -> Type
- CLaSH.Core.Type: FunTy :: Type -> Type -> TypeView
- CLaSH.Core.Type: LitTy :: LitTy -> Type
- CLaSH.Core.Type: NumTy :: Int -> LitTy
- CLaSH.Core.Type: OtherType :: Type -> TypeView
- CLaSH.Core.Type: SymTy :: String -> LitTy
- CLaSH.Core.Type: TyCon :: TyConName -> ConstTy
- CLaSH.Core.Type: TyConApp :: TyConName -> [Type] -> TypeView
- CLaSH.Core.Type: VarTy :: Kind -> TyName -> Type
- CLaSH.Core.Type: instance NFData (Name Type)
- CLaSH.Core.Type: instance Subst Term ConstTy
- CLaSH.Core.Type: instance Subst Term LitTy
- CLaSH.Core.Type: instance Subst Type ConstTy
- CLaSH.Core.Type: instance Subst Type LitTy
- CLaSH.Core.Type: instance Typeable ConstTy
- CLaSH.Core.Type: instance Typeable LitTy
- CLaSH.Core.Type: instance Typeable Type
- CLaSH.Core.Var: Id :: Name a -> Embed Type -> Var a
- CLaSH.Core.Var: TyVar :: Name a -> Embed Kind -> Var a
- CLaSH.Core.Var: instance NFData (Name a) => NFData (Var a)
- CLaSH.Core.Var: instance Subst Term Id
- CLaSH.Core.Var: instance Subst Term TyVar
- CLaSH.Core.Var: instance Subst Type Id
- CLaSH.Core.Var: instance Subst Type TyVar
- CLaSH.Core.Var: instance Typeable Var
- CLaSH.Core.Var: varKind :: Var a -> Embed Kind
- CLaSH.Core.Var: varName :: Var a -> Name a
- CLaSH.Core.Var: varType :: Var a -> Embed Type
- CLaSH.Netlist.BlackBox.Types: C :: Text -> Element
- CLaSH.Netlist.BlackBox.Types: Clk :: (Maybe Int) -> Element
- CLaSH.Netlist.BlackBox.Types: D :: Decl -> Element
- CLaSH.Netlist.BlackBox.Types: Decl :: Int -> [(BlackBoxTemplate, BlackBoxTemplate)] -> Decl
- CLaSH.Netlist.BlackBox.Types: Err :: (Maybe Int) -> Element
- CLaSH.Netlist.BlackBox.Types: I :: Int -> Element
- CLaSH.Netlist.BlackBox.Types: L :: Int -> Element
- CLaSH.Netlist.BlackBox.Types: O :: Element
- CLaSH.Netlist.BlackBox.Types: Rst :: (Maybe Int) -> Element
- CLaSH.Netlist.BlackBox.Types: SigD :: Element -> (Maybe Int) -> Element
- CLaSH.Netlist.BlackBox.Types: Sym :: Int -> Element
- CLaSH.Netlist.BlackBox.Types: Typ :: (Maybe Int) -> Element
- CLaSH.Netlist.BlackBox.Types: TypElem :: Element -> Element
- CLaSH.Netlist.BlackBox.Types: TypM :: (Maybe Int) -> Element
- CLaSH.Netlist.Types: Assignment :: Identifier -> Expr -> Declaration
- CLaSH.Netlist.Types: BitLit :: Bit -> Literal
- CLaSH.Netlist.Types: BitVector :: Size -> HWType
- CLaSH.Netlist.Types: BlackBoxD :: Text -> BlackBoxTemplate -> BlackBoxContext -> Declaration
- CLaSH.Netlist.Types: BlackBoxE :: Text -> BlackBoxTemplate -> BlackBoxContext -> Bool -> Expr
- CLaSH.Netlist.Types: Bool :: HWType
- CLaSH.Netlist.Types: BoolLit :: Bool -> Literal
- CLaSH.Netlist.Types: Clock :: Int -> HWType
- CLaSH.Netlist.Types: Component :: Identifier -> [(Identifier, HWType)] -> [(Identifier, HWType)] -> (Identifier, HWType) -> [Declaration] -> Component
- CLaSH.Netlist.Types: CondAssignment :: Identifier -> Expr -> [(Maybe Expr, Expr)] -> Declaration
- CLaSH.Netlist.Types: Context :: (SyncExpr, HWType) -> [(SyncExpr, HWType, Bool)] -> IntMap (Either BlackBoxTemplate Declaration, BlackBoxContext) -> BlackBoxContext
- CLaSH.Netlist.Types: DC :: (HWType, Int) -> Modifier
- CLaSH.Netlist.Types: DataCon :: HWType -> Modifier -> [Expr] -> Expr
- CLaSH.Netlist.Types: DataTag :: HWType -> (Either Identifier Identifier) -> Expr
- CLaSH.Netlist.Types: H :: Bit
- CLaSH.Netlist.Types: Identifier :: Identifier -> (Maybe Modifier) -> Expr
- CLaSH.Netlist.Types: Index :: Size -> HWType
- CLaSH.Netlist.Types: Indexed :: (HWType, Int, Int) -> Modifier
- CLaSH.Netlist.Types: InstDecl :: Identifier -> Identifier -> [(Identifier, Expr)] -> Declaration
- CLaSH.Netlist.Types: Integer :: HWType
- CLaSH.Netlist.Types: L :: Bit
- CLaSH.Netlist.Types: Literal :: (Maybe (HWType, Size)) -> Literal -> Expr
- CLaSH.Netlist.Types: NetDecl :: Identifier -> HWType -> Declaration
- CLaSH.Netlist.Types: NetlistMonad :: WriterT [(Identifier, HWType)] (StateT NetlistState (FreshMT IO)) a -> NetlistMonad a
- CLaSH.Netlist.Types: NetlistState :: HashMap TmName (Type, Term) -> Gamma -> Int -> Int -> HashMap TmName Component -> PrimMap -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> NetlistState
- CLaSH.Netlist.Types: NumLit :: Integer -> Literal
- CLaSH.Netlist.Types: Product :: Identifier -> [HWType] -> HWType
- CLaSH.Netlist.Types: Reset :: Int -> HWType
- CLaSH.Netlist.Types: SP :: Identifier -> [(Identifier, [HWType])] -> HWType
- CLaSH.Netlist.Types: Signed :: Size -> HWType
- CLaSH.Netlist.Types: Sum :: Identifier -> [Identifier] -> HWType
- CLaSH.Netlist.Types: U :: Bit
- CLaSH.Netlist.Types: Unsigned :: Size -> HWType
- CLaSH.Netlist.Types: VecAppend :: Modifier
- CLaSH.Netlist.Types: VecLit :: [Literal] -> Literal
- CLaSH.Netlist.Types: Vector :: Size -> HWType -> HWType
- CLaSH.Netlist.Types: Void :: HWType
- CLaSH.Netlist.Types: Z :: Bit
- CLaSH.Netlist.Types: _bindings :: NetlistState -> HashMap TmName (Type, Term)
- CLaSH.Netlist.Types: _cmpCount :: NetlistState -> Int
- CLaSH.Netlist.Types: _components :: NetlistState -> HashMap TmName Component
- CLaSH.Netlist.Types: _primitives :: NetlistState -> PrimMap
- CLaSH.Netlist.Types: _tcCache :: NetlistState -> HashMap TyConName TyCon
- CLaSH.Netlist.Types: _typeTranslator :: NetlistState -> HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)
- CLaSH.Netlist.Types: _varCount :: NetlistState -> Int
- CLaSH.Netlist.Types: _varEnv :: NetlistState -> Gamma
- CLaSH.Netlist.Types: bbFunctions :: BlackBoxContext -> IntMap (Either BlackBoxTemplate Declaration, BlackBoxContext)
- CLaSH.Netlist.Types: bbInputs :: BlackBoxContext -> [(SyncExpr, HWType, Bool)]
- CLaSH.Netlist.Types: bbResult :: BlackBoxContext -> (SyncExpr, HWType)
- CLaSH.Netlist.Types: componentName :: Component -> Identifier
- CLaSH.Netlist.Types: declarations :: Component -> [Declaration]
- CLaSH.Netlist.Types: hiddenPorts :: Component -> [(Identifier, HWType)]
- CLaSH.Netlist.Types: inputs :: Component -> [(Identifier, HWType)]
- CLaSH.Netlist.Types: output :: Component -> (Identifier, HWType)
- CLaSH.Netlist.Types: runNetlist :: NetlistMonad a -> WriterT [(Identifier, HWType)] (StateT NetlistState (FreshMT IO)) a
- CLaSH.Normalize: CBranch :: (TmName, (Type, Term)) -> [CallTree] -> CallTree
- CLaSH.Normalize: CLeaf :: (TmName, (Type, Term)) -> CallTree
- CLaSH.Normalize.Types: NormalizeState :: HashMap TmName (Type, Term) -> Map (TmName, Int, Either Term Type) (TmName, Type) -> HashMap TmName Int -> Int -> HashMap TmName (HashMap TmName Int) -> Int -> TmName -> NormalizeState
- CLaSH.Normalize.Types: _curFun :: NormalizeState -> TmName
- CLaSH.Normalize.Types: _inlineHistory :: NormalizeState -> HashMap TmName (HashMap TmName Int)
- CLaSH.Normalize.Types: _inlineLimit :: NormalizeState -> Int
- CLaSH.Normalize.Types: _normalized :: NormalizeState -> HashMap TmName (Type, Term)
- CLaSH.Normalize.Types: _specialisationCache :: NormalizeState -> Map (TmName, Int, Either Term Type) (TmName, Type)
- CLaSH.Normalize.Types: _specialisationHistory :: NormalizeState -> HashMap TmName Int
- CLaSH.Normalize.Types: _specialisationLimit :: NormalizeState -> Int
- CLaSH.Primitives.Types: BlackBox :: Text -> Either Text Text -> Primitive
- CLaSH.Primitives.Types: Primitive :: Text -> Text -> Primitive
- CLaSH.Primitives.Types: name :: Primitive -> Text
- CLaSH.Primitives.Types: primType :: Primitive -> Text
- CLaSH.Primitives.Types: template :: Primitive -> Either Text Text
- CLaSH.Rewrite.Types: AppArg :: CoreContext
- CLaSH.Rewrite.Types: AppFun :: CoreContext
- CLaSH.Rewrite.Types: CaseAlt :: [Id] -> CoreContext
- CLaSH.Rewrite.Types: CaseScrut :: CoreContext
- CLaSH.Rewrite.Types: DebugAll :: DebugLevel
- CLaSH.Rewrite.Types: DebugApplied :: DebugLevel
- CLaSH.Rewrite.Types: DebugFinal :: DebugLevel
- CLaSH.Rewrite.Types: DebugName :: DebugLevel
- CLaSH.Rewrite.Types: DebugNone :: DebugLevel
- CLaSH.Rewrite.Types: LamBody :: Id -> CoreContext
- CLaSH.Rewrite.Types: LetBinding :: [Id] -> CoreContext
- CLaSH.Rewrite.Types: LetBody :: [Id] -> CoreContext
- CLaSH.Rewrite.Types: R :: RewriteMonad m a -> R m a
- CLaSH.Rewrite.Types: RE :: DebugLevel -> RewriteEnv
- CLaSH.Rewrite.Types: RewriteState :: Int -> HashMap TmName (Type, Term) -> Supply -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> (HashMap TyConName TyCon -> Term -> Term) -> RewriteState
- CLaSH.Rewrite.Types: TyAppC :: CoreContext
- CLaSH.Rewrite.Types: TyLamBody :: TyVar -> CoreContext
- CLaSH.Rewrite.Types: _bindings :: RewriteState -> HashMap TmName (Type, Term)
- CLaSH.Rewrite.Types: _dbgLevel :: RewriteEnv -> DebugLevel
- CLaSH.Rewrite.Types: _evaluator :: RewriteState -> HashMap TyConName TyCon -> Term -> Term
- CLaSH.Rewrite.Types: _tcCache :: RewriteState -> HashMap TyConName TyCon
- CLaSH.Rewrite.Types: _transformCounter :: RewriteState -> Int
- CLaSH.Rewrite.Types: _typeTranslator :: RewriteState -> HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)
- CLaSH.Rewrite.Types: _uniqSupply :: RewriteState -> Supply
- CLaSH.Rewrite.Types: instance (Monad m, Functor m) => Applicative (R m)
- CLaSH.Rewrite.Types: runR :: R m a -> RewriteMonad m a
- CLaSH.Util: instance Hashable (Name a)
- CLaSH.Util: instance Ord a => Ord (Embed a)
+ CLaSH.Core.DataCon: [MkData] :: DcName -> ConTag -> Type -> [TyName] -> [TyName] -> [Type] -> DataCon
+ CLaSH.Core.DataCon: [dcArgTys] :: DataCon -> [Type]
+ CLaSH.Core.DataCon: [dcExtTyVars] :: DataCon -> [TyName]
+ CLaSH.Core.DataCon: [dcName] :: DataCon -> DcName
+ CLaSH.Core.DataCon: [dcTag] :: DataCon -> ConTag
+ CLaSH.Core.DataCon: [dcType] :: DataCon -> Type
+ CLaSH.Core.DataCon: [dcUnivTyVars] :: DataCon -> [TyName]
+ CLaSH.Core.DataCon: instance Subst a DataCon
+ CLaSH.Core.Literal: [IntegerLiteral] :: Integer -> Literal
+ CLaSH.Core.Literal: [RationalLiteral] :: Rational -> Literal
+ CLaSH.Core.Literal: [StringLiteral] :: String -> Literal
+ CLaSH.Core.Literal: instance Subst a Literal
+ CLaSH.Core.Term: [App] :: Term -> Term -> Term
+ CLaSH.Core.Term: [Case] :: Term -> Type -> [Bind Pat Term] -> Term
+ CLaSH.Core.Term: [DataPat] :: (Embed DataCon) -> (Rebind [TyVar] [Id]) -> Pat
+ CLaSH.Core.Term: [Data] :: DataCon -> Term
+ CLaSH.Core.Term: [DefaultPat] :: Pat
+ CLaSH.Core.Term: [Lam] :: (Bind Id Term) -> Term
+ CLaSH.Core.Term: [Letrec] :: (Bind (Rec [LetBinding]) Term) -> Term
+ CLaSH.Core.Term: [LitPat] :: (Embed Literal) -> Pat
+ CLaSH.Core.Term: [Literal] :: Literal -> Term
+ CLaSH.Core.Term: [Prim] :: Text -> Type -> Term
+ CLaSH.Core.Term: [TyApp] :: Term -> Type -> Term
+ CLaSH.Core.Term: [TyLam] :: (Bind TyVar Term) -> Term
+ CLaSH.Core.Term: [Var] :: Type -> TmName -> Term
+ CLaSH.Core.TyCon: [AlgTyCon] :: TyConName -> Kind -> Int -> AlgTyConRhs -> TyCon
+ CLaSH.Core.TyCon: [DataTyCon] :: [DataCon] -> AlgTyConRhs
+ CLaSH.Core.TyCon: [FunTyCon] :: TyConName -> Kind -> Int -> [([Type], Type)] -> TyCon
+ CLaSH.Core.TyCon: [NewTyCon] :: DataCon -> ([TyName], Type) -> AlgTyConRhs
+ CLaSH.Core.TyCon: [PrimTyCon] :: TyConName -> Kind -> Int -> TyCon
+ CLaSH.Core.TyCon: [SuperKindTyCon] :: TyConName -> TyCon
+ CLaSH.Core.TyCon: [algTcRhs] :: TyCon -> AlgTyConRhs
+ CLaSH.Core.TyCon: [dataCon] :: AlgTyConRhs -> DataCon
+ CLaSH.Core.TyCon: [dataCons] :: AlgTyConRhs -> [DataCon]
+ CLaSH.Core.TyCon: [ntEtadRhs] :: AlgTyConRhs -> ([TyName], Type)
+ CLaSH.Core.TyCon: [tyConArity] :: TyCon -> Int
+ CLaSH.Core.TyCon: [tyConKind] :: TyCon -> Kind
+ CLaSH.Core.TyCon: [tyConName] :: TyCon -> TyConName
+ CLaSH.Core.TyCon: [tyConSubst] :: TyCon -> [([Type], Type)]
+ CLaSH.Core.Type: [AppTy] :: Type -> Type -> Type
+ CLaSH.Core.Type: [Arrow] :: ConstTy
+ CLaSH.Core.Type: [ConstTy] :: ConstTy -> Type
+ CLaSH.Core.Type: [ForAllTy] :: (Bind TyVar Type) -> Type
+ CLaSH.Core.Type: [FunTy] :: Type -> Type -> TypeView
+ CLaSH.Core.Type: [LitTy] :: LitTy -> Type
+ CLaSH.Core.Type: [NumTy] :: Int -> LitTy
+ CLaSH.Core.Type: [OtherType] :: Type -> TypeView
+ CLaSH.Core.Type: [SymTy] :: String -> LitTy
+ CLaSH.Core.Type: [TyConApp] :: TyConName -> [Type] -> TypeView
+ CLaSH.Core.Type: [TyCon] :: TyConName -> ConstTy
+ CLaSH.Core.Type: [VarTy] :: Kind -> TyName -> Type
+ CLaSH.Core.Type: instance Subst a ConstTy
+ CLaSH.Core.Type: instance Subst a LitTy
+ CLaSH.Core.Var: [Id] :: Name a -> Embed Type -> Var a
+ CLaSH.Core.Var: [TyVar] :: Name a -> Embed Kind -> Var a
+ CLaSH.Core.Var: [varKind] :: Var a -> Embed Kind
+ CLaSH.Core.Var: [varName] :: Var a -> Name a
+ CLaSH.Core.Var: [varType] :: Var a -> Embed Type
+ CLaSH.Core.Var: instance Generic b => Subst Term (Var b)
+ CLaSH.Core.Var: instance Generic b => Subst Type (Var b)
+ CLaSH.Core.Var: instance NFData (Var a)
+ CLaSH.Netlist.BlackBox.Types: [C] :: Text -> Element
+ CLaSH.Netlist.BlackBox.Types: [Clk] :: (Maybe Int) -> Element
+ CLaSH.Netlist.BlackBox.Types: [D] :: Decl -> Element
+ CLaSH.Netlist.BlackBox.Types: [Decl] :: Int -> [(BlackBoxTemplate, BlackBoxTemplate)] -> Decl
+ CLaSH.Netlist.BlackBox.Types: [Err] :: (Maybe Int) -> Element
+ CLaSH.Netlist.BlackBox.Types: [I] :: Int -> Element
+ CLaSH.Netlist.BlackBox.Types: [L] :: Int -> Element
+ CLaSH.Netlist.BlackBox.Types: [O] :: Element
+ CLaSH.Netlist.BlackBox.Types: [Rst] :: (Maybe Int) -> Element
+ CLaSH.Netlist.BlackBox.Types: [SigD] :: Element -> (Maybe Int) -> Element
+ CLaSH.Netlist.BlackBox.Types: [Sym] :: Int -> Element
+ CLaSH.Netlist.BlackBox.Types: [TypElem] :: Element -> Element
+ CLaSH.Netlist.BlackBox.Types: [TypM] :: (Maybe Int) -> Element
+ CLaSH.Netlist.BlackBox.Types: [Typ] :: (Maybe Int) -> Element
+ CLaSH.Netlist.Types: [Assignment] :: Identifier -> Expr -> Declaration
+ CLaSH.Netlist.Types: [BitLit] :: Bit -> Literal
+ CLaSH.Netlist.Types: [BitVector] :: Size -> HWType
+ CLaSH.Netlist.Types: [BlackBoxD] :: Text -> BlackBoxTemplate -> BlackBoxContext -> Declaration
+ CLaSH.Netlist.Types: [BlackBoxE] :: Text -> BlackBoxTemplate -> BlackBoxContext -> Bool -> Expr
+ CLaSH.Netlist.Types: [BoolLit] :: Bool -> Literal
+ CLaSH.Netlist.Types: [Bool] :: HWType
+ CLaSH.Netlist.Types: [Clock] :: Int -> HWType
+ CLaSH.Netlist.Types: [Component] :: Identifier -> [(Identifier, HWType)] -> [(Identifier, HWType)] -> (Identifier, HWType) -> [Declaration] -> Component
+ CLaSH.Netlist.Types: [CondAssignment] :: Identifier -> Expr -> [(Maybe Expr, Expr)] -> Declaration
+ CLaSH.Netlist.Types: [Context] :: (SyncExpr, HWType) -> [(SyncExpr, HWType, Bool)] -> IntMap (Either BlackBoxTemplate Declaration, BlackBoxContext) -> BlackBoxContext
+ CLaSH.Netlist.Types: [DC] :: (HWType, Int) -> Modifier
+ CLaSH.Netlist.Types: [DataCon] :: HWType -> Modifier -> [Expr] -> Expr
+ CLaSH.Netlist.Types: [DataTag] :: HWType -> (Either Identifier Identifier) -> Expr
+ CLaSH.Netlist.Types: [H] :: Bit
+ CLaSH.Netlist.Types: [Identifier] :: Identifier -> (Maybe Modifier) -> Expr
+ CLaSH.Netlist.Types: [Index] :: Size -> HWType
+ CLaSH.Netlist.Types: [Indexed] :: (HWType, Int, Int) -> Modifier
+ CLaSH.Netlist.Types: [InstDecl] :: Identifier -> Identifier -> [(Identifier, Expr)] -> Declaration
+ CLaSH.Netlist.Types: [Integer] :: HWType
+ CLaSH.Netlist.Types: [L] :: Bit
+ CLaSH.Netlist.Types: [Literal] :: (Maybe (HWType, Size)) -> Literal -> Expr
+ CLaSH.Netlist.Types: [NetDecl] :: Identifier -> HWType -> Declaration
+ CLaSH.Netlist.Types: [NetlistMonad] :: WriterT [(Identifier, HWType)] (StateT NetlistState (FreshMT IO)) a -> NetlistMonad a
+ CLaSH.Netlist.Types: [NetlistState] :: HashMap TmName (Type, Term) -> Gamma -> Int -> Int -> HashMap TmName Component -> PrimMap -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> NetlistState
+ CLaSH.Netlist.Types: [NumLit] :: Integer -> Literal
+ CLaSH.Netlist.Types: [Product] :: Identifier -> [HWType] -> HWType
+ CLaSH.Netlist.Types: [Reset] :: Int -> HWType
+ CLaSH.Netlist.Types: [SP] :: Identifier -> [(Identifier, [HWType])] -> HWType
+ CLaSH.Netlist.Types: [Signed] :: Size -> HWType
+ CLaSH.Netlist.Types: [Sum] :: Identifier -> [Identifier] -> HWType
+ CLaSH.Netlist.Types: [U] :: Bit
+ CLaSH.Netlist.Types: [Unsigned] :: Size -> HWType
+ CLaSH.Netlist.Types: [VecAppend] :: Modifier
+ CLaSH.Netlist.Types: [VecLit] :: [Literal] -> Literal
+ CLaSH.Netlist.Types: [Vector] :: Size -> HWType -> HWType
+ CLaSH.Netlist.Types: [Void] :: HWType
+ CLaSH.Netlist.Types: [Z] :: Bit
+ CLaSH.Netlist.Types: [_bindings] :: NetlistState -> HashMap TmName (Type, Term)
+ CLaSH.Netlist.Types: [_cmpCount] :: NetlistState -> Int
+ CLaSH.Netlist.Types: [_components] :: NetlistState -> HashMap TmName Component
+ CLaSH.Netlist.Types: [_primitives] :: NetlistState -> PrimMap
+ CLaSH.Netlist.Types: [_tcCache] :: NetlistState -> HashMap TyConName TyCon
+ CLaSH.Netlist.Types: [_typeTranslator] :: NetlistState -> HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)
+ CLaSH.Netlist.Types: [_varCount] :: NetlistState -> Int
+ CLaSH.Netlist.Types: [_varEnv] :: NetlistState -> Gamma
+ CLaSH.Netlist.Types: [bbFunctions] :: BlackBoxContext -> IntMap (Either BlackBoxTemplate Declaration, BlackBoxContext)
+ CLaSH.Netlist.Types: [bbInputs] :: BlackBoxContext -> [(SyncExpr, HWType, Bool)]
+ CLaSH.Netlist.Types: [bbResult] :: BlackBoxContext -> (SyncExpr, HWType)
+ CLaSH.Netlist.Types: [componentName] :: Component -> Identifier
+ CLaSH.Netlist.Types: [declarations] :: Component -> [Declaration]
+ CLaSH.Netlist.Types: [hiddenPorts] :: Component -> [(Identifier, HWType)]
+ CLaSH.Netlist.Types: [inputs] :: Component -> [(Identifier, HWType)]
+ CLaSH.Netlist.Types: [output] :: Component -> (Identifier, HWType)
+ CLaSH.Netlist.Types: [runNetlist] :: NetlistMonad a -> WriterT [(Identifier, HWType)] (StateT NetlistState (FreshMT IO)) a
+ CLaSH.Normalize: [CBranch] :: (TmName, (Type, Term)) -> [CallTree] -> CallTree
+ CLaSH.Normalize: [CLeaf] :: (TmName, (Type, Term)) -> CallTree
+ CLaSH.Normalize.Types: [NormalizeState] :: HashMap TmName (Type, Term) -> Map (TmName, Int, Either Term Type) (TmName, Type) -> HashMap TmName Int -> Int -> HashMap TmName (HashMap TmName Int) -> Int -> TmName -> NormalizeState
+ CLaSH.Normalize.Types: [_curFun] :: NormalizeState -> TmName
+ CLaSH.Normalize.Types: [_inlineHistory] :: NormalizeState -> HashMap TmName (HashMap TmName Int)
+ CLaSH.Normalize.Types: [_inlineLimit] :: NormalizeState -> Int
+ CLaSH.Normalize.Types: [_normalized] :: NormalizeState -> HashMap TmName (Type, Term)
+ CLaSH.Normalize.Types: [_specialisationCache] :: NormalizeState -> Map (TmName, Int, Either Term Type) (TmName, Type)
+ CLaSH.Normalize.Types: [_specialisationHistory] :: NormalizeState -> HashMap TmName Int
+ CLaSH.Normalize.Types: [_specialisationLimit] :: NormalizeState -> Int
+ CLaSH.Primitives.Types: [BlackBox] :: Text -> Either Text Text -> Primitive
+ CLaSH.Primitives.Types: [Primitive] :: Text -> Text -> Primitive
+ CLaSH.Primitives.Types: [name] :: Primitive -> Text
+ CLaSH.Primitives.Types: [primType] :: Primitive -> Text
+ CLaSH.Primitives.Types: [template] :: Primitive -> Either Text Text
+ CLaSH.Rewrite.Types: [AppArg] :: CoreContext
+ CLaSH.Rewrite.Types: [AppFun] :: CoreContext
+ CLaSH.Rewrite.Types: [CaseAlt] :: [Id] -> CoreContext
+ CLaSH.Rewrite.Types: [CaseScrut] :: CoreContext
+ CLaSH.Rewrite.Types: [DebugAll] :: DebugLevel
+ CLaSH.Rewrite.Types: [DebugApplied] :: DebugLevel
+ CLaSH.Rewrite.Types: [DebugFinal] :: DebugLevel
+ CLaSH.Rewrite.Types: [DebugName] :: DebugLevel
+ CLaSH.Rewrite.Types: [DebugNone] :: DebugLevel
+ CLaSH.Rewrite.Types: [LamBody] :: Id -> CoreContext
+ CLaSH.Rewrite.Types: [LetBinding] :: [Id] -> CoreContext
+ CLaSH.Rewrite.Types: [LetBody] :: [Id] -> CoreContext
+ CLaSH.Rewrite.Types: [RE] :: DebugLevel -> RewriteEnv
+ CLaSH.Rewrite.Types: [R] :: RewriteMonad m a -> R m a
+ CLaSH.Rewrite.Types: [RewriteState] :: Int -> HashMap TmName (Type, Term) -> Supply -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> (HashMap TyConName TyCon -> Term -> Term) -> RewriteState
+ CLaSH.Rewrite.Types: [TyAppC] :: CoreContext
+ CLaSH.Rewrite.Types: [TyLamBody] :: TyVar -> CoreContext
+ CLaSH.Rewrite.Types: [_bindings] :: RewriteState -> HashMap TmName (Type, Term)
+ CLaSH.Rewrite.Types: [_dbgLevel] :: RewriteEnv -> DebugLevel
+ CLaSH.Rewrite.Types: [_evaluator] :: RewriteState -> HashMap TyConName TyCon -> Term -> Term
+ CLaSH.Rewrite.Types: [_tcCache] :: RewriteState -> HashMap TyConName TyCon
+ CLaSH.Rewrite.Types: [_transformCounter] :: RewriteState -> Int
+ CLaSH.Rewrite.Types: [_typeTranslator] :: RewriteState -> HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)
+ CLaSH.Rewrite.Types: [_uniqSupply] :: RewriteState -> Supply
+ CLaSH.Rewrite.Types: [runR] :: R m a -> RewriteMonad m a
+ CLaSH.Rewrite.Types: instance Monad m => Applicative (R m)
- CLaSH.Primitives.Util: decodeAndReport :: FromJSON a => ByteString -> Maybe a
+ CLaSH.Primitives.Util: decodeAndReport :: (FromJSON a) => ByteString -> Maybe a
- CLaSH.Rewrite.Combinators: (>->) :: Monad m => Transform m -> Transform m -> Transform m
+ CLaSH.Rewrite.Combinators: (>->) :: (Monad m) => Transform m -> Transform m -> Transform m
- CLaSH.Util: combineM :: Applicative f => (a -> f b) -> (c -> f d) -> (a, c) -> f (b, d)
+ CLaSH.Util: combineM :: (Applicative f) => (a -> f b) -> (c -> f d) -> (a, c) -> f (b, d)
- CLaSH.Util: liftState :: MonadState s m => Lens' s s' -> State s' a -> m a
+ CLaSH.Util: liftState :: (MonadState s m) => Lens' s s' -> State s' a -> m a
- CLaSH.Util: mapAccumLM :: Monad m => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])
+ CLaSH.Util: mapAccumLM :: (Monad m) => (acc -> x -> m (acc, y)) -> acc -> [x] -> m (acc, [y])
Files
- CHANGELOG.md +3/−0
- clash-lib.cabal +4/−3
- src/CLaSH/Core/DataCon.hs +10/−22
- src/CLaSH/Core/DataCon.hs-boot +0/−23
- src/CLaSH/Core/Literal.hs +11/−22
- src/CLaSH/Core/Pretty.hs +0/−1
- src/CLaSH/Core/Term.hs +8/−74
- src/CLaSH/Core/Term.hs-boot +1/−7
- src/CLaSH/Core/TyCon.hs +8/−36
- src/CLaSH/Core/Type.hs +15/−37
- src/CLaSH/Core/Type.hs-boot +3/−6
- src/CLaSH/Core/Var.hs +6/−18
- src/CLaSH/Netlist/BlackBox.hs +1/−2
- src/CLaSH/Primitives/Types.hs +1/−1
- src/CLaSH/Util.hs +1/−10
- src/Unbound/Generics/LocallyNameless/Extra.hs +54/−0
CHANGELOG.md view
@@ -1,5 +1,8 @@ # Changelog for the [`clash-lib`](http://hackage.haskell.org/package/clash-lib) package +## 0.5.1 *April 20th 2015*+* GHC 7.10 support+ ## 0.5 *March 11th 2015* * New features: * Simplify BlackBox handling, and improve VHDL generation. [#47](https://github.com/clash-lang/clash-compiler/issues/47)
clash-lib.cabal view
@@ -1,5 +1,5 @@ Name: clash-lib-Version: 0.5+Version: 0.5.1 Synopsis: CAES Language for Synchronous Hardware - As a Library Description: CλaSH (pronounced ‘clash’) is a functional hardware description language that@@ -50,12 +50,12 @@ HS-Source-Dirs: src default-language: Haskell2010- ghc-options: -Wall -fwarn-tabs+ ghc-options: -Wall CPP-Options: -DCABAL Build-depends: aeson >= 0.6.2.0, attoparsec >= 0.10.4.0,- base >= 4.6.0.1 && < 5,+ base >= 4.8 && < 5, bytestring >= 0.10.0.2, concurrent-supply >= 0.1.7, containers >= 0.5.0.0,@@ -121,3 +121,4 @@ CLaSH.Util Other-Modules: Paths_clash_lib+ Unbound.Generics.LocallyNameless.Extra
src/CLaSH/Core/DataCon.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -13,15 +13,12 @@ ) where -import Data.Monoid (mempty)-import Data.Typeable (Typeable)-import Control.DeepSeq (NFData(..))-import GHC.Generics (Generic)-import Unbound.Generics.LocallyNameless (Alpha(..),Subst,substs)-import Unbound.Generics.LocallyNameless.Name (Name(..))+import Control.DeepSeq (NFData(..))+import GHC.Generics (Generic)+import Unbound.Generics.LocallyNameless (Alpha(..),Name,Subst(..))+import Unbound.Generics.LocallyNameless.Extra () -import {-# SOURCE #-} CLaSH.Core.Term (Term)-import {-# SOURCE #-} CLaSH.Core.Type (TyName, Type)+import {-# SOURCE #-} CLaSH.Core.Type (TyName, Type) import CLaSH.Util -- | Data Constructor@@ -37,7 +34,7 @@ -- these type variables are not part of the result -- of the DataCon, but only of the arguments. , dcArgTys :: [Type] -- ^ Argument types- } deriving (Generic,Typeable)+ } deriving (Generic,NFData) instance Show DataCon where show = show . dcName@@ -73,18 +70,9 @@ acompare' c dc1 dc2 = acompare' c (dcName dc1) (dcName dc2) -instance Subst Type DataCon-instance Subst Term DataCon--instance NFData DataCon where- rnf dc = case dc of- MkData nm tag ty uv ev args -> rnf nm `seq` rnf tag `seq` rnf ty `seq`- rnf uv `seq` rnf ev `seq` rnf args--instance NFData (Name DataCon) where- rnf nm = case nm of- (Fn s i) -> rnf s `seq` rnf i- (Bn l r) -> rnf l `seq` rnf r+instance Subst a DataCon where+ subst _ _ dc = dc+ substs _ dc = dc -- | Given a DataCon and a list of types, the type variables of the DataCon -- type are substituted for the list of types. The argument types are returned.
− src/CLaSH/Core/DataCon.hs-boot
@@ -1,23 +0,0 @@-{-# LANGUAGE MultiParamTypeClasses #-}--{-# OPTIONS_GHC -fno-warn-missing-methods #-}--module CLaSH.Core.DataCon where--import Control.DeepSeq (NFData)-import GHC.Generics (Generic)-import Unbound.Generics.LocallyNameless (Alpha,Subst)--import {-# SOURCE #-} CLaSH.Core.Term (Term)-import {-# SOURCE #-} CLaSH.Core.Type (Type)--data DataCon--instance Eq DataCon-instance Ord DataCon-instance Generic DataCon-instance Show DataCon-instance Alpha DataCon-instance Subst Type DataCon-instance Subst Term DataCon-instance NFData DataCon
src/CLaSH/Core/Literal.hs view
@@ -1,9 +1,8 @@+{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} -{-# OPTIONS_GHC -fno-warn-orphans #-}- -- | Term Literal module CLaSH.Core.Literal ( Literal (..)@@ -11,37 +10,27 @@ ) where -import Control.DeepSeq (NFData (..))-import GHC.Generics (Generic)-import Unbound.Generics.LocallyNameless (Alpha (..), Subst (..))+import Control.DeepSeq (NFData (..))+import GHC.Generics (Generic)+import Unbound.Generics.LocallyNameless.Extra ()+import Unbound.Generics.LocallyNameless (Alpha (..), Subst (..)) -import {-# SOURCE #-} CLaSH.Core.Term (Term)-import {-# SOURCE #-} CLaSH.Core.Type (Type)-import CLaSH.Core.TysPrim (intPrimTy, voidPrimTy)-import CLaSH.Util+import {-# SOURCE #-} CLaSH.Core.Type (Type)+import CLaSH.Core.TysPrim (intPrimTy, voidPrimTy) -- | Term Literal data Literal = IntegerLiteral Integer | StringLiteral String | RationalLiteral Rational- deriving (Eq,Ord,Show,Generic)--instance Subst b Rational where- subst _ _ = id- substs _ = id+ deriving (Eq,Ord,Show,Generic,NFData) instance Alpha Literal where fvAny' _ _ l = pure l -instance Subst Type Literal-instance Subst Term Literal--instance NFData Literal where- rnf l = case l of- IntegerLiteral i -> rnf i- StringLiteral s -> rnf s- RationalLiteral r -> rnf r+instance Subst a Literal where+ subst _ _ l = l+ substs _ l = l -- | Determines the Type of a Literal literalType :: Literal
src/CLaSH/Core/Pretty.hs view
@@ -10,7 +10,6 @@ where import Data.Char (isSymbol, isUpper, ord)-import Data.Traversable (sequenceA) import Data.Text (unpack) import GHC.Show (showMultiLineString) import Text.PrettyPrint (Doc, char, comma, empty, equals, hang,
src/CLaSH/Core/Term.hs view
@@ -1,10 +1,10 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} -{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-specialise #-} -- | Term representation in the CoreHW language: System F + LetRec + Case module CLaSH.Core.Term@@ -17,20 +17,16 @@ -- External Modules import Control.DeepSeq-import Data.Monoid (mempty) import Data.Text (Text)-import Data.Typeable import GHC.Generics import Unbound.Generics.LocallyNameless-import Unbound.Generics.LocallyNameless.Name (Name(..))-import Unbound.Generics.LocallyNameless.Unsafe (unsafeUnbind)+import Unbound.Generics.LocallyNameless.Extra () -- Internal Modules import CLaSH.Core.DataCon (DataCon) import CLaSH.Core.Literal (Literal) import {-# SOURCE #-} CLaSH.Core.Type (Type) import CLaSH.Core.Var (Id, TyVar)-import CLaSH.Util -- | Term representation in the CoreHW language: System F + LetRec + Case data Term@@ -45,7 +41,7 @@ | Letrec (Bind (Rec [LetBinding]) Term) -- ^ Recursive let-binding | Case Term Type [Bind Pat Term] -- ^ Case-expression: subject, type of -- alternatives, list of alternatives- deriving (Show,Typeable,Generic)+ deriving (Show,Generic,NFData) -- | Term reference type TmName = Name Term@@ -61,21 +57,7 @@ -- ^ Literal pattern | DefaultPat -- ^ Default pattern- deriving (Show,Typeable,Generic)--instance Alpha Text where- aeq' _ctx = (==)- fvAny' _ctx _nfn i = pure i- close _ctx _b = id- open _ctx _b = id- isPat _ = mempty- isTerm _ = True- nthPatFind _ = Left- namePatFind _ _ = Left 0- swaps' _ctx _p = id- freshen' _ctx i = return (i, mempty)- lfreshen' _ctx i cont = cont i mempty- acompare' _ctx = compare+ deriving (Show,Generic,NFData,Alpha) instance Eq Term where (==) = aeq@@ -95,59 +77,11 @@ acompare' _ (Prim t1 _) (Prim t2 _) = compare t1 t2 acompare' c t1 t2 = gacompare c (from t1) (from t2) -instance Alpha Pat-+instance Subst Type Pat instance Subst Term Pat+ instance Subst Term Term where isvar (Var _ x) = Just (SubstName x) isvar _ = Nothing -instance Subst Type Pat-instance Subst Type Term where- subst tvN u x | isFreeName tvN = case x of- Lam b -> Lam (subst tvN u b )- TyLam b -> TyLam (subst tvN u b )- App fun arg -> App (subst tvN u fun) (subst tvN u arg)- TyApp e ty -> TyApp (subst tvN u e ) (subst tvN u ty )- Letrec b -> Letrec (subst tvN u b )- Case e ty alts -> Case (subst tvN u e )- (subst tvN u ty )- (subst tvN u alts )- Var ty nm -> Var (subst tvN u ty ) nm- Prim nm ty -> Prim nm (subst tvN u ty)- e -> e- subst m _ _ = error $ $(curLoc) ++ "Cannot substitute for bound variable: " ++ show m--instance Subst Term Text where- subst _ _ = id- substs _ = id-instance Subst Type Text where- subst _ _ = id- substs _ = id--instance NFData Term where- rnf tm = case tm of- Var ty nm -> rnf ty `seq` rnf nm- Data dc -> rnf dc- Literal l -> rnf l- Prim nm ty -> rnf nm `seq` rnf ty- Lam b -> case unsafeUnbind b of- (id_,tm') -> rnf id_ `seq` rnf tm'- TyLam b -> case unsafeUnbind b of- (tv,tm') -> rnf tv `seq` rnf tm'- App tmL tmR -> rnf tmL `seq` rnf tmR- TyApp tm' ty -> rnf tm' `seq` rnf ty- Letrec b -> case unsafeUnbind b of- (bs,e) -> rnf (map (second unembed) (unrec bs)) `seq` rnf e- Case sc ty alts -> rnf sc `seq` rnf ty `seq` rnf (map unsafeUnbind alts)--instance NFData Pat where- rnf p = case p of- DataPat dcE xs -> rnf (unembed dcE) `seq` rnf (unrebind xs)- LitPat lE -> rnf (unembed lE)- DefaultPat -> ()--instance NFData (Name Term) where- rnf nm = case nm of- (Fn s i) -> rnf s `seq` rnf i- (Bn l r) -> rnf l `seq` rnf r+instance Subst Type Term
src/CLaSH/Core/Term.hs-boot view
@@ -1,17 +1,11 @@-{-# LANGUAGE MultiParamTypeClasses #-}- {-# OPTIONS_GHC -fno-warn-missing-methods #-} module CLaSH.Core.Term where import GHC.Generics (Generic)-import Unbound.Generics.LocallyNameless (Alpha,Name,Subst)+import Unbound.Generics.LocallyNameless (Name) data Term- type TmName = Name Term instance Generic Term-instance Show Term-instance Alpha Term-instance Subst Term Term
src/CLaSH/Core/TyCon.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -16,16 +16,14 @@ -- External Import import Control.DeepSeq-import Data.Monoid (mempty)-import Data.Typeable hiding (TyCon,tyConName) import GHC.Generics-import Unbound.Generics.LocallyNameless (Alpha(..),Subst(..))-import Unbound.Generics.LocallyNameless.Name (Name(..),name2String)+import Unbound.Generics.LocallyNameless (Alpha(..))+import Unbound.Generics.LocallyNameless.Extra ()+import Unbound.Generics.LocallyNameless.Name (Name,name2String) -- Internal Imports-import {-# SOURCE #-} CLaSH.Core.DataCon (DataCon)-import {-# SOURCE #-} CLaSH.Core.Term (Term)-import {-# SOURCE #-} CLaSH.Core.Type (Kind, TyName, Type)+import CLaSH.Core.DataCon (DataCon)+import {-# SOURCE #-} CLaSH.Core.Type (Kind, TyName, Type) import CLaSH.Util -- | Type Constructor@@ -54,7 +52,7 @@ | SuperKindTyCon { tyConName :: TyConName -- ^ Name of the TyCon }- deriving (Generic,Typeable)+ deriving (Generic,NFData) instance Show TyCon where show (AlgTyCon {tyConName = n}) = "AlgTyCon: " ++ show n@@ -84,7 +82,7 @@ -- The TyName's are the type-variables from -- the corresponding TyCon. }- deriving (Show,Generic)+ deriving (Show,Generic,NFData,Alpha) instance Alpha TyCon where aeq' c tc1 tc2 = aeq' c (tyConName tc1) (tyConName tc2)@@ -105,32 +103,6 @@ freshen' _ tc = return (tc,mempty) acompare' c tc1 tc2 = acompare' c (tyConName tc1) (tyConName tc2)---instance Alpha AlgTyConRhs--instance Subst Type TyCon-instance Subst Type AlgTyConRhs--instance Subst Term TyCon-instance Subst Term AlgTyConRhs--instance NFData TyCon where- rnf tc = case tc of- AlgTyCon nm ki ar rhs -> rnf nm `seq` rnf ki `seq` rnf ar `seq` rnf rhs- FunTyCon nm ki ar tcSubst -> rnf nm `seq` rnf ki `seq` rnf ar `seq` rnf tcSubst- PrimTyCon nm ki ar -> rnf nm `seq` rnf ki `seq` rnf ar- SuperKindTyCon nm -> rnf nm--instance NFData (Name TyCon) where- rnf nm = case nm of- (Fn s i) -> rnf s `seq` rnf i- (Bn l r) -> rnf l `seq` rnf r--instance NFData AlgTyConRhs where- rnf rhs = case rhs of- DataTyCon dcs -> rnf dcs- NewTyCon dc eta -> rnf dc `seq` rnf eta -- | Create a Kind out of a TyConName mkKindTyCon :: TyConName
src/CLaSH/Core/Type.hs view
@@ -1,10 +1,12 @@-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE ViewPatterns #-} +{-# OPTIONS_GHC -fno-specialise #-}+ -- | Types in CoreHW module CLaSH.Core.Type ( Type (..)@@ -43,15 +45,14 @@ import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as HashMap import Data.Maybe (isJust)-import Data.Typeable hiding (TyCon,mkFunTy,- mkTyConApp) import GHC.Generics (Generic(..)) import Unbound.Generics.LocallyNameless (Alpha(..),Bind,Fresh, Subst(..),SubstName(..), acompare,aeq,bind, gacompare,gaeq,gfvAny, runFreshM,unbind)-import Unbound.Generics.LocallyNameless.Name (Name(..), name2String)+import Unbound.Generics.LocallyNameless.Name (Name,name2String)+import Unbound.Generics.LocallyNameless.Extra () import Unbound.Generics.LocallyNameless.Unsafe (unsafeUnbind) -- Local imports@@ -69,7 +70,7 @@ | ForAllTy (Bind TyVar Type) -- ^ Polymorphic Type | AppTy Type Type -- ^ Type Application | LitTy LitTy -- ^ Type literal- deriving (Show,Generic,Typeable)+ deriving (Show,Generic,NFData) -- | An easier view on types data TypeView@@ -82,13 +83,13 @@ data ConstTy = TyCon TyConName -- ^ TyCon type | Arrow -- ^ Function type- deriving (Show,Generic,Typeable)+ deriving (Show,Generic,NFData,Alpha) -- | Literal Types data LitTy = NumTy Int | SymTy String- deriving (Show,Generic,Typeable)+ deriving (Show,Generic,NFData,Alpha) -- | The level above types type Kind = Type@@ -110,13 +111,14 @@ acompare' c (VarTy _ n) (VarTy _ m) = acompare' c n m acompare' c t1 t2 = gacompare c (from t1) (from t2) -instance Alpha ConstTy-instance Alpha LitTy+instance Subst a LitTy where+ subst _ _ lt = lt+ substs _ lt = lt -instance Subst Type LitTy-instance Subst Term LitTy-instance Subst Type ConstTy-instance Subst Term ConstTy+instance Subst a ConstTy where+ subst _ _ ct = ct+ substs _ ct = ct+ instance Subst Term Type instance Subst Type Type where isvar (VarTy _ v) = Just (SubstName v)@@ -127,30 +129,6 @@ instance Ord Type where compare = acompare--instance NFData Type where- rnf ty = case ty of- VarTy ki nm -> rnf ki `seq` rnf nm- ConstTy c -> rnf c- ForAllTy b -> case unsafeUnbind b of- (tv,ty') -> rnf tv `seq` rnf ty'- AppTy tyL tyR -> rnf tyL `seq` rnf tyR- LitTy l -> rnf l--instance NFData (Name Type) where- rnf nm = case nm of- (Fn s i) -> rnf s `seq` rnf i- (Bn l r) -> rnf l `seq` rnf r--instance NFData ConstTy where- rnf cty = case cty of- TyCon nm -> rnf nm- Arrow -> ()--instance NFData LitTy where- rnf lty = case lty of- NumTy i -> rnf i- SymTy s -> rnf s -- | An easier view on types tyView :: Type -> TypeView
src/CLaSH/Core/Type.hs-boot view
@@ -5,10 +5,9 @@ module CLaSH.Core.Type where -import Control.DeepSeq-import Data.Typeable-import GHC.Generics-import Unbound.Generics.LocallyNameless+import Control.DeepSeq (NFData)+import GHC.Generics (Generic)+import Unbound.Generics.LocallyNameless (Alpha,Name,Subst) import {-# SOURCE #-} CLaSH.Core.Term import {-# SOURCE #-} CLaSH.Core.TyCon@@ -26,7 +25,5 @@ instance Subst Type Type instance Subst Term Type instance NFData Type-instance NFData (Name Type)-instance Typeable Type mkTyConTy :: TyConName -> Type
src/CLaSH/Core/Var.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE CPP #-}-{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -20,12 +20,11 @@ import Control.DeepSeq (NFData (..)) import Data.Typeable (Typeable) import GHC.Generics (Generic)-import Unbound.Generics.LocallyNameless (Alpha,Embed,Name,Subst(..),isFreeName,- unembed)+import Unbound.Generics.LocallyNameless (Alpha,Embed,Name,Subst(..))+import Unbound.Generics.LocallyNameless.Extra () import {-# SOURCE #-} CLaSH.Core.Term (Term) import {-# SOURCE #-} CLaSH.Core.Type (Kind, Type)-import CLaSH.Util -- | Variables in CoreHW data Var a@@ -39,7 +38,7 @@ { varName :: Name a , varType :: Embed Type }- deriving (Eq,Show,Generic,Typeable)+ deriving (Eq,Show,Generic,NFData) -- | Term variable type Id = Var Term@@ -47,19 +46,8 @@ type TyVar = Var Type instance (Typeable a, Alpha a) => Alpha (Var a)--instance Subst Term Id-instance Subst Term TyVar--instance Subst Type TyVar-instance Subst Type Id where- subst tvN u (Id idN ty) | isFreeName tvN = Id idN (subst tvN u ty)- subst m _ _ = error $ $(curLoc) ++ "Cannot substitute for bound variable: " ++ show m--instance NFData (Name a) => NFData (Var a) where- rnf v = case v of- TyVar nm ki -> rnf nm `seq` rnf (unembed ki)- Id nm ty -> rnf nm `seq` rnf (unembed ty)+instance Generic b => Subst Term (Var b)+instance Generic b => Subst Type (Var b) -- | Change the name of a variable modifyVarName ::
src/CLaSH/Netlist/BlackBox.hs view
@@ -11,12 +11,11 @@ import Data.Either (lefts) import qualified Data.HashMap.Lazy as HashMap import qualified Data.IntMap as IntMap-import Data.Monoid (mconcat) import Data.Text.Lazy (Text, fromStrict, pack) import qualified Data.Text.Lazy as Text import Data.Text (unpack) import qualified Data.Text as TextS-import Unbound.Generics.LocallyNameless (embed, name2String, string2Name,+import Unbound.Generics.LocallyNameless (embed, name2String, string2Name, unembed) -- import CLaSH.Backend as N
src/CLaSH/Primitives/Types.hs view
@@ -4,7 +4,7 @@ -- | Type and instance definitions for Primitive module CLaSH.Primitives.Types where -import Control.Applicative ((<$>), (<*>), (<|>))+import Control.Applicative ((<|>)) import Data.Aeson (FromJSON (..), Value (..), (.:)) import Data.HashMap.Lazy (HashMap) import qualified Data.HashMap.Strict as H
src/CLaSH/Util.hs view
@@ -21,7 +21,7 @@ import qualified Control.Monad.State as State import Control.Monad.Trans.Class (MonadTrans,lift) import Data.Function as X (on)-import Data.Hashable (Hashable(..),hash)+import Data.Hashable (Hashable) import Data.HashMap.Lazy (HashMap) import qualified Data.HashMap.Lazy as HashMapL import qualified Data.HashMap.Strict as HashMapS@@ -30,8 +30,6 @@ import Control.Lens import Debug.Trace (trace) import qualified Language.Haskell.TH as TH-import Unbound.Generics.LocallyNameless (Embed(..))-import Unbound.Generics.LocallyNameless.Name (Name(..)) #ifdef CABAL import qualified Paths_clash_lib (version)@@ -47,13 +45,6 @@ supply <- State.get State.modify (+1) return supply--instance Hashable (Name a) where- hashWithSalt salt (Fn str int) = hashWithSalt salt (hashWithSalt (hash int) str)- hashWithSalt salt (Bn i0 i1) = hashWithSalt salt (hash i0 `hashWithSalt` i1)--instance (Ord a) => Ord (Embed a) where- compare (Embed a) (Embed b) = compare a b -- | Create a TH expression that returns the a formatted string containing the -- name of the module 'curLoc' is spliced into, and the line where it was spliced.
+ src/Unbound/Generics/LocallyNameless/Extra.hs view
@@ -0,0 +1,54 @@+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}++{-# OPTIONS_GHC -fno-warn-orphans #-}++module Unbound.Generics.LocallyNameless.Extra where++import Control.DeepSeq+import Data.Hashable (Hashable(..),hash)+import Data.Text (Text)+import GHC.Real (Ratio)+import Unbound.Generics.LocallyNameless.Alpha (Alpha (..))+import Unbound.Generics.LocallyNameless.Bind (Bind (..))+import Unbound.Generics.LocallyNameless.Embed (Embed (..))+import Unbound.Generics.LocallyNameless.Name (Name (..))+import Unbound.Generics.LocallyNameless.Rebind (Rebind (..))+import Unbound.Generics.LocallyNameless.Rec (Rec,unrec)+import Unbound.Generics.LocallyNameless.Subst (Subst (..))++instance (NFData a, NFData b) => NFData (Bind a b)+instance NFData a => NFData (Embed a)+instance NFData (Name a)+instance (NFData a, NFData b) => NFData (Rebind a b)+instance (Alpha a, NFData a) => NFData (Rec a) where+ rnf r = seq (rnf (unrec r)) ()++instance Subst b (Ratio a) where+ subst _ _ = id+ substs _ = id++instance Hashable (Name a) where+ hashWithSalt salt (Fn str int) = hashWithSalt salt (hashWithSalt (hash int) str)+ hashWithSalt salt (Bn i0 i1) = hashWithSalt salt (hash i0 `hashWithSalt` i1)++instance (Ord a) => Ord (Embed a) where+ compare (Embed a) (Embed b) = compare a b++instance Alpha Text where+ aeq' _ctx = (==)+ fvAny' _ctx _nfn i = pure i+ close _ctx _b = id+ open _ctx _b = id+ isPat _ = mempty+ isTerm _ = True+ nthPatFind _ = Left+ namePatFind _ _ = Left 0+ swaps' _ctx _p = id+ freshen' _ctx i = return (i, mempty)+ lfreshen' _ctx i cont = cont i mempty+ acompare' _ctx = compare++instance Subst b Text where+ subst _ _ = id+ substs _ = id