Copyright  (C) 20152016 University of Twente 2016 Myrtle Software Ltd 2021 QBayLogic B.V. 

License  BSD2 (see the file LICENSE) 
Maintainer  QBayLogic B.V. <devops@qbaylogic.com> 
Safe Haskell  None 
Language  Haskell2010 
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#
 Clash.Sized.Vector.replicate
 Clash.Sized.Vector.imap
 Clash.Sized.Vector.dtfold
 Clash.Sized.RTree.tfold
 Clash.Sized.Vector.reverse
 Clash.Sized.Vector.unconcat
Partially handles:
 Clash.Sized.Vector.transpose
Synopsis
 typeNatAdd :: TyConName
 typeNatMul :: TyConName
 typeNatSub :: TyConName
 vecHeadPrim :: TyConName > Term
 vecLastPrim :: TyConName > Term
 vecHeadTy :: TyConName > Type
 vecTailPrim :: TyConName > Term
 vecInitPrim :: TyConName > Term
 vecTailTy :: TyConName > Type
 extractHeadTail :: DataCon > Type > Integer > Term > (Term, Term)
 mkVecCons :: HasCallStack => DataCon > Type > Integer > Term > Term > Term
 mkVecNil :: DataCon > Type > Term
 reduceReverse :: Integer > Type > Term > TransformContext > NormalizeSession Term
 reduceZipWith :: PrimInfo > Integer > Type > Type > Type > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceMap :: PrimInfo > Integer > Type > Type > Term > Term > TransformContext > NormalizeSession Term
 reduceImap :: Integer > Type > Type > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceIterateI :: Integer > Type > Type > Term > Term > Term > TransformContext > RewriteMonad NormalizeState Term
 reduceTraverse :: Integer > Type > Type > Type > Term > Term > Term > TransformContext > NormalizeSession Term
 mkTravVec :: TyConName > DataCon > DataCon > Term > Term > Term > Type > Integer > [Term] > Term
 reduceFoldr :: PrimInfo > Integer > Type > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceFold :: Integer > Type > Term > Term > TransformContext > NormalizeSession Term
 reduceDFold :: Integer > Type > Term > Term > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceHead :: Integer > Type > Term > TransformContext > NormalizeSession Term
 reduceTail :: Integer > Type > Term > TransformContext > NormalizeSession Term
 reduceLast :: Integer > Type > Term > TransformContext > NormalizeSession Term
 reduceInit :: PrimInfo > Integer > Type > Term > TransformContext > NormalizeSession Term
 reduceAppend :: Integer > Integer > Type > Term > Term > TransformContext > NormalizeSession Term
 reduceUnconcat :: PrimInfo > Integer > Integer > Type > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceTranspose :: Integer > Integer > Type > Term > Term > TransformContext > NormalizeSession Term
 reduceReplicate :: Integer > Type > Type > Term > Term > TransformContext > NormalizeSession Term
 reduceReplace_int :: Integer > Type > Type > Term > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceIndex_int :: Integer > Type > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceDTFold :: Integer > Type > Term > Term > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceTFold :: Integer > Type > Term > Term > Term > Term > Term > TransformContext > NormalizeSession Term
 reduceTReplicate :: Integer > Type > Type > Term > Term > TransformContext > NormalizeSession Term
 buildSNat :: DataCon > Integer > Term
Documentation
:: DataCon  The Cons (:>) constructor 
> Type  Element type 
> Integer  Length of the vector, must be positive 
> Term  Vector to extract head from 
> (Term, Term)  (head of vector, tail of vector) 
Makes two case statements: the first one extract the _head_ from the given vector, the latter the tail.
:: HasCallStack  
=> DataCon  The Cons (:>) constructor 
> Type  Element type 
> Integer  Length of the vector 
> Term  head of the vector 
> Term  tail of the vector 
> Term 
Create a vector of supplied elements
:: Integer  Length of the vector, must be positive 
> Type  Element of type of the vector 
> Term  The vector to reverse 
> TransformContext  
> NormalizeSession Term 
Replace an application of the Clash.Sized.Vector.reverse
primitive on
vectors of a known length n
, by the fully unrolled recursive "definition"
of Clash.Sized.Vector.reverse
:: PrimInfo  zipWith primitive info 
> Integer  Length of the vector(s) 
> Type  Element type of the lhs of the function 
> Type  Element type of the rhs of the function 
> Type  Element type of the result of the function 
> Term  The zipWith'd functions 
> Term  The 1st vector argument 
> Term  The 2nd vector argument 
> TransformContext  
> NormalizeSession Term 
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
:: PrimInfo  map primitive info 
> Integer  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 
> TransformContext  
> NormalizeSession Term 
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
:: Integer  Length of the vector, must be positive 
> Type  Argument type of the function 
> Type  Result type of the function 
> Term  Lenght of the vector (as a KnownNat) 
> Term  The imap'd function 
> Term  The imap'd over vector 
> TransformContext  
> NormalizeSession Term 
Replace an application of the Clash.Sized.Vector.imap
primitive on vectors
of a known length n
, by the fully unrolled recursive "definition" of
Clash.Sized.Vector.imap
:: Integer  Length of vector 
> Type  Vector's element type 
> Type  Vector's type 
> Term  Length of the vector (as a KnownNat) 
> Term  iterateI's HOfunction argument 
> Term  iterateI's start value 
> TransformContext  
> RewriteMonad NormalizeState Term  Fully unrolled definition 
Replace an application of the Clash.Sized.Vector.iterateI
primitive on
vectors of a known length n
, by the fully unrolled recursive "definition"
of Clash.Sized.Vector.iterateI
:: Integer  Length of the vector, must be positive 
> Type  Element type of the argument vector 
> Type  The type of the applicative 
> Type  Element type of the result vector 
> Term  The 
> Term  The function to traverse with 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
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#
:: TyConName  Vec tcon 
> DataCon  Nil con 
> DataCon  Cons con 
> Term 

> Term 

> Term 

> Type 

> Integer  Length of the vector 
> [Term]  Elements of the vector 
> Term 
Create the traversable vector
e.g. for a length '2' input vector, we get
(:>) <$> x0 <*> ((:>) <$> x1 <*> pure Nil)
:: PrimInfo  Primitive info for foldr blackbox 
> Integer  Length of the vector 
> Type  Element type of the argument vector 
> Term  The function to fold with 
> Term  The starting value 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
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
:: Integer  Length of the vector, must be positive 
> Type  Element type of the argument vector 
> Term  The function to fold with 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
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
:: Integer  Length of the vector 
> Type  Element type of the argument vector 
> Term  Length of the vector (as a KnownNat) 
> Term  The motive 
> Term  Function to fold with 
> Term  Starting value 
> Term  The vector to fold 
> TransformContext  
> NormalizeSession Term 
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
:: Integer  Length of the vector, must be positive 
> Type  Element type of the vector 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
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.
:: Integer  Length of the vector, must be positive 
> Type  Element type of the vector 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
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.
:: Integer  Length of the vector, must be positive 
> Type  Element type of the vector 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
Replace an application of the Clash.Sized.Vector.last
primitive on
vectors of a known length n
, by a projection of the last element of a
vector.
:: PrimInfo  Primitive info for 
> Integer  Length of the vector 
> Type  Element type of the vector 
> Term  The argument vector 
> TransformContext  
> NormalizeSession Term 
Replace an application of the Clash.Sized.Vector.init
primitive on
vectors of a known length n
, by a projection of the init of a
vector.
:: Integer  Length of the LHS arg 
> Integer  Lenght of the RHS arg 
> Type  Element type of the vectors 
> Term  The LHS argument 
> Term  The RHS argument 
> TransformContext  
> NormalizeSession Term 
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.(++)
:: PrimInfo  Unconcat primitive info 
> Integer  Length of the result vector 
> Integer  Length of the elements of the result vector 
> Type  Element type 
> Term  Length of the result vector (as a KnownNat) 
> Term  SNat "Length of the elements of the result vector" 
> Term  Argument vector 
> TransformContext  
> NormalizeSession Term 
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
:: Integer  Length of the result vector 
> Integer  Length of the elements of the result vector 
> Type  Element type 
> Term  Lenght of the result vector (as a KnownNat) 
> Term  Argument vector 
> TransformContext  
> NormalizeSession Term 
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
reduceReplicate :: Integer > Type > Type > Term > Term > TransformContext > NormalizeSession Term Source #
:: Integer  Size of vector, must be positive 
> Type  Type of vector element 
> Type  Type of vector 
> Term  Size of vector (as a KnownNat) 
> Term  Vector 
> Term  Index 
> Term  Element 
> TransformContext  
> NormalizeSession Term 
:: Integer  Size of vector, must be positive 
> Type  Type of vector element 
> Term  Size of vector (as a KnownNat) 
> Term  Vector 
> Term  Index 
> TransformContext  
> NormalizeSession Term 
:: Integer  Length of the vector 
> Type  Element type of the argument vector 
> Term  Length of the vector (as a KnownNat) 
> Term  The motive 
> Term  Function to convert elements with 
> Term  Function to combine branches with 
> Term  The vector to fold 
> TransformContext  
> NormalizeSession Term 
Replace an application of the Clash.Sized.Vector.dtfold
primitive on
vectors of a known length n
, by the fully unrolled recursive "definition"
of Clash.Sized.Vector.dtfold
:: Integer  Depth of the tree 
> Type  Element type of the argument tree 
> Term  Depth of the tree (as a KnownNat) 
> Term  The motive 
> Term  Function to convert elements with 
> Term  Function to combine branches with 
> Term  The tree to fold 
> TransformContext  
> NormalizeSession Term 
Replace an application of the Clash.Sized.RTree.tdfold
primitive on
trees of a known depth n
, by the fully unrolled recursive "definition"
of Clash.Sized.RTree.tdfold
:: Integer  Depth of the tree 
> Type  Element type 
> Type  Result type 
> Term  Depth of the tree (as an SNat) 
> Term  Element 
> TransformContext  
> NormalizeSession Term 