clash-lib 0.5.13 → 0.6
raw patch · 14 files changed
+604/−206 lines, 14 filesdep ~clash-preludePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: clash-prelude
API changes (from Hackage documentation)
- CLaSH.Core.DataCon: MkData :: !DcName -> !ConTag -> !Type -> [TyName] -> [TyName] -> [Type] -> DataCon
- CLaSH.Core.DataCon: instance Control.DeepSeq.NFData CLaSH.Core.DataCon.DataCon
- CLaSH.Core.DataCon: instance GHC.Classes.Eq CLaSH.Core.DataCon.DataCon
- CLaSH.Core.DataCon: instance GHC.Classes.Ord CLaSH.Core.DataCon.DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Constructor CLaSH.Core.DataCon.C1_0DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Datatype CLaSH.Core.DataCon.D1DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Generic CLaSH.Core.DataCon.DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Selector CLaSH.Core.DataCon.S1_0_0DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Selector CLaSH.Core.DataCon.S1_0_1DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Selector CLaSH.Core.DataCon.S1_0_2DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Selector CLaSH.Core.DataCon.S1_0_3DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Selector CLaSH.Core.DataCon.S1_0_4DataCon
- CLaSH.Core.DataCon: instance GHC.Generics.Selector CLaSH.Core.DataCon.S1_0_5DataCon
- CLaSH.Core.DataCon: instance GHC.Show.Show CLaSH.Core.DataCon.DataCon
- CLaSH.Core.DataCon: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.DataCon.DataCon
- CLaSH.Core.DataCon: instance Unbound.Generics.LocallyNameless.Subst.Subst a CLaSH.Core.DataCon.DataCon
- CLaSH.Core.Literal: IntegerLiteral :: !Integer -> Literal
- CLaSH.Core.Literal: RationalLiteral :: !Rational -> Literal
- CLaSH.Core.Literal: StringLiteral :: !String -> Literal
- CLaSH.Core.Literal: instance Control.DeepSeq.NFData CLaSH.Core.Literal.Literal
- CLaSH.Core.Literal: instance GHC.Classes.Eq CLaSH.Core.Literal.Literal
- CLaSH.Core.Literal: instance GHC.Classes.Ord CLaSH.Core.Literal.Literal
- CLaSH.Core.Literal: instance GHC.Generics.Constructor CLaSH.Core.Literal.C1_0Literal
- CLaSH.Core.Literal: instance GHC.Generics.Constructor CLaSH.Core.Literal.C1_1Literal
- CLaSH.Core.Literal: instance GHC.Generics.Constructor CLaSH.Core.Literal.C1_2Literal
- CLaSH.Core.Literal: instance GHC.Generics.Datatype CLaSH.Core.Literal.D1Literal
- CLaSH.Core.Literal: instance GHC.Generics.Generic CLaSH.Core.Literal.Literal
- CLaSH.Core.Literal: instance GHC.Show.Show CLaSH.Core.Literal.Literal
- CLaSH.Core.Literal: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.Literal.Literal
- CLaSH.Core.Literal: instance Unbound.Generics.LocallyNameless.Subst.Subst a CLaSH.Core.Literal.Literal
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty (CLaSH.Core.Var.Id, CLaSH.Core.Term.Term)
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty (CLaSH.Core.Var.Var CLaSH.Core.Term.Term)
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty (CLaSH.Core.Var.Var CLaSH.Core.Type.Type)
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty (Unbound.Generics.LocallyNameless.Name.Name a)
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.DataCon.DataCon
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.Literal.Literal
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.Term.Pat
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.Term.Term
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.TyCon.TyCon
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.Type.LitTy
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty CLaSH.Core.Type.Type
- CLaSH.Core.Pretty: instance CLaSH.Core.Pretty.Pretty a => CLaSH.Core.Pretty.Pretty [a]
- CLaSH.Core.Pretty: instance GHC.Classes.Eq CLaSH.Core.Pretty.TypePrec
- CLaSH.Core.Pretty: instance GHC.Classes.Ord CLaSH.Core.Pretty.TypePrec
- 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 Control.DeepSeq.NFData CLaSH.Core.Term.Pat
- CLaSH.Core.Term: instance Control.DeepSeq.NFData CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance GHC.Classes.Eq CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance GHC.Classes.Ord CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_0Pat
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_0Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_1Pat
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_1Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_2Pat
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_2Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_3Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_4Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_5Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_6Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_7Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_8Term
- CLaSH.Core.Term: instance GHC.Generics.Constructor CLaSH.Core.Term.C1_9Term
- CLaSH.Core.Term: instance GHC.Generics.Datatype CLaSH.Core.Term.D1Pat
- CLaSH.Core.Term: instance GHC.Generics.Datatype CLaSH.Core.Term.D1Term
- CLaSH.Core.Term: instance GHC.Generics.Generic CLaSH.Core.Term.Pat
- CLaSH.Core.Term: instance GHC.Generics.Generic CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance GHC.Show.Show CLaSH.Core.Term.Pat
- CLaSH.Core.Term: instance GHC.Show.Show CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.Term.Pat
- CLaSH.Core.Term: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Term.Term CLaSH.Core.Term.Pat
- CLaSH.Core.Term: instance Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Term.Term CLaSH.Core.Term.Term
- CLaSH.Core.Term: instance Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Type.Type CLaSH.Core.Term.Pat
- CLaSH.Core.Term: instance Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Type.Type CLaSH.Core.Term.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: instance Control.DeepSeq.NFData CLaSH.Core.TyCon.AlgTyConRhs
- CLaSH.Core.TyCon: instance Control.DeepSeq.NFData CLaSH.Core.TyCon.TyCon
- CLaSH.Core.TyCon: instance GHC.Classes.Eq CLaSH.Core.TyCon.TyCon
- CLaSH.Core.TyCon: instance GHC.Classes.Ord CLaSH.Core.TyCon.TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Constructor CLaSH.Core.TyCon.C1_0AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Constructor CLaSH.Core.TyCon.C1_0TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Constructor CLaSH.Core.TyCon.C1_1AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Constructor CLaSH.Core.TyCon.C1_1TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Constructor CLaSH.Core.TyCon.C1_2TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Constructor CLaSH.Core.TyCon.C1_3TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Datatype CLaSH.Core.TyCon.D1AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Datatype CLaSH.Core.TyCon.D1TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Generic CLaSH.Core.TyCon.AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Generic CLaSH.Core.TyCon.TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_0_0AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_0_0TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_0_1TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_0_2TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_0_3TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_1_0AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_1_0TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_1_1AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_1_1TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_1_2TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_1_3TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_2_0TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_2_1TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_2_2TyCon
- CLaSH.Core.TyCon: instance GHC.Generics.Selector CLaSH.Core.TyCon.S1_3_0TyCon
- CLaSH.Core.TyCon: instance GHC.Show.Show CLaSH.Core.TyCon.AlgTyConRhs
- CLaSH.Core.TyCon: instance GHC.Show.Show CLaSH.Core.TyCon.TyCon
- CLaSH.Core.TyCon: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.TyCon.AlgTyConRhs
- CLaSH.Core.TyCon: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.TyCon.TyCon
- 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 Control.DeepSeq.NFData CLaSH.Core.Type.ConstTy
- CLaSH.Core.Type: instance Control.DeepSeq.NFData CLaSH.Core.Type.LitTy
- CLaSH.Core.Type: instance Control.DeepSeq.NFData CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance GHC.Classes.Eq CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance GHC.Classes.Ord CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_0ConstTy
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_0LitTy
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_0Type
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_1ConstTy
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_1LitTy
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_1Type
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_2Type
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_3Type
- CLaSH.Core.Type: instance GHC.Generics.Constructor CLaSH.Core.Type.C1_4Type
- CLaSH.Core.Type: instance GHC.Generics.Datatype CLaSH.Core.Type.D1ConstTy
- CLaSH.Core.Type: instance GHC.Generics.Datatype CLaSH.Core.Type.D1LitTy
- CLaSH.Core.Type: instance GHC.Generics.Datatype CLaSH.Core.Type.D1Type
- CLaSH.Core.Type: instance GHC.Generics.Generic CLaSH.Core.Type.ConstTy
- CLaSH.Core.Type: instance GHC.Generics.Generic CLaSH.Core.Type.LitTy
- CLaSH.Core.Type: instance GHC.Generics.Generic CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance GHC.Show.Show CLaSH.Core.Type.ConstTy
- CLaSH.Core.Type: instance GHC.Show.Show CLaSH.Core.Type.LitTy
- CLaSH.Core.Type: instance GHC.Show.Show CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance GHC.Show.Show CLaSH.Core.Type.TypeView
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.Type.ConstTy
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.Type.LitTy
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Alpha.Alpha CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Term.Term CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Type.Type CLaSH.Core.Type.Type
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Subst.Subst a CLaSH.Core.Type.ConstTy
- CLaSH.Core.Type: instance Unbound.Generics.LocallyNameless.Subst.Subst a CLaSH.Core.Type.LitTy
- CLaSH.Core.Var: Id :: Name a -> Embed Type -> Var a
- CLaSH.Core.Var: TyVar :: Name a -> Embed Kind -> Var a
- CLaSH.Core.Var: instance (Data.Typeable.Internal.Typeable a, Unbound.Generics.LocallyNameless.Alpha.Alpha a) => Unbound.Generics.LocallyNameless.Alpha.Alpha (CLaSH.Core.Var.Var a)
- CLaSH.Core.Var: instance Control.DeepSeq.NFData (CLaSH.Core.Var.Var a)
- CLaSH.Core.Var: instance GHC.Classes.Eq (CLaSH.Core.Var.Var a)
- CLaSH.Core.Var: instance GHC.Generics.Constructor CLaSH.Core.Var.C1_0Var
- CLaSH.Core.Var: instance GHC.Generics.Constructor CLaSH.Core.Var.C1_1Var
- CLaSH.Core.Var: instance GHC.Generics.Datatype CLaSH.Core.Var.D1Var
- CLaSH.Core.Var: instance GHC.Generics.Generic (CLaSH.Core.Var.Var a)
- CLaSH.Core.Var: instance GHC.Generics.Generic b => Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Term.Term (CLaSH.Core.Var.Var b)
- CLaSH.Core.Var: instance GHC.Generics.Generic b => Unbound.Generics.LocallyNameless.Subst.Subst CLaSH.Core.Type.Type (CLaSH.Core.Var.Var b)
- CLaSH.Core.Var: instance GHC.Generics.Selector CLaSH.Core.Var.S1_0_0Var
- CLaSH.Core.Var: instance GHC.Generics.Selector CLaSH.Core.Var.S1_0_1Var
- CLaSH.Core.Var: instance GHC.Generics.Selector CLaSH.Core.Var.S1_1_0Var
- CLaSH.Core.Var: instance GHC.Generics.Selector CLaSH.Core.Var.S1_1_1Var
- CLaSH.Core.Var: instance GHC.Show.Show (CLaSH.Core.Var.Var a)
- CLaSH.Driver.Types: CLaSHOpts :: Int -> Int -> Int -> DebugLevel -> CLaSHOpts
- CLaSH.Netlist.BlackBox.Types: C :: !Text -> Element
- CLaSH.Netlist.BlackBox.Types: Clk :: !(Maybe Int) -> Element
- CLaSH.Netlist.BlackBox.Types: CompName :: 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: FilePath :: !Element -> Element
- CLaSH.Netlist.BlackBox.Types: Gen :: !Bool -> Element
- CLaSH.Netlist.BlackBox.Types: I :: !Int -> Element
- CLaSH.Netlist.BlackBox.Types: L :: !Int -> Element
- CLaSH.Netlist.BlackBox.Types: Length :: !Element -> 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: Size :: !Element -> 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.BlackBox.Types: instance GHC.Show.Show CLaSH.Netlist.BlackBox.Types.Decl
- CLaSH.Netlist.BlackBox.Types: instance GHC.Show.Show CLaSH.Netlist.BlackBox.Types.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 :: !Identifier -> !Int -> HWType
- CLaSH.Netlist.Types: Component :: !Identifier -> [(Identifier, HWType)] -> [(Identifier, HWType)] -> [(Identifier, HWType)] -> [Declaration] -> Component
- CLaSH.Netlist.Types: CondAssignment :: !Identifier -> !HWType -> !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 (Set (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 -> !String -> !Identifier -> [(String, FilePath)] -> NetlistState
- CLaSH.Netlist.Types: NumLit :: !Integer -> Literal
- CLaSH.Netlist.Types: Product :: !Identifier -> [HWType] -> HWType
- CLaSH.Netlist.Types: Reset :: !Identifier -> !Int -> HWType
- CLaSH.Netlist.Types: SP :: !Identifier -> [(Identifier, [HWType])] -> HWType
- CLaSH.Netlist.Types: Signed :: !Size -> HWType
- CLaSH.Netlist.Types: StringLit :: !String -> Literal
- 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: instance Control.DeepSeq.NFData CLaSH.Netlist.Types.Component
- CLaSH.Netlist.Types: instance Control.DeepSeq.NFData CLaSH.Netlist.Types.Declaration
- CLaSH.Netlist.Types: instance Control.DeepSeq.NFData CLaSH.Netlist.Types.HWType
- CLaSH.Netlist.Types: instance Control.Monad.IO.Class.MonadIO CLaSH.Netlist.Types.NetlistMonad
- CLaSH.Netlist.Types: instance Control.Monad.State.Class.MonadState CLaSH.Netlist.Types.NetlistState CLaSH.Netlist.Types.NetlistMonad
- CLaSH.Netlist.Types: instance Control.Monad.Writer.Class.MonadWriter (Data.Set.Base.Set (CLaSH.Netlist.Types.Identifier, CLaSH.Netlist.Types.HWType)) CLaSH.Netlist.Types.NetlistMonad
- CLaSH.Netlist.Types: instance Data.Hashable.Class.Hashable CLaSH.Netlist.Types.HWType
- CLaSH.Netlist.Types: instance GHC.Base.Applicative CLaSH.Netlist.Types.NetlistMonad
- CLaSH.Netlist.Types: instance GHC.Base.Functor CLaSH.Netlist.Types.NetlistMonad
- CLaSH.Netlist.Types: instance GHC.Base.Monad CLaSH.Netlist.Types.NetlistMonad
- CLaSH.Netlist.Types: instance GHC.Classes.Eq CLaSH.Netlist.Types.HWType
- CLaSH.Netlist.Types: instance GHC.Classes.Ord CLaSH.Netlist.Types.HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_0HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_10HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_11HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_12HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_1HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_2HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_3HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_4HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_5HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_6HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_7HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_8HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Constructor CLaSH.Netlist.Types.C1_9HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Datatype CLaSH.Netlist.Types.D1HWType
- CLaSH.Netlist.Types: instance GHC.Generics.Generic CLaSH.Netlist.Types.HWType
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.Bit
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.BlackBoxContext
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.Component
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.Declaration
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.Expr
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.HWType
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.Literal
- CLaSH.Netlist.Types: instance GHC.Show.Show CLaSH.Netlist.Types.Modifier
- CLaSH.Netlist.Types: instance Unbound.Generics.LocallyNameless.Fresh.Fresh CLaSH.Netlist.Types.NetlistMonad
- 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 -> !Int -> NormalizeState
- CLaSH.Primitives.Types: BlackBox :: !Text -> !(Either Text Text) -> Primitive
- CLaSH.Primitives.Types: Primitive :: !Text -> !Text -> Primitive
- CLaSH.Primitives.Types: instance Data.Aeson.Types.Class.FromJSON CLaSH.Primitives.Types.Primitive
- CLaSH.Primitives.Types: instance GHC.Show.Show CLaSH.Primitives.Types.Primitive
- 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 :: (RewriteEnv -> RewriteState extra -> (a, RewriteState extra, Any)) -> RewriteMonad extra a
- CLaSH.Rewrite.Types: RewriteEnv :: DebugLevel -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> (HashMap TyConName TyCon -> Bool -> Term -> Term) -> RewriteEnv
- CLaSH.Rewrite.Types: RewriteState :: {-# UNPACK #-} !Int -> !(HashMap TmName (Type, Term)) -> !Supply -> TmName -> {-# UNPACK #-} !Int -> !extra -> RewriteState extra
- CLaSH.Rewrite.Types: TyAppC :: CoreContext
- CLaSH.Rewrite.Types: TyLamBody :: TyVar -> CoreContext
- CLaSH.Rewrite.Types: instance CLaSH.Util.MonadUnique (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance Control.Monad.Reader.Class.MonadReader CLaSH.Rewrite.Types.RewriteEnv (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance Control.Monad.State.Class.MonadState (CLaSH.Rewrite.Types.RewriteState extra) (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance Control.Monad.Writer.Class.MonadWriter Data.Monoid.Any (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance GHC.Base.Applicative (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance GHC.Base.Functor (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance GHC.Base.Monad (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Rewrite.Types: instance GHC.Classes.Eq CLaSH.Rewrite.Types.CoreContext
- CLaSH.Rewrite.Types: instance GHC.Classes.Eq CLaSH.Rewrite.Types.DebugLevel
- CLaSH.Rewrite.Types: instance GHC.Classes.Ord CLaSH.Rewrite.Types.DebugLevel
- CLaSH.Rewrite.Types: instance GHC.Read.Read CLaSH.Rewrite.Types.DebugLevel
- CLaSH.Rewrite.Types: instance GHC.Show.Show CLaSH.Rewrite.Types.CoreContext
- CLaSH.Rewrite.Types: instance Unbound.Generics.LocallyNameless.Fresh.Fresh (CLaSH.Rewrite.Types.RewriteMonad extra)
- CLaSH.Util: instance GHC.Base.Monad m => CLaSH.Util.MonadUnique (Control.Monad.Trans.State.Lazy.StateT GHC.Types.Int m)
+ CLaSH.Core.DataCon: [MkData] :: !DcName -> !ConTag -> !Type -> [TyName] -> [TyName] -> [Type] -> DataCon
+ CLaSH.Core.DataCon: instance Alpha DataCon
+ CLaSH.Core.DataCon: instance Constructor C1_0DataCon
+ CLaSH.Core.DataCon: instance Datatype D1DataCon
+ CLaSH.Core.DataCon: instance Eq DataCon
+ CLaSH.Core.DataCon: instance Generic DataCon
+ CLaSH.Core.DataCon: instance NFData DataCon
+ CLaSH.Core.DataCon: instance Ord DataCon
+ CLaSH.Core.DataCon: instance Selector S1_0_0DataCon
+ CLaSH.Core.DataCon: instance Selector S1_0_1DataCon
+ CLaSH.Core.DataCon: instance Selector S1_0_2DataCon
+ CLaSH.Core.DataCon: instance Selector S1_0_3DataCon
+ CLaSH.Core.DataCon: instance Selector S1_0_4DataCon
+ CLaSH.Core.DataCon: instance Selector S1_0_5DataCon
+ CLaSH.Core.DataCon: instance Show DataCon
+ 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 Alpha Literal
+ CLaSH.Core.Literal: instance Constructor C1_0Literal
+ CLaSH.Core.Literal: instance Constructor C1_1Literal
+ CLaSH.Core.Literal: instance Constructor C1_2Literal
+ CLaSH.Core.Literal: instance Datatype D1Literal
+ CLaSH.Core.Literal: instance Eq Literal
+ CLaSH.Core.Literal: instance Generic Literal
+ CLaSH.Core.Literal: instance NFData Literal
+ CLaSH.Core.Literal: instance Ord Literal
+ CLaSH.Core.Literal: instance Show Literal
+ CLaSH.Core.Literal: instance Subst a Literal
+ CLaSH.Core.Pretty: instance Eq TypePrec
+ CLaSH.Core.Pretty: instance Ord TypePrec
+ CLaSH.Core.Pretty: instance Pretty (Id, Term)
+ CLaSH.Core.Pretty: instance Pretty (Name a)
+ CLaSH.Core.Pretty: instance Pretty (Var Term)
+ CLaSH.Core.Pretty: instance Pretty (Var Type)
+ CLaSH.Core.Pretty: instance Pretty DataCon
+ CLaSH.Core.Pretty: instance Pretty LitTy
+ CLaSH.Core.Pretty: instance Pretty Literal
+ CLaSH.Core.Pretty: instance Pretty Pat
+ CLaSH.Core.Pretty: instance Pretty Term
+ CLaSH.Core.Pretty: instance Pretty TyCon
+ CLaSH.Core.Pretty: instance Pretty Type
+ CLaSH.Core.Pretty: instance Pretty a => Pretty [a]
+ 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.Term: instance Alpha Pat
+ CLaSH.Core.Term: instance Alpha Term
+ CLaSH.Core.Term: instance Constructor C1_0Pat
+ CLaSH.Core.Term: instance Constructor C1_0Term
+ CLaSH.Core.Term: instance Constructor C1_1Pat
+ CLaSH.Core.Term: instance Constructor C1_1Term
+ CLaSH.Core.Term: instance Constructor C1_2Pat
+ CLaSH.Core.Term: instance Constructor C1_2Term
+ CLaSH.Core.Term: instance Constructor C1_3Term
+ CLaSH.Core.Term: instance Constructor C1_4Term
+ CLaSH.Core.Term: instance Constructor C1_5Term
+ CLaSH.Core.Term: instance Constructor C1_6Term
+ CLaSH.Core.Term: instance Constructor C1_7Term
+ CLaSH.Core.Term: instance Constructor C1_8Term
+ CLaSH.Core.Term: instance Constructor C1_9Term
+ CLaSH.Core.Term: instance Datatype D1Pat
+ CLaSH.Core.Term: instance Datatype D1Term
+ CLaSH.Core.Term: instance Eq Term
+ CLaSH.Core.Term: instance Generic Pat
+ CLaSH.Core.Term: instance Generic Term
+ CLaSH.Core.Term: instance NFData Pat
+ CLaSH.Core.Term: instance NFData Term
+ CLaSH.Core.Term: instance Ord Term
+ CLaSH.Core.Term: instance Show Pat
+ CLaSH.Core.Term: instance Show Term
+ CLaSH.Core.Term: instance Subst Term Pat
+ CLaSH.Core.Term: instance Subst Term Term
+ CLaSH.Core.Term: instance Subst Type Pat
+ CLaSH.Core.Term: instance Subst Type 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: instance Alpha AlgTyConRhs
+ CLaSH.Core.TyCon: instance Alpha TyCon
+ CLaSH.Core.TyCon: instance Constructor C1_0AlgTyConRhs
+ CLaSH.Core.TyCon: instance Constructor C1_0TyCon
+ CLaSH.Core.TyCon: instance Constructor C1_1AlgTyConRhs
+ CLaSH.Core.TyCon: instance Constructor C1_1TyCon
+ CLaSH.Core.TyCon: instance Constructor C1_2TyCon
+ CLaSH.Core.TyCon: instance Constructor C1_3TyCon
+ CLaSH.Core.TyCon: instance Datatype D1AlgTyConRhs
+ CLaSH.Core.TyCon: instance Datatype D1TyCon
+ CLaSH.Core.TyCon: instance Eq TyCon
+ CLaSH.Core.TyCon: instance Generic AlgTyConRhs
+ CLaSH.Core.TyCon: instance Generic TyCon
+ CLaSH.Core.TyCon: instance NFData AlgTyConRhs
+ CLaSH.Core.TyCon: instance NFData TyCon
+ CLaSH.Core.TyCon: instance Ord TyCon
+ CLaSH.Core.TyCon: instance Selector S1_0_0AlgTyConRhs
+ CLaSH.Core.TyCon: instance Selector S1_0_0TyCon
+ CLaSH.Core.TyCon: instance Selector S1_0_1TyCon
+ CLaSH.Core.TyCon: instance Selector S1_0_2TyCon
+ CLaSH.Core.TyCon: instance Selector S1_0_3TyCon
+ CLaSH.Core.TyCon: instance Selector S1_1_0AlgTyConRhs
+ CLaSH.Core.TyCon: instance Selector S1_1_0TyCon
+ CLaSH.Core.TyCon: instance Selector S1_1_1AlgTyConRhs
+ CLaSH.Core.TyCon: instance Selector S1_1_1TyCon
+ CLaSH.Core.TyCon: instance Selector S1_1_2TyCon
+ CLaSH.Core.TyCon: instance Selector S1_1_3TyCon
+ CLaSH.Core.TyCon: instance Selector S1_2_0TyCon
+ CLaSH.Core.TyCon: instance Selector S1_2_1TyCon
+ CLaSH.Core.TyCon: instance Selector S1_2_2TyCon
+ CLaSH.Core.TyCon: instance Selector S1_3_0TyCon
+ CLaSH.Core.TyCon: instance Show AlgTyConRhs
+ CLaSH.Core.TyCon: instance Show TyCon
+ 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 Alpha ConstTy
+ CLaSH.Core.Type: instance Alpha LitTy
+ CLaSH.Core.Type: instance Alpha Type
+ CLaSH.Core.Type: instance Constructor C1_0ConstTy
+ CLaSH.Core.Type: instance Constructor C1_0LitTy
+ CLaSH.Core.Type: instance Constructor C1_0Type
+ CLaSH.Core.Type: instance Constructor C1_1ConstTy
+ CLaSH.Core.Type: instance Constructor C1_1LitTy
+ CLaSH.Core.Type: instance Constructor C1_1Type
+ CLaSH.Core.Type: instance Constructor C1_2Type
+ CLaSH.Core.Type: instance Constructor C1_3Type
+ CLaSH.Core.Type: instance Constructor C1_4Type
+ CLaSH.Core.Type: instance Datatype D1ConstTy
+ CLaSH.Core.Type: instance Datatype D1LitTy
+ CLaSH.Core.Type: instance Datatype D1Type
+ CLaSH.Core.Type: instance Eq Type
+ CLaSH.Core.Type: instance Generic ConstTy
+ CLaSH.Core.Type: instance Generic LitTy
+ CLaSH.Core.Type: instance Generic Type
+ CLaSH.Core.Type: instance NFData ConstTy
+ CLaSH.Core.Type: instance NFData LitTy
+ CLaSH.Core.Type: instance NFData Type
+ CLaSH.Core.Type: instance Ord Type
+ CLaSH.Core.Type: instance Show ConstTy
+ CLaSH.Core.Type: instance Show LitTy
+ CLaSH.Core.Type: instance Show Type
+ CLaSH.Core.Type: instance Show TypeView
+ CLaSH.Core.Type: instance Subst Term Type
+ CLaSH.Core.Type: instance Subst Type Type
+ CLaSH.Core.Type: instance Subst a ConstTy
+ CLaSH.Core.Type: instance Subst a LitTy
+ CLaSH.Core.Util: appendToVec :: DataCon -> Type -> Term -> Int -> [Term] -> Term
+ CLaSH.Core.Var: [Id] :: Name a -> Embed Type -> Var a
+ CLaSH.Core.Var: [TyVar] :: Name a -> Embed Kind -> Var a
+ CLaSH.Core.Var: instance (Typeable a, Alpha a) => Alpha (Var a)
+ CLaSH.Core.Var: instance Constructor C1_0Var
+ CLaSH.Core.Var: instance Constructor C1_1Var
+ CLaSH.Core.Var: instance Datatype D1Var
+ CLaSH.Core.Var: instance Eq (Var a)
+ CLaSH.Core.Var: instance Generic (Var a)
+ 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.Core.Var: instance Selector S1_0_0Var
+ CLaSH.Core.Var: instance Selector S1_0_1Var
+ CLaSH.Core.Var: instance Selector S1_1_0Var
+ CLaSH.Core.Var: instance Selector S1_1_1Var
+ CLaSH.Core.Var: instance Show (Var a)
+ CLaSH.Driver.Types: [CLaSHOpts] :: Int -> Int -> Int -> DebugLevel -> CLaSHOpts
+ CLaSH.Netlist.BlackBox.Types: [C] :: !Text -> Element
+ CLaSH.Netlist.BlackBox.Types: [Clk] :: !(Maybe Int) -> Element
+ CLaSH.Netlist.BlackBox.Types: [CompName] :: 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: [FilePath] :: !Element -> Element
+ CLaSH.Netlist.BlackBox.Types: [Gen] :: !Bool -> Element
+ CLaSH.Netlist.BlackBox.Types: [IF] :: !Element -> [Element] -> [Element] -> Element
+ CLaSH.Netlist.BlackBox.Types: [I] :: !Int -> Element
+ CLaSH.Netlist.BlackBox.Types: [IndexType] :: !Element -> Element
+ CLaSH.Netlist.BlackBox.Types: [L] :: !Int -> Element
+ CLaSH.Netlist.BlackBox.Types: [Length] :: !Element -> 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: [Size] :: !Element -> 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.BlackBox.Types: instance Show Decl
+ CLaSH.Netlist.BlackBox.Types: instance Show 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] :: !Identifier -> !Int -> HWType
+ CLaSH.Netlist.Types: [Component] :: !Identifier -> [(Identifier, HWType)] -> [(Identifier, HWType)] -> [(Identifier, HWType)] -> [Declaration] -> Component
+ CLaSH.Netlist.Types: [CondAssignment] :: !Identifier -> !HWType -> !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 (Set (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 -> !String -> !Identifier -> [(String, FilePath)] -> NetlistState
+ CLaSH.Netlist.Types: [NumLit] :: !Integer -> Literal
+ CLaSH.Netlist.Types: [Product] :: !Identifier -> [HWType] -> HWType
+ CLaSH.Netlist.Types: [Reset] :: !Identifier -> !Int -> HWType
+ CLaSH.Netlist.Types: [SP] :: !Identifier -> [(Identifier, [HWType])] -> HWType
+ CLaSH.Netlist.Types: [Signed] :: !Size -> HWType
+ CLaSH.Netlist.Types: [StringLit] :: !String -> Literal
+ 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: instance Applicative NetlistMonad
+ CLaSH.Netlist.Types: instance Constructor C1_0HWType
+ CLaSH.Netlist.Types: instance Constructor C1_10HWType
+ CLaSH.Netlist.Types: instance Constructor C1_11HWType
+ CLaSH.Netlist.Types: instance Constructor C1_12HWType
+ CLaSH.Netlist.Types: instance Constructor C1_1HWType
+ CLaSH.Netlist.Types: instance Constructor C1_2HWType
+ CLaSH.Netlist.Types: instance Constructor C1_3HWType
+ CLaSH.Netlist.Types: instance Constructor C1_4HWType
+ CLaSH.Netlist.Types: instance Constructor C1_5HWType
+ CLaSH.Netlist.Types: instance Constructor C1_6HWType
+ CLaSH.Netlist.Types: instance Constructor C1_7HWType
+ CLaSH.Netlist.Types: instance Constructor C1_8HWType
+ CLaSH.Netlist.Types: instance Constructor C1_9HWType
+ CLaSH.Netlist.Types: instance Datatype D1HWType
+ CLaSH.Netlist.Types: instance Eq HWType
+ CLaSH.Netlist.Types: instance Fresh NetlistMonad
+ CLaSH.Netlist.Types: instance Functor NetlistMonad
+ CLaSH.Netlist.Types: instance Generic HWType
+ CLaSH.Netlist.Types: instance Hashable HWType
+ CLaSH.Netlist.Types: instance Monad NetlistMonad
+ CLaSH.Netlist.Types: instance MonadIO NetlistMonad
+ CLaSH.Netlist.Types: instance MonadState NetlistState NetlistMonad
+ CLaSH.Netlist.Types: instance MonadWriter (Set (Identifier, HWType)) NetlistMonad
+ CLaSH.Netlist.Types: instance NFData Component
+ CLaSH.Netlist.Types: instance NFData Declaration
+ CLaSH.Netlist.Types: instance NFData HWType
+ CLaSH.Netlist.Types: instance Ord HWType
+ CLaSH.Netlist.Types: instance Show Bit
+ CLaSH.Netlist.Types: instance Show BlackBoxContext
+ CLaSH.Netlist.Types: instance Show Component
+ CLaSH.Netlist.Types: instance Show Declaration
+ CLaSH.Netlist.Types: instance Show Expr
+ CLaSH.Netlist.Types: instance Show HWType
+ CLaSH.Netlist.Types: instance Show Literal
+ CLaSH.Netlist.Types: instance Show Modifier
+ CLaSH.Normalize: [CBranch] :: (TmName, (Type, Term)) -> [CallTree] -> CallTree
+ CLaSH.Normalize: [CLeaf] :: (TmName, (Type, Term)) -> CallTree
+ CLaSH.Normalize.PrimitiveReductions: mkTravVec :: TyConName -> DataCon -> DataCon -> Term -> Term -> Term -> Type -> Int -> [Term] -> Term
+ CLaSH.Normalize.PrimitiveReductions: reduceAppend :: Int -> Int -> Type -> Term -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceDFold :: Int -> Type -> Term -> Term -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceFold :: Int -> Type -> Term -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceFoldr :: Int -> Type -> Type -> Term -> Term -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceHead :: Int -> Type -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceMap :: Int -> Type -> Type -> Term -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceTail :: Int -> Type -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceTranspose :: Int -> Int -> Type -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceTraverse :: Int -> Type -> Type -> Type -> Term -> Term -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceUnconcat :: Int -> Int -> Type -> Term -> NormalizeSession Term
+ CLaSH.Normalize.PrimitiveReductions: reduceZipWith :: Int -> Type -> Type -> Type -> Term -> Term -> Term -> NormalizeSession Term
+ 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 -> !Int -> NormalizeState
+ CLaSH.Primitives.Types: [BlackBox] :: !Text -> !(Either Text Text) -> Primitive
+ CLaSH.Primitives.Types: [Primitive] :: !Text -> !Text -> Primitive
+ CLaSH.Primitives.Types: instance FromJSON Primitive
+ CLaSH.Primitives.Types: instance Show Primitive
+ 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] :: (RewriteEnv -> RewriteState extra -> (a, RewriteState extra, Any)) -> RewriteMonad extra a
+ CLaSH.Rewrite.Types: [RewriteEnv] :: DebugLevel -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> (HashMap TyConName TyCon -> Bool -> Term -> Term) -> RewriteEnv
+ CLaSH.Rewrite.Types: [RewriteState] :: {-# UNPACK #-} !Int -> !(HashMap TmName (Type, Term)) -> !Supply -> TmName -> {-# UNPACK #-} !Int -> !extra -> RewriteState extra
+ CLaSH.Rewrite.Types: [TyAppC] :: CoreContext
+ CLaSH.Rewrite.Types: [TyLamBody] :: TyVar -> CoreContext
+ CLaSH.Rewrite.Types: instance Applicative (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance Eq CoreContext
+ CLaSH.Rewrite.Types: instance Eq DebugLevel
+ CLaSH.Rewrite.Types: instance Fresh (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance Functor (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance Monad (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance MonadReader RewriteEnv (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance MonadState (RewriteState extra) (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance MonadUnique (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance MonadWriter Any (RewriteMonad extra)
+ CLaSH.Rewrite.Types: instance Ord DebugLevel
+ CLaSH.Rewrite.Types: instance Read DebugLevel
+ CLaSH.Rewrite.Types: instance Show CoreContext
+ CLaSH.Util: instance Monad m => MonadUnique (StateT Int m)
- CLaSH.Rewrite.Types: bindings :: Lens' (RewriteState extra_a3xGu) (HashMap TmName (Type, Term))
+ CLaSH.Rewrite.Types: bindings :: Lens' (RewriteState extra_a3bLd) (HashMap TmName (Type, Term))
- CLaSH.Rewrite.Types: curFun :: Lens' (RewriteState extra_a3xGu) TmName
+ CLaSH.Rewrite.Types: curFun :: Lens' (RewriteState extra_a3bLd) TmName
- CLaSH.Rewrite.Types: extra :: Lens (RewriteState extra_a3xGu) (RewriteState extra_a3xJR) extra_a3xGu extra_a3xJR
+ CLaSH.Rewrite.Types: extra :: Lens (RewriteState extra_a3bLd) (RewriteState extra_a3bOA) extra_a3bLd extra_a3bOA
- CLaSH.Rewrite.Types: nameCounter :: Lens' (RewriteState extra_a3xGu) Int
+ CLaSH.Rewrite.Types: nameCounter :: Lens' (RewriteState extra_a3bLd) Int
- CLaSH.Rewrite.Types: transformCounter :: Lens' (RewriteState extra_a3xGu) Int
+ CLaSH.Rewrite.Types: transformCounter :: Lens' (RewriteState extra_a3bLd) Int
- CLaSH.Rewrite.Types: uniqSupply :: Lens' (RewriteState extra_a3xGu) Supply
+ CLaSH.Rewrite.Types: uniqSupply :: Lens' (RewriteState extra_a3bLd) Supply
Files
- CHANGELOG.md +7/−0
- README.md +3/−3
- clash-lib.cabal +6/−5
- src/CLaSH/Core/Util.hs +22/−0
- src/CLaSH/Netlist.hs +1/−1
- src/CLaSH/Netlist/BlackBox/Parser.hs +5/−1
- src/CLaSH/Netlist/BlackBox/Types.hs +3/−0
- src/CLaSH/Netlist/BlackBox/Util.hs +23/−1
- src/CLaSH/Netlist/Util.hs +5/−3
- src/CLaSH/Normalize.hs +35/−16
- src/CLaSH/Normalize/PrimitiveReductions.hs +388/−0
- src/CLaSH/Normalize/Strategy.hs +1/−1
- src/CLaSH/Normalize/Transformations.hs +95/−173
- src/CLaSH/Rewrite/Util.hs +10/−2
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Changelog for the [`clash-lib`](http://hackage.haskell.org/package/clash-lib) package +## 0.6 *October 3rd 2015*+* New features:+ * Support for `clash-prelude` 0.10+ * Add `~INDEXTYPE` tag: primitives get access to the `Index` clash-prelude type+ * Add `~IF` construct: primitives can do conditional templating+ * Unroll "definitions" of the following primitives: `fold`, `dfold`, `foldr`+ ## 0.5.13 *September 21st 2015* * Fixes bugs: * Performance bug: top-level definitions of type "Signal" erroneously inlined.
README.md view
@@ -11,8 +11,8 @@ Features of CλaSH: * Strongly typed (like VHDL), yet with a very high degree of type inference,- which enables both safe and fast prototying using consise descriptions (like- Verilog)+ enabling both safe and fast prototying using consise descriptions (like+ Verilog). * Interactive REPL: load your designs in an interpreter and easily test all your component without needing to setup a test bench.@@ -21,7 +21,7 @@ fully parametric by default. * Synchronous sequential circuit design based on streams of values, called- `Signal`s.+ `Signal`s, lead to natural descriptions of feedback loops. * Support for multiple clock domains, with type safe clock domain crossing.
clash-lib.cabal view
@@ -1,5 +1,5 @@ Name: clash-lib-Version: 0.5.13+Version: 0.6 Synopsis: CAES Language for Synchronous Hardware - As a Library Description: CλaSH (pronounced ‘clash’) is a functional hardware description language that@@ -10,8 +10,8 @@ Features of CλaSH: . * Strongly typed (like VHDL), yet with a very high degree of type inference,- which enables both safe and fast prototying using consise descriptions (like- Verilog)+ enabling both safe and fast prototying using consise descriptions (like+ Verilog). . * Interactive REPL: load your designs in an interpreter and easily test all your component without needing to setup a test bench.@@ -20,7 +20,7 @@ fully parametric by default. . * Synchronous sequential circuit design based on streams of values, called- @Signal@s.+ @Signal@s, lead to natural descriptions of feedback loops. . * Support for multiple clock domains, with type safe clock domain crossing. .@@ -89,7 +89,7 @@ attoparsec >= 0.10.4.0, base >= 4.8 && < 5, bytestring >= 0.10.0.2,- clash-prelude >= 0.8,+ clash-prelude >= 0.10, concurrent-supply >= 0.1.7, containers >= 0.5.0.0, deepseq >= 1.3.0.2,@@ -140,6 +140,7 @@ CLaSH.Netlist.Util CLaSH.Normalize+ CLaSH.Normalize.PrimitiveReductions CLaSH.Normalize.Strategy CLaSH.Normalize.Transformations CLaSH.Normalize.Types
src/CLaSH/Core/Util.hs view
@@ -258,6 +258,28 @@ ,resTy ,(LitTy (NumTy (n-1)))]) +-- | Append elements to the supplied vector+appendToVec :: DataCon -- ^ The Cons (:>) constructor+ -> Type -- ^ Element type+ -> Term -- ^ The vector to append the elements to+ -> Int -- ^ Length of the vector+ -> [Term] -- ^ Elements to append+ -> Term+appendToVec consCon resTy vec = go+ where+ go _ [] = vec+ go n (x:xs) = mkApps (Data consCon) [Right (LitTy (NumTy n))+ ,Right resTy+ ,Right (LitTy (NumTy (n-1)))+ ,Left (Prim "_CO_" (consCoTy n))+ ,Left x+ ,Left (go (n-1) xs)]++ consCoTy n = head (fromJust $! dataConInstArgTys consCon+ [(LitTy (NumTy n))+ ,resTy+ ,(LitTy (NumTy (n-1)))])+ -- | Create let-bindings with case-statements that select elements out of a -- vector. Returns both the variables to which element-selections are bound -- and the let-bindings
src/CLaSH/Netlist.hs view
@@ -303,7 +303,7 @@ case appF of Data dc | all (\e -> isConstant e || isVar e) tmArgs -> mkDcApplication hwTy dc tmArgs- | otherwise -> error $ $(curLoc) ++ "Not in normal form: DataCon-application with non-Simple arguments"+ | otherwise -> error $ $(curLoc) ++ "Not in normal form: DataCon-application with non-Simple arguments: " ++ showDoc app Prim nm _ -> mkPrimitive False bbEasD nm args ty Var _ f | null tmArgs -> return (Identifier (mkBasicId . Text.pack $ name2String f) Nothing,[])
src/CLaSH/Netlist/BlackBox/Parser.hs view
@@ -36,7 +36,10 @@ -- | Parse a Declaration or Expression element pTagD :: Parser Element-pTagD = D <$> pDecl+pTagD = IF <$> (pTokenWS "~IF" *> pTagE)+ <*> (pSpaces *> (pToken "~THEN" *> pBlackBoxD))+ <*> (pToken "~ELSE" *> pBlackBoxD <* pToken "~FI")+ <|> D <$> pDecl <|> pTagE -- | Parse a Declaration@@ -69,6 +72,7 @@ <|> Err Nothing <$ pToken "~ERRORO" <|> (Err . Just) <$> (pToken "~ERROR" *> pBrackets pNatural) <|> TypElem <$> (pToken "~TYPEL" *> pBrackets pTagE)+ <|> IndexType <$> (pToken "~INDEXTYPE" *> pBrackets pTagE) <|> CompName <$ pToken "~COMPNAME" <|> Size <$> (pToken "~SIZE" *> pBrackets pTagE) <|> Length <$> (pToken "~LENGTH" *> pBrackets pTagE)
src/CLaSH/Netlist/BlackBox/Types.hs view
@@ -22,11 +22,14 @@ | TypElem !Element -- ^ Select element type from a vector type | CompName -- ^ Hole for the name of the component in which -- the blackbox is instantiated+ | IndexType !Element -- ^ Index data type hole, the field is the+ -- (exclusive) maximum index | Size !Element -- ^ Size of a type hole | Length !Element -- ^ Length of a vector hole | FilePath !Element -- ^ Hole containing a filepath for a data file | Gen !Bool -- ^ Hole marking beginning (True) or end (False) -- of a generative construct+ | IF !Element [Element] [Element] | SigD [Element] !(Maybe Int) deriving Show
src/CLaSH/Netlist/BlackBox/Util.hs view
@@ -1,7 +1,8 @@+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ViewPatterns #-} -- | Utilties to verify blackbox contexts against templates and rendering -- filled in templates@@ -79,6 +80,7 @@ return (Sym k) Just k -> return (Sym k) D (Decl n l') -> D <$> (Decl n <$> mapM (combineM setSym' setSym') l')+ IF c t f -> IF <$> pure c <*> setSym' t <*> setSym' f SigD e' m -> SigD <$> (setSym' e') <*> pure m _ -> pure e )@@ -98,6 +100,7 @@ setClocks bc bt = mapM setClocks' bt where setClocks' (D (Decl n l)) = D <$> (Decl n <$> mapM (combineM (setClocks bc) (setClocks bc)) l)+ setClocks' (IF c t f) = IF <$> pure c <*> setClocks bc t <*> setClocks bc f setClocks' (SigD e m) = SigD <$> (setClocks bc e) <*> pure m setClocks' (Clk Nothing) = let (clk,rate) = clkSyncId $ fst $ bbResult bc@@ -186,6 +189,18 @@ t <- hdlSig e' ty return (displayT $ renderOneLine t) +renderElem b (IF c t f) = do+ let c' = case c of+ (Size e) -> typeSize (lineToType b [e])+ (Length e) -> case lineToType b [e] of+ (Vector n _) -> n+ _ -> error $ $(curLoc) ++ "IF: veclen of a non-vector type"+ (L n) -> case bbInputs b !! n of+ (either id fst -> Literal _ (NumLit i),_,_) -> fromInteger i+ _ -> error $ $(curLoc) ++ "IF: LIT must be a numeric lit"+ _ -> error $ $(curLoc) ++ "IF: condition must be: SIZE, LENGHT, or LIT"+ if c' > 0 then renderBlackBox t b else renderBlackBox f b+ renderElem b e = renderTag b e parseFail :: Text -> BlackBoxTemplate@@ -218,6 +233,11 @@ lineToType b [(TypElem t)] = case lineToType b [t] of Vector _ elTy -> elTy _ -> error $ $(curLoc) ++ "Element type selection of a non-vector type"+lineToType b [(IndexType (L n))] =+ case bbInputs b !! n of+ (Left (Literal _ (NumLit n')),_,_) -> Index (fromInteger n')+ x -> error $ $(curLoc) ++ "Index type not given a literal: " ++ show x+ lineToType _ _ = error $ $(curLoc) ++ "Unexpected type manipulation" -- | Give a context and a tagged hole (of a template), returns part of the@@ -252,9 +272,11 @@ renderTag b e@(TypElem _) = let ty = lineToType b [e] in (displayT . renderOneLine) <$> hdlType ty renderTag _ (Gen b) = displayT . renderOneLine <$> genStmt b+renderTag _ (IF _ _ _) = error $ $(curLoc) ++ "Unexpected IF" renderTag _ (D _) = error $ $(curLoc) ++ "Unexpected component declaration" renderTag _ (SigD _ _) = error $ $(curLoc) ++ "Unexpected signal declaration" renderTag _ (Clk _) = error $ $(curLoc) ++ "Unexpected clock" renderTag _ (Rst _) = error $ $(curLoc) ++ "Unexpected reset" renderTag _ CompName = error $ $(curLoc) ++ "Unexpected component name"+renderTag _ (IndexType _) = error $ $(curLoc) ++ "Unexpected index type" renderTag _ (FilePath _) = error $ $(curLoc) ++ "Unexpected file name"
src/CLaSH/Netlist/Util.hs view
@@ -158,18 +158,20 @@ -> HashMap TyConName TyCon -> Type -> Bool-representableType builtInTranslation m = either (const False) (const True) . coreTypeToHWType builtInTranslation m+representableType builtInTranslation m = either (const False) ((> 0) . typeSize) . coreTypeToHWType builtInTranslation m -- | Determines the bitsize of a type typeSize :: HWType -> Int-typeSize Void = 1+typeSize Void = 0 typeSize Bool = 1 typeSize (Clock _ _) = 1 typeSize (Reset _ _) = 1 typeSize Integer = 32 typeSize (BitVector i) = i-typeSize (Index u) = clog2 (max 2 u)+typeSize (Index 0) = 0+typeSize (Index 1) = 1+typeSize (Index u) = clog2 u typeSize (Signed i) = i typeSize (Unsigned i) = i typeSize (Vector n el) = n * typeSize el
src/CLaSH/Normalize.hs view
@@ -20,7 +20,7 @@ import CLaSH.Core.Pretty (showDoc) import CLaSH.Core.Subst (substTms) import CLaSH.Core.Term (Term (..), TmName)-import CLaSH.Core.Type (Type)+import CLaSH.Core.Type (Type, splitFunForallTy) import CLaSH.Core.TyCon (TyCon, TyConName) import CLaSH.Core.Util (collectArgs, mkApps, termType) import CLaSH.Core.Var (Id,varName)@@ -36,7 +36,8 @@ import CLaSH.Rewrite.Types (DebugLevel (..), RewriteEnv (..), RewriteState (..), bindings, curFun, dbgLevel, tcCache, extra)-import CLaSH.Rewrite.Util (runRewrite,+import CLaSH.Rewrite.Util (isUntranslatableType,+ runRewrite, runRewriteSession) import CLaSH.Util @@ -97,20 +98,38 @@ exprM <- HashMap.lookup nm <$> Lens.use bindings let nmS = showDoc nm case exprM of- Just (_,tm) -> do- tmNorm <- makeCached nm (extra.normalized) $ do- curFun .= nm- tm' <- rewriteExpr ("normalization",normalization) (nmS,tm)- tcm <- Lens.view tcCache- ty' <- termType tcm tm'- return (ty',tm')- let usedBndrs = Lens.toListOf termFreeIds (snd tmNorm)- traceIf (nm `elem` usedBndrs)- ($(curLoc) ++ "Expr belonging to bndr: " ++ nmS ++ " (:: " ++ showDoc (fst tmNorm) ++ ") remains recursive after normalization:\n" ++ showDoc (snd tmNorm))- (return ())- prevNorm <- fmap HashMap.keys $ Lens.use (extra.normalized)- let toNormalize = filter (`notElem` (nm:prevNorm)) usedBndrs- return (toNormalize,(nm,tmNorm))+ Just (ty,tm) -> do+ let (_,resTy) = splitFunForallTy ty+ resTyRep <- not <$> isUntranslatableType resTy+ if resTyRep+ then do+ tmNorm <- makeCached nm (extra.normalized) $ do+ curFun .= nm+ tm' <- rewriteExpr ("normalization",normalization) (nmS,tm)+ tcm <- Lens.view tcCache+ ty' <- termType tcm tm'+ return (ty',tm')+ let usedBndrs = Lens.toListOf termFreeIds (snd tmNorm)+ traceIf (nm `elem` usedBndrs)+ (concat [ $(curLoc),"Expr belonging to bndr: ",nmS ," (:: "+ , showDoc (fst tmNorm)+ , ") remains recursive after normalization:\n"+ , showDoc (snd tmNorm) ])+ (return ())+ prevNorm <- fmap HashMap.keys $ Lens.use (extra.normalized)+ let toNormalize = filter (`notElem` (nm:prevNorm)) usedBndrs+ return (toNormalize,(nm,tmNorm))+ else do+ let usedBndrs = Lens.toListOf termFreeIds tm+ prevNorm <- fmap HashMap.keys $ Lens.use (extra.normalized)+ let toNormalize = filter (`notElem` (nm:prevNorm)) usedBndrs+ lvl <- Lens.view dbgLevel+ traceIf (lvl >= DebugFinal)+ (concat [$(curLoc), "Expr belonging to bndr: ", nmS, " (:: "+ , showDoc ty+ , ") has a non-representable return type."+ , " Not normalising:\n", showDoc tm] )+ (return (toNormalize,(nm,(ty,tm)))) Nothing -> error $ $(curLoc) ++ "Expr belonging to bndr: " ++ nmS ++ " not found" -- | Rewrite a term according to the provided transformation
+ src/CLaSH/Normalize/PrimitiveReductions.hs view
@@ -0,0 +1,388 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}++-- | Reductions of primitives+--+-- Currently, it contains reductions for:+--+-- * CLaSH.Sized.Vector.map+-- * CLaSH.Sized.Vector.zipWith+-- * CLaSH.Sized.Vector.traverse#+-- * CLaSH.Sized.Vector.foldr+-- * CLaSH.Sized.Vector.fold+-- * CLaSH.Sized.Vector.dfold+-- * CLaSH.Sized.Vector.(++)+-- * CLaSH.Sized.Vector.head+-- * CLaSH.Sized.Vector.tail+-- * CLaSH.Sized.Vector.unconcatBitVector#+--+-- Partially handles:+--+-- * CLaSH.Sized.Vector.unconcat+-- * CLaSH.Sized.Vector.transpose+module CLaSH.Normalize.PrimitiveReductions where++import qualified Control.Lens as Lens+import qualified Data.HashMap.Lazy as HashMap+import qualified Data.Maybe as Maybe+import Unbound.Generics.LocallyNameless (bind, embed, rec, rebind,+ string2Name)++import CLaSH.Core.DataCon (DataCon, dataConInstArgTys)+import CLaSH.Core.Term (Term (..), Pat (..))+import CLaSH.Core.Type (LitTy (..), Type (..),+ TypeView (..), mkFunTy,+ mkTyConApp, splitFunForallTy,+ tyView)+import CLaSH.Core.TyCon (TyConName, tyConDataCons)+import CLaSH.Core.TysPrim (typeNatKind)+import CLaSH.Core.Util (appendToVec, extractElems,+ idToVar, mkApps, mkVec,+ termType)+import CLaSH.Core.Var (Var (..))++import CLaSH.Normalize.Types+import CLaSH.Rewrite.Types+import CLaSH.Rewrite.Util+import CLaSH.Util++-- import CLaSH.Core.Pretty++-- | Replace an application of the @CLaSH.Sized.Vector.zipWith@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.zipWith@+reduceZipWith :: Int -- ^ Length of the vector(s)+ -> Type -- ^ Type of the lhs of the function+ -> Type -- ^ Type of the rhs of the function+ -> Type -- ^ Type of the result of the function+ -> Term -- ^ The zipWith'd functions+ -> Term -- ^ The 1st vector argument+ -> Term -- ^ The 2nd vector argument+ -> NormalizeSession Term+reduceZipWith n lhsElTy rhsElTy resElTy fun lhsArg rhsArg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm lhsArg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [nilCon,consCon] = tyConDataCons vecTc+ (varsL,elemsL) = second concat . unzip+ $ extractElems consCon lhsElTy 'L' n lhsArg+ (varsR,elemsR) = second concat . unzip+ $ extractElems consCon rhsElTy 'R' n rhsArg+ funApps = zipWith (\l r -> mkApps fun [Left l,Left r]) varsL varsR+ lbody = mkVec nilCon consCon resElTy n funApps+ lb = Letrec (bind (rec (init elemsL ++ init elemsR)) lbody)+ changed lb++-- | Replace an application of the @CLaSH.Sized.Vector.map@ primitive on vectors+-- of a known length @n@, by the fully unrolled recursive "definition" of+-- @CLaSH.Sized.Vector.map@+reduceMap :: Int -- ^ Length of the vector+ -> Type -- ^ Argument type of the function+ -> Type -- ^ Result type of the function+ -> Term -- ^ The map'd function+ -> Term -- ^ The map'd over vector+ -> NormalizeSession Term+reduceMap n argElTy resElTy fun arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [nilCon,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon argElTy 'A' n arg+ funApps = map (fun `App`) vars+ lbody = mkVec nilCon consCon resElTy n funApps+ lb = Letrec (bind (rec (init elems)) lbody)+ changed lb++-- | Replace an application of the @CLaSH.Sized.Vector.traverse#@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.traverse#@+reduceTraverse :: Int -- ^ Length of the vector+ -> Type -- ^ Element type of the argument vector+ -> Type -- ^ The type of the applicative+ -> Type -- ^ Element type of the result vector+ -> Term -- ^ The @Applicative@ dictionary+ -> Term -- ^ The function to traverse with+ -> Term -- ^ The argument vector+ -> NormalizeSession Term+reduceTraverse n aTy fTy bTy dict fun arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ (TyConApp apDictTcNm _) <- tyView <$> termType tcm dict+ let (Just apDictTc) = HashMap.lookup apDictTcNm tcm+ [apDictCon] = tyConDataCons apDictTc+ (Just apDictIdTys) = dataConInstArgTys apDictCon [fTy]+ apDictIds = zipWith Id (map string2Name ["functorDict"+ ,"pure"+ ,"ap"+ ,"apConstL"+ ,"apConstR"])+ (map embed apDictIdTys)++ (TyConApp funcDictTcNm _) = tyView (head apDictIdTys)+ (Just funcDictTc) = HashMap.lookup funcDictTcNm tcm+ [funcDictCon] = tyConDataCons funcDictTc+ (Just funcDictIdTys) = dataConInstArgTys funcDictCon [fTy]+ funcDicIds = zipWith Id (map string2Name ["fmap","fmapConst"])+ (map embed funcDictIdTys)++ apPat = DataPat (embed apDictCon) (rebind [] apDictIds)+ fnPat = DataPat (embed funcDictCon) (rebind [] funcDicIds)++ -- Extract the 'pure' function from the Applicative dictionary+ pureTy = apDictIdTys!!1+ pureTm = Case dict pureTy [bind apPat (Var pureTy (string2Name "pure"))]++ -- Extract the '<*>' function from the Applicative dictionary+ apTy = apDictIdTys!!2+ apTm = Case dict apTy [bind apPat (Var apTy (string2Name "ap"))]++ -- Extract the Functor dictionary from the Applicative dictionary+ funcTy = (head apDictIdTys)+ funcTm = Case dict funcTy+ [bind apPat (Var funcTy (string2Name "functorDict"))]++ -- Extract the 'fmap' function from the Functor dictionary+ fmapTy = (head funcDictIdTys)+ fmapTm = Case (Var funcTy (string2Name "functorDict")) fmapTy+ [bind fnPat (Var fmapTy (string2Name "fmap"))]++ (Just vecTc) = HashMap.lookup vecTcNm tcm+ [nilCon,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon aTy 'T' n arg++ funApps = map (fun `App`) vars++ lbody = mkTravVec vecTcNm nilCon consCon (idToVar (apDictIds!!1))+ (idToVar (apDictIds!!2))+ (idToVar (funcDicIds!!0))+ bTy n funApps++ lb = Letrec (bind (rec ([((apDictIds!!0),embed funcTm)+ ,((apDictIds!!1),embed pureTm)+ ,((apDictIds!!2),embed apTm)+ ,((funcDicIds!!0),embed fmapTm)+ ] ++ init elems)) lbody)+ changed lb++-- | Create the traversable vector+--+-- e.g. for a length '2' input vector, we get+--+-- > (:>) <$> x0 <*> ((:>) <$> x1 <*> pure Nil)+mkTravVec :: TyConName -- ^ Vec tcon+ -> DataCon -- ^ Nil con+ -> DataCon -- ^ Cons con+ -> Term -- ^ 'pure' term+ -> Term -- ^ '<*>' term+ -> Term -- ^ 'fmap' term+ -> Type -- ^ 'b' ty+ -> Int -- ^ Length of the vector+ -> [Term] -- ^ Elements of the vector+ -> Term+mkTravVec vecTc nilCon consCon pureTm apTm fmapTm bTy = go+ where+ go :: Int -> [Term] -> Term+ go _ [] = mkApps pureTm [Right (mkTyConApp vecTc [LitTy (NumTy 0),bTy])+ ,Left (mkApps (Data nilCon)+ [Right (LitTy (NumTy 0))+ ,Right bTy+ ,Left (Prim "_CO_" nilCoTy)])]++ go n (x:xs) = mkApps apTm+ [Right (mkTyConApp vecTc [LitTy (NumTy (n-1)),bTy])+ ,Right (mkTyConApp vecTc [LitTy (NumTy n),bTy])+ ,Left (mkApps fmapTm [Right bTy+ ,Right (mkFunTy (mkTyConApp vecTc [LitTy (NumTy (n-1)),bTy])+ (mkTyConApp vecTc [LitTy (NumTy n),bTy]))+ ,Left (mkApps (Data consCon)+ [Right (LitTy (NumTy n))+ ,Right bTy+ ,Right (LitTy (NumTy (n-1)))+ ,Left (Prim "_CO_" (consCoTy n))+ ])+ ,Left x])+ ,Left (go (n-1) xs)]++ nilCoTy = head (Maybe.fromJust (dataConInstArgTys nilCon [(LitTy (NumTy 0))+ ,bTy]))++ consCoTy n = head (Maybe.fromJust (dataConInstArgTys consCon+ [(LitTy (NumTy n))+ ,bTy+ ,(LitTy (NumTy (n-1)))]))++-- | Replace an application of the @CLaSH.Sized.Vector.foldr@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.foldr@+reduceFoldr :: Int -- ^ Length of the vector+ -> Type -- ^ Element type of the argument vector+ -> Type -- ^ Type of the starting element+ -> Term -- ^ The function to fold with+ -> Term -- ^ The starting value+ -> Term -- ^ The argument vector+ -> NormalizeSession Term+reduceFoldr n aTy _bTy fun start arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [_,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon aTy 'G' n arg+ lbody = foldr (\l r -> mkApps fun [Left l,Left r]) start vars+ lb = Letrec (bind (rec (init elems)) lbody)+ changed lb++-- | Replace an application of the @CLaSH.Sized.Vector.fold@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.fold@+reduceFold :: Int -- ^ Length of the vector+ -> Type -- ^ Element type of the argument vector+ -> Term -- ^ The function to fold with+ -> Term -- ^ The argument vector+ -> NormalizeSession Term+reduceFold n aTy fun arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [_,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon aTy 'F' n arg+ lbody = foldV vars+ lb = Letrec (bind (rec (init elems)) lbody)+ changed lb+ where+ foldV [a] = a+ foldV as = let (l,r) = splitAt (length as `div` 2) as+ lF = foldV l+ rF = foldV r+ in mkApps fun [Left lF, Left rF]++-- | Replace an application of the @CLaSH.Sized.Vector.dfold@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.dfold@+reduceDFold :: Int -- ^ Length of the vector+ -> Type -- ^ Element type of the argument vector+ -> Term -- ^ Function to fold with+ -> Term -- ^ Starting value+ -> Term -- ^ The vector to fold+ -> NormalizeSession Term+reduceDFold n aTy fun start arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [_,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon aTy 'D' n arg+ ([_ltv,Right dsTy,_etaTy,_eta1Ty],_) <- splitFunForallTy <$> termType tcm fun+ let (TyConApp proxyTcNm _) = tyView dsTy+ (Just proxyTc) = HashMap.lookup proxyTcNm tcm+ [proxyDc] = tyConDataCons proxyTc+ lbody = doFold (Data proxyDc) (n-1) vars+ lb = Letrec (bind (rec (init elems)) lbody)+ changed lb+ where+ doFold _ _ [] = start+ doFold pDc k (x:xs) = mkApps fun+ [Right (LitTy (NumTy k))+ ,Left (mkApps pDc [Right typeNatKind+ ,Right (LitTy (NumTy k))])+ ,Left x+ ,Left (doFold pDc (k-1) xs)+ ]++-- | Replace an application of the @CLaSH.Sized.Vector.head@ primitive on+-- vectors of a known length @n@, by a projection of the first element of a+-- vector.+reduceHead :: Int -- ^ Length of the vector+ -> Type -- ^ Element type of the vector+ -> Term -- ^ The argument vector+ -> NormalizeSession Term+reduceHead n aTy vArg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm vArg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [_,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon aTy 'H' n vArg+ lb = Letrec (bind (rec [head elems]) (head vars))+ changed lb++-- | Replace an application of the @CLaSH.Sized.Vector.tail@ primitive on+-- vectors of a known length @n@, by a projection of the tail of a+-- vector.+reduceTail :: Int -- ^ Length of the vector+ -> Type -- ^ Element type of the vector+ -> Term -- ^ The argument vector+ -> NormalizeSession Term+reduceTail n aTy vArg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm vArg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [_,consCon] = tyConDataCons vecTc+ (_,elems) = second concat . unzip+ $ extractElems consCon aTy 'L' n vArg+ b@(tB,_) = elems !! 1+ lb = Letrec (bind (rec [b]) (idToVar tB))+ changed lb++-- | Replace an application of the @CLaSH.Sized.Vector.(++)@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.(++)@+reduceAppend :: Int -- ^ Length of the LHS arg+ -> Int -- ^ Lenght of the RHS arg+ -> Type -- ^ Element type of the vectors+ -> Term -- ^ The LHS argument+ -> Term -- ^ The RHS argument+ -> NormalizeSession Term+reduceAppend n m aTy lArg rArg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm lArg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [_,consCon] = tyConDataCons vecTc+ (vars,elems) = second concat . unzip+ $ extractElems consCon aTy 'C' n lArg+ lbody = appendToVec consCon aTy rArg (n+m) vars+ lb = Letrec (bind (rec (init elems)) lbody)+ changed lb++-- | Replace an application of the @CLaSH.Sized.Vector.unconcat@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.unconcat@+reduceUnconcat :: Int -- ^ Length of the result vector+ -> Int -- ^ Length of the elements of the result vector+ -> Type -- ^ Element type+ -> Term -- ^ Argument vector+ -> NormalizeSession Term+reduceUnconcat n 0 aTy arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [nilCon,consCon] = tyConDataCons vecTc+ nilVec = mkVec nilCon consCon aTy 0 []+ innerVecTy = mkTyConApp vecTcNm [LitTy (NumTy 0), aTy]+ retVec = mkVec nilCon consCon innerVecTy n (replicate n nilVec)+ changed retVec++reduceUnconcat _ _ _ _ = error $ $(curLoc) ++ "reduceUnconcat: unimplemented"++-- | Replace an application of the @CLaSH.Sized.Vector.transpose@ primitive on+-- vectors of a known length @n@, by the fully unrolled recursive "definition"+-- of @CLaSH.Sized.Vector.transpose@+reduceTranspose :: Int -- ^ Length of the result vector+ -> Int -- ^ Length of the elements of the result vector+ -> Type -- ^ Element type+ -> Term -- ^ Argument vector+ -> NormalizeSession Term+reduceTranspose n 0 aTy arg = do+ tcm <- Lens.view tcCache+ (TyConApp vecTcNm _) <- tyView <$> termType tcm arg+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [nilCon,consCon] = tyConDataCons vecTc+ nilVec = mkVec nilCon consCon aTy 0 []+ innerVecTy = mkTyConApp vecTcNm [LitTy (NumTy 0), aTy]+ retVec = mkVec nilCon consCon innerVecTy n (replicate n nilVec)+ changed retVec++reduceTranspose _ _ _ _ = error $ $(curLoc) ++ "reduceTranspose: unimplemented"
src/CLaSH/Normalize/Strategy.hs view
@@ -169,7 +169,7 @@ > f = \a x -> (a x) && (f a x) > f' = \x -> (not x) && (f not x) -Because f has already been specialised on the alpha-equivalent-to-itself not+Because `f` has already been specialised on the alpha-equivalent-to-itself `not` function, liftNonRep leads to: > main = f'
src/CLaSH/Normalize/Transformations.hs view
@@ -33,17 +33,17 @@ import qualified Control.Lens as Lens import qualified Control.Monad as Monad import Control.Monad.Writer (WriterT (..), lift, tell)+import Data.Bits ((.&.), complement) import qualified Data.Either as Either import qualified Data.HashMap.Lazy as HashMap import qualified Data.List as List import qualified Data.Maybe as Maybe-import Unbound.Generics.LocallyNameless (Bind, Embed (..), bind, embed,+import Unbound.Generics.LocallyNameless (Bind, Embed (..), bind, embed, rec, unbind, unembed, unrebind,- unrec, name2String, string2Name,- rebind)+ unrec, name2String) import Unbound.Generics.LocallyNameless.Unsafe (unsafeUnbind) -import CLaSH.Core.DataCon (DataCon (..), dataConInstArgTys)+import CLaSH.Core.DataCon (DataCon (..)) import CLaSH.Core.FreeVars (termFreeIds, termFreeTyVars, typeFreeVars) import CLaSH.Core.Pretty (showDoc)@@ -54,10 +54,9 @@ LitTy (..), applyFunTy, applyTy, isPolyFunCoreTy, splitFunTy, typeKind,- tyView, mkTyConApp, mkFunTy)-import CLaSH.Core.TyCon (TyConName, tyConDataCons)-import CLaSH.Core.Util (collectArgs, extractElems,- idToVar, isCon,+ tyView)+import CLaSH.Core.TyCon (tyConDataCons)+import CLaSH.Core.Util (collectArgs, idToVar, isCon, isFun, isLet, isPolyFun, isPrim, isSignalType, isVar, mkApps, mkLams, mkTmApps, mkVec,@@ -65,6 +64,7 @@ import CLaSH.Core.Var (Id, Var (..)) import CLaSH.Netlist.Util (representableType, splitNormalized)+import CLaSH.Normalize.PrimitiveReductions import CLaSH.Normalize.Types import CLaSH.Normalize.Util import CLaSH.Rewrite.Combinators@@ -271,6 +271,7 @@ changed (Letrec (bind binds (App appConPrim body))) (True,Case {}) -> specializeNorm ctx e (True,Lam _) -> specializeNorm ctx e+ (True,TyLam _) -> specializeNorm ctx e _ -> return e nonRepANF _ e = return e@@ -737,10 +738,24 @@ -- * CLaSH.Sized.Vector.map -- * CLaSH.Sized.Vector.zipWith -- * CLaSH.Sized.Vector.traverse#+-- * CLaSH.Sized.Vector.foldr+-- * CLaSH.Sized.Vector.fold+-- * CLaSH.Sized.Vector.dfold+-- * CLaSH.Sized.Vector.(++)+-- * CLaSH.Sized.Vector.head+-- * CLaSH.Sized.Vector.tail reduceNonRepPrim :: NormRewrite-reduceNonRepPrim _ e@(App _ _)- | (Prim f _, args) <- collectArgs e- = case f of+reduceNonRepPrim _ e@(App _ _) | (Prim f _, args) <- collectArgs e = do+ tcm <- Lens.view tcCache+ eTy <- termType tcm e+ case tyView eTy of+ (TyConApp vecTcNm@(name2String -> "CLaSH.Sized.Vector.Vec")+ [LitTy (NumTy 0), aTy]) -> do+ let (Just vecTc) = HashMap.lookup vecTcNm tcm+ [nilCon,consCon] = tyConDataCons vecTc+ nilE = mkVec nilCon consCon aTy 0 []+ changed nilE+ _ -> case f of "CLaSH.Sized.Vector.zipWith" | length args == 7 -> do let [lhsElTy,rhsElty,resElTy,nTy] = Either.rights args case nTy of@@ -768,168 +783,75 @@ let [dict,fun,arg] = Either.lefts args in reduceTraverse n aTy fTy bTy dict fun arg _ -> return e+ "CLaSH.Sized.Vector.fold" | length args == 4 -> do+ let [aTy,nTy] = Either.rights args+ isPow2 x = x /= 0 && (x .&. (complement x + 1)) == x+ untranslatableTy <- isUntranslatableType aTy+ case nTy of+ (LitTy (NumTy n)) | not (isPow2 (n + 1)) || untranslatableTy ->+ let [fun,arg] = Either.lefts args+ in reduceFold (n + 1) aTy fun arg+ _ -> return e+ "CLaSH.Sized.Vector.foldr" | length args == 6 ->+ let [aTy,bTy,nTy] = Either.rights args+ in case nTy of+ (LitTy (NumTy n)) -> do+ untranslatableTys <- mapM isUntranslatableType [aTy,bTy]+ if or untranslatableTys+ then let [fun,start,arg] = Either.lefts args+ in reduceFoldr n aTy bTy fun start arg+ else return e+ _ -> return e+ "CLaSH.Sized.Vector.dfold" | length args == 7 ->+ let [_mTy,nTy,aTy] = Either.rights args+ in case nTy of+ (LitTy (NumTy n)) ->+ let [_motive,fun,start,arg] = Either.lefts args+ in reduceDFold n aTy fun start arg+ _ -> return e+ "CLaSH.Sized.Vector.++" | length args == 5 ->+ let [nTy,aTy,mTy] = Either.rights args+ [lArg,rArg] = Either.lefts args+ in case (nTy,mTy) of+ (LitTy (NumTy n), LitTy (NumTy m))+ | n == 0 -> changed rArg+ | m == 0 -> changed lArg+ | otherwise -> do+ untranslatableTy <- isUntranslatableType aTy+ if untranslatableTy+ then reduceAppend n m aTy lArg rArg+ else return e+ _ -> return e+ "CLaSH.Sized.Vector.head" | length args == 3 -> do+ let [nTy,aTy] = Either.rights args+ [vArg] = Either.lefts args+ case nTy of+ (LitTy (NumTy n)) -> do+ untranslatableTy <- isUntranslatableType aTy+ if untranslatableTy+ then reduceHead n aTy vArg+ else return e+ _ -> return e+ "CLaSH.Sized.Vector.tail" | length args == 3 -> do+ let [nTy,aTy] = Either.rights args+ [vArg] = Either.lefts args+ case nTy of+ (LitTy (NumTy n)) -> do+ untranslatableTy <- isUntranslatableType aTy+ if untranslatableTy+ then reduceTail n aTy vArg+ else return e+ _ -> return e+ "CLaSH.Sized.Vector.unconcat" | length args == 6 -> do+ let ([_knN,_sm,arg],[mTy,nTy,aTy]) = Either.partitionEithers args+ case (nTy,mTy) of+ (LitTy (NumTy n), LitTy (NumTy 0)) -> reduceUnconcat n 0 aTy arg+ _ -> return e+ "CLaSH.Sized.Vector.transpose" | length args == 5 -> do+ let ([_knN,arg],[mTy,nTy,aTy]) = Either.partitionEithers args+ case (nTy,mTy) of+ (LitTy (NumTy n), LitTy (NumTy 0)) -> reduceTranspose n 0 aTy arg+ _ -> return e _ -> return e reduceNonRepPrim _ e = return e---- | Replace an application of @CLaSH.Sized.Vector.zipWith@ primitive on vectors--- of a known length @n@, by the fully unrolled recursive "definition" of of--- @CLaSH.Sized.Vector.zipWith@-reduceZipWith :: Int -- ^ Length of the vector(s)- -> Type -- ^ Type of the lhs of the function- -> Type -- ^ Type of the rhs of the function- -> Type -- ^ Type of the result of the function- -> Term -- ^ The zipWith'd functions- -> Term -- ^ The 1st vector argument- -> Term -- ^ The 2nd vector argument- -> NormalizeSession Term-reduceZipWith n lhsElTy rhsElTy resElTy fun lhsArg rhsArg = do- tcm <- Lens.view tcCache- (TyConApp vecTcNm _) <- tyView <$> termType tcm lhsArg- let (Just vecTc) = HashMap.lookup vecTcNm tcm- [nilCon,consCon] = tyConDataCons vecTc- (varsL,elemsL) = second concat . unzip $ extractElems consCon lhsElTy 'L' n lhsArg- (varsR,elemsR) = second concat . unzip $ extractElems consCon rhsElTy 'R' n rhsArg- funApps = zipWith (\l r -> mkApps fun [Left l,Left r]) varsL varsR- lbody = mkVec nilCon consCon resElTy n funApps- lb = Letrec (bind (rec (init elemsL ++ init elemsR)) lbody)- changed lb---- | Replace an application of @CLaSH.Sized.Vector.map@ primitive on vectors--- of a known length @n@, by the fully unrolled recursive "definition" of of--- @CLaSH.Sized.Vector.map@-reduceMap :: Int -- ^ Length of the vector- -> Type -- ^ Argument type of the function- -> Type -- ^ Result type of the function- -> Term -- ^ The map'd function- -> Term -- ^ The map'd over vector- -> NormalizeSession Term-reduceMap n argElTy resElTy fun arg = do- tcm <- Lens.view tcCache- (TyConApp vecTcNm _) <- tyView <$> termType tcm arg- let (Just vecTc) = HashMap.lookup vecTcNm tcm- [nilCon,consCon] = tyConDataCons vecTc- (vars,elems) = second concat . unzip $ extractElems consCon argElTy 'A' n arg- funApps = map (fun `App`) vars- lbody = mkVec nilCon consCon resElTy n funApps- lb = Letrec (bind (rec (init elems)) lbody)- changed lb---- | Replace an application of @CLaSH.Sized.Vector.traverse#@ primitive on--- vectors of a known length @n@, by the fully unrolled recursive "definition"--- of @CLaSH.Sized.Vector.map@-reduceTraverse :: Int -- ^ Length of the vector- -> Type -- ^ Element type of the argument vector- -> Type -- ^ The type of the applicative- -> Type -- ^ Element type of the result vector- -> Term -- ^ The @Applicative@ dictionary- -> Term -- ^ The function to traverse with- -> Term -- ^ The argument vector- -> NormalizeSession Term-reduceTraverse n aTy fTy bTy dict fun arg = do- tcm <- Lens.view tcCache- (TyConApp vecTcNm _) <- tyView <$> termType tcm arg- (TyConApp apDictTcNm _) <- tyView <$> termType tcm dict- let (Just apDictTc) = HashMap.lookup apDictTcNm tcm- [apDictCon] = tyConDataCons apDictTc- (Just apDictIdTys) = dataConInstArgTys apDictCon [fTy]- apDictIds = zipWith Id (map string2Name ["functorDict"- ,"pure"- ,"ap"- ,"apConstL"- ,"apConstR"])- (map embed apDictIdTys)-- (TyConApp funcDictTcNm _) = tyView (head apDictIdTys)- (Just funcDictTc) = HashMap.lookup funcDictTcNm tcm- [funcDictCon] = tyConDataCons funcDictTc- (Just funcDictIdTys) = dataConInstArgTys funcDictCon [fTy]- funcDicIds = zipWith Id (map string2Name ["fmap","fmapConst"])- (map embed funcDictIdTys)-- apPat = DataPat (embed apDictCon) (rebind [] apDictIds)- fnPat = DataPat (embed funcDictCon) (rebind [] funcDicIds)-- -- Extract the 'pure' function from the Applicative dictionary- pureTy = apDictIdTys!!1- pureTm = Case dict pureTy [bind apPat (Var pureTy (string2Name "pure"))]-- -- Extract the '<*>' function from the Applicative dictionary- apTy = apDictIdTys!!2- apTm = Case dict apTy [bind apPat (Var apTy (string2Name "ap"))]-- -- Extract the Functor dictionary from the Applicative dictionary- funcTy = (head apDictIdTys)- funcTm = Case dict funcTy- [bind apPat (Var funcTy (string2Name "functorDict"))]-- -- Extract the 'fmap' function from the Functor dictionary- fmapTy = (head funcDictIdTys)- fmapTm = Case (Var funcTy (string2Name "functorDict")) fmapTy- [bind fnPat (Var fmapTy (string2Name "fmap"))]-- (Just vecTc) = HashMap.lookup vecTcNm tcm- [nilCon,consCon] = tyConDataCons vecTc- (vars,elems) = second concat . unzip- $ extractElems consCon aTy 'T' n arg-- funApps = map (fun `App`) vars-- lbody = mkTravVec vecTcNm nilCon consCon (idToVar (apDictIds!!1))- (idToVar (apDictIds!!2))- (idToVar (funcDicIds!!0))- bTy n funApps-- lb = Letrec (bind (rec ([((apDictIds!!0),embed funcTm)- ,((apDictIds!!1),embed pureTm)- ,((apDictIds!!2),embed apTm)- ,((funcDicIds!!0),embed fmapTm)- ] ++ init elems)) lbody)- changed lb---- | Create the traversable vector------ e.g. for a length '2' input vector, we get------ > (:>) <$> x0 <*> ((:>) <$> x1 <*> pure Nil)-mkTravVec :: TyConName -- ^ Vec tcon- -> DataCon -- ^ Nil con- -> DataCon -- ^ Cons con- -> Term -- ^ 'pure' term- -> Term -- ^ '<*>' term- -> Term -- ^ 'fmap' term- -> Type -- ^ 'b' ty- -> Int -- ^ Length of the vector- -> [Term] -- ^ Elements of the vector- -> Term-mkTravVec vecTc nilCon consCon pureTm apTm fmapTm bTy = go- where- go :: Int -> [Term] -> Term- go _ [] = mkApps pureTm [Right (mkTyConApp vecTc [LitTy (NumTy 0),bTy])- ,Left (mkApps (Data nilCon)- [Right (LitTy (NumTy 0))- ,Right bTy- ,Left (Prim "_CO_" nilCoTy)])]-- go n (x:xs) = mkApps apTm- [Right (mkTyConApp vecTc [LitTy (NumTy (n-1)),bTy])- ,Right (mkTyConApp vecTc [LitTy (NumTy n),bTy])- ,Left (mkApps fmapTm [Right bTy- ,Right (mkFunTy (mkTyConApp vecTc [LitTy (NumTy (n-1)),bTy])- (mkTyConApp vecTc [LitTy (NumTy n),bTy]))- ,Left (mkApps (Data consCon)- [Right (LitTy (NumTy n))- ,Right bTy- ,Right (LitTy (NumTy (n-1)))- ,Left (Prim "_CO_" (consCoTy n))- ])- ,Left x])- ,Left (go (n-1) xs)]-- nilCoTy = head (Maybe.fromJust (dataConInstArgTys nilCon [(LitTy (NumTy 0))- ,bTy]))-- consCoTy n = head (Maybe.fromJust (dataConInstArgTys consCon- [(LitTy (NumTy n))- ,bTy- ,(LitTy (NumTy (n-1)))]))
src/CLaSH/Rewrite/Util.hs view
@@ -537,8 +537,16 @@ (specBndrs,specVars) <- specArgBndrsAndVars ctx (Left specArg) -- Create specialized function let newBody = mkAbstraction specArg specBndrs- cf <- Lens.use curFun- newf <- mkFunction (string2Name (name2String cf ++ "_" ++ "specF")) newBody+ -- See if there's an existing binder that's alpha-equivalent to the+ -- specialised function+ existing <- HML.filter ((== newBody) . snd) <$> Lens.use bindings+ -- Create a new function if an alpha-equivalent binder doesn't exist+ newf <- case HML.toList existing of+ [] -> do cf <- Lens.use curFun+ mkFunction (string2Name (name2String cf ++ "_" ++ "specF")) newBody+ ((k,(kTy,_)):_) -> return (k,kTy)+ -- cf <- Lens.use curFun+ -- newf <- mkFunction (string2Name (name2String cf ++ "_" ++ "specF")) newBody -- Create specialized argument let newArg = Left $ mkApps ((uncurry . flip) Var newf) specVars -- Use specialized argument