packages feed

clash-lib 0.5.3 → 0.5.4

raw patch · 10 files changed

+37/−8 lines, 10 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ CLaSH.Netlist.BlackBox: instantiateCompName :: BlackBoxTemplate -> NetlistMonad BlackBoxTemplate
+ CLaSH.Netlist.BlackBox.Types: [CompName] :: Element
+ CLaSH.Netlist.BlackBox.Util: setCompName :: Identifier -> BlackBoxTemplate -> BlackBoxTemplate
+ CLaSH.Netlist.Types: [_curCompNm] :: NetlistState -> Identifier
+ CLaSH.Netlist.Types: curCompNm :: Lens' NetlistState Identifier
- CLaSH.Netlist.Types: [NetlistState] :: HashMap TmName (Type, Term) -> Gamma -> Int -> Int -> HashMap TmName Component -> PrimMap -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> NetlistState
+ CLaSH.Netlist.Types: [NetlistState] :: HashMap TmName (Type, Term) -> Gamma -> Int -> Int -> HashMap TmName Component -> PrimMap -> (HashMap TyConName TyCon -> Type -> Maybe (Either String HWType)) -> HashMap TyConName TyCon -> Identifier -> NetlistState

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog for the [`clash-lib`](http://hackage.haskell.org/package/clash-lib) package +## 0.5.4+* New features:+  * Add `~COMPNAME` tag: primitives get access to the component name in which they are instantiated+ ## 0.5.3 *May 5th 2015* * New features:   * `TopEntity` wrappers are now specified as `ANN` annotation pragmas
clash-lib.cabal view
@@ -1,5 +1,5 @@ Name:                 clash-lib-Version:              0.5.3+Version:              0.5.4 Synopsis:             CAES Language for Synchronous Hardware - As a Library Description:   CλaSH (pronounced ‘clash’) is a functional hardware description language that
src/CLaSH/Netlist.hs view
@@ -77,7 +77,7 @@   . (fmap fst . runWriterT)   . runNetlist   where-    s' = NetlistState s HashMap.empty 0 (fromMaybe 0 compCntM) HashMap.empty p typeTrans tcm+    s' = NetlistState s HashMap.empty 0 (fromMaybe 0 compCntM) HashMap.empty p typeTrans tcm Text.empty  -- | Generate a component for a given function (caching) genComponent :: TmName -- ^ Name of the function@@ -109,6 +109,7 @@                      . Text.splitOn (Text.pack ".")                      . Text.pack                      $ name2String compName+  curCompNm .= componentName'    tcm <- Lens.use tcCache   (arguments,binders,result) <- do { normalizedM <- splitNormalized tcm componentExpr
src/CLaSH/Netlist/BlackBox.hs view
@@ -78,7 +78,8 @@          then do            templ'  <- instantiateSym templ            templ'' <- setClocks bbCtx templ'-           return $! templ''+           templ3  <- instantiateCompName templ''+           return $! templ3          else            error $ $(curLoc) ++ "\nCan't match template for " ++ show pNm ++ " :\n" ++ show t ++                    "\nwith context:\n" ++ show bbCtx ++ "\ngiven errors:\n" ++@@ -258,3 +259,9 @@   let (l',i') = setSym i l   varCount .= i'   return l'++instantiateCompName :: BlackBoxTemplate+                    -> NetlistMonad BlackBoxTemplate+instantiateCompName l = do+  nm <- Lens.use curCompNm+  return (setCompName nm l)
src/CLaSH/Netlist/BlackBox/Parser.hs view
@@ -69,6 +69,7 @@      <|> Err Nothing       <$  pToken "~ERRORO"      <|> (Err . Just)      <$> (pToken "~ERROR" *> pBrackets pNatural)      <|> TypElem           <$> (pToken "~TYPEL" *> pBrackets pTagE)+     <|> CompName          <$  pToken "~COMPNAME"      <|> SigD              <$> (pToken "~SIGD" *> pBrackets pTagE) <*> (Just <$> (pBrackets pNatural))      <|> (`SigD` Nothing)  <$> (pToken "~SIGDO" *> pBrackets pTagE) 
src/CLaSH/Netlist/BlackBox/Types.hs view
@@ -20,6 +20,8 @@              | TypM (Maybe Int)  -- ^ Type root hole              | Err (Maybe Int)   -- ^ Error value hole              | TypElem Element   -- ^ Select element type from a vector type+             | CompName          -- ^ Hole for the name of the component in which+                                 -- the blackbox is instantiated              | SigD Element (Maybe Int)   deriving Show 
src/CLaSH/Netlist/BlackBox/Util.hs view
@@ -77,6 +77,12 @@                       _             -> pure e               ) +setCompName :: Identifier -> BlackBoxTemplate -> BlackBoxTemplate+setCompName nm = map setCompName'+  where+    setCompName' CompName = C nm+    setCompName' e        = e+ setClocks :: ( MonadWriter (Set (Identifier,HWType)) m              , Applicative m              )@@ -211,3 +217,4 @@ 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"
src/CLaSH/Netlist/Types.hs view
@@ -47,6 +47,7 @@   , _primitives     :: PrimMap -- ^ Primitive Definitions   , _typeTranslator :: HashMap TyConName TyCon -> Type -> Maybe (Either String HWType) -- ^ Hardcoded Type -> HWType translator   , _tcCache        :: HashMap TyConName TyCon -- ^ TyCon cache+  , _curCompNm      :: Identifier   }  -- | Signal reference
src/CLaSH/Netlist/Util.hs view
@@ -272,11 +272,16 @@ preserveVarEnv :: NetlistMonad a                -> NetlistMonad a preserveVarEnv action = do-  vCnt <- Lens.use varCount-  vEnv <- Lens.use varEnv-  val  <- action-  varCount .= vCnt-  varEnv   .= vEnv+  -- store state+  vCnt  <- Lens.use varCount+  vEnv  <- Lens.use varEnv+  vComp <- Lens.use curCompNm+  -- perform action+  val <- action+  -- restore state+  varCount  .= vCnt+  varEnv    .= vEnv+  curCompNm .= vComp   return val  dcToLiteral :: HWType -> Int -> Expr
src/CLaSH/Normalize/Transformations.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies    #-} {-# LANGUAGE ViewPatterns    #-}  -- | Transformations of the Normalization process