packages feed

clash-lib 0.99 → 0.99.1

raw patch · 10 files changed

+47/−4 lines, 10 filesdep ~aesondep ~errorsPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: aeson, errors

API changes (from Hackage documentation)

- Clash.Rewrite.Types: instance Control.Monad.Writer.Class.MonadWriter Data.Monoid.Any (Clash.Rewrite.Types.RewriteMonad extra)
+ Clash.Backend: hdlRecSel :: Backend state => HWType -> Int -> Mon (State state) Doc
+ Clash.Netlist.BlackBox.Types: Sel :: !Element -> !Int -> Element
+ Clash.Rewrite.Types: instance Control.Monad.Writer.Class.MonadWriter Data.Semigroup.Internal.Any (Clash.Rewrite.Types.RewriteMonad extra)
+ Clash.Util: (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
+ Clash.Util: (<$>) :: Functor f => a -> b -> f a -> f b
+ Clash.Util: (<*>) :: Applicative f => f a -> b -> f a -> f b
+ Clash.Util: (<=<) :: Monad m => b -> m c -> a -> m b -> a -> m c
+ Clash.Util: (>=>) :: Monad m => a -> m b -> b -> m c -> a -> m c
+ Clash.Util: class Functor f => Applicative (f :: * -> *)
+ Clash.Util: first :: Arrow a => a b c -> a (b, d) (c, d)
+ Clash.Util: infixl 0 `on`
+ Clash.Util: infixl 4 <$>
+ Clash.Util: infixr 1 >=>
+ Clash.Util: infixr 3 ***
+ Clash.Util: on :: () => b -> b -> c -> a -> b -> a -> a -> c
+ Clash.Util: pure :: Applicative f => a -> f a
+ Clash.Util: second :: Arrow a => a b c -> a (d, b) (d, c)
- Clash.Driver.Types: data SrcSpan :: *
+ Clash.Driver.Types: data SrcSpan
- Clash.Netlist.Types: NetlistState :: BindingMap -> !Int -> HashMap TmOccName (SrcSpan, Component) -> PrimMap BlackBoxTemplate -> (HashMap TyConOccName TyCon -> Bool -> Type -> Maybe (Either String HWType)) -> HashMap TyConOccName TyCon -> !(Identifier, SrcSpan) -> [(String, FilePath)] -> Int -> (IdType -> Identifier -> Identifier) -> (IdType -> Identifier -> Identifier -> Identifier) -> [Identifier] -> [Identifier] -> HashMap TmOccName Identifier -> HashMap TmOccName (Type, Maybe TopEntity) -> FilePath -> NetlistState
+ Clash.Netlist.Types: NetlistState :: BindingMap -> !Int -> HashMap TmOccName (SrcSpan, Component) -> PrimMap BlackBoxTemplate -> HashMap TyConOccName TyCon -> Bool -> Type -> Maybe (Either String HWType) -> HashMap TyConOccName TyCon -> !(Identifier, SrcSpan) -> [(String, FilePath)] -> Int -> IdType -> Identifier -> Identifier -> IdType -> Identifier -> Identifier -> Identifier -> [Identifier] -> [Identifier] -> HashMap TmOccName Identifier -> HashMap TmOccName (Type, Maybe TopEntity) -> FilePath -> NetlistState
- Clash.Rewrite.Types: R :: (RewriteEnv -> RewriteState extra -> (a, RewriteState extra, Any)) -> RewriteMonad extra a
+ Clash.Rewrite.Types: R :: RewriteEnv -> RewriteState extra -> (a, RewriteState extra, Any) -> RewriteMonad extra a
- Clash.Rewrite.Types: RewriteEnv :: DebugLevel -> (HashMap TyConOccName TyCon -> Bool -> Type -> Maybe (Either String HWType)) -> HashMap TyConOccName TyCon -> IntMap TyConName -> PrimEvaluator -> Bool -> HashSet TmOccName -> RewriteEnv
+ Clash.Rewrite.Types: RewriteEnv :: DebugLevel -> HashMap TyConOccName TyCon -> Bool -> Type -> Maybe (Either String HWType) -> HashMap TyConOccName TyCon -> IntMap TyConName -> PrimEvaluator -> Bool -> HashSet TmOccName -> RewriteEnv
- Clash.Rewrite.Types: bindings :: forall extra_a46c3. Lens' (RewriteState extra_a46c3) BindingMap
+ Clash.Rewrite.Types: bindings :: forall extra_a4151. Lens' (RewriteState extra_a4151) BindingMap
- Clash.Rewrite.Types: curFun :: forall extra_a46c3. Lens' (RewriteState extra_a46c3) (TmName, SrcSpan)
+ Clash.Rewrite.Types: curFun :: forall extra_a4151. Lens' (RewriteState extra_a4151) (TmName, SrcSpan)
- Clash.Rewrite.Types: extra :: forall extra_a46c3 extra_a46gN. Lens (RewriteState extra_a46c3) (RewriteState extra_a46gN) extra_a46c3 extra_a46gN
+ Clash.Rewrite.Types: extra :: forall extra_a4151 extra_a419F. Lens (RewriteState extra_a4151) (RewriteState extra_a419F) extra_a4151 extra_a419F
- Clash.Rewrite.Types: nameCounter :: forall extra_a46c3. Lens' (RewriteState extra_a46c3) Int
+ Clash.Rewrite.Types: nameCounter :: forall extra_a4151. Lens' (RewriteState extra_a4151) Int
- Clash.Rewrite.Types: transformCounter :: forall extra_a46c3. Lens' (RewriteState extra_a46c3) Int
+ Clash.Rewrite.Types: transformCounter :: forall extra_a4151. Lens' (RewriteState extra_a4151) Int
- Clash.Rewrite.Types: uniqSupply :: forall extra_a46c3. Lens' (RewriteState extra_a46c3) Supply
+ Clash.Rewrite.Types: uniqSupply :: forall extra_a4151. Lens' (RewriteState extra_a4151) Supply

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Changelog for the [`clash-lib`](http://hackage.haskell.org/package/clash-lib) package +## 0.99.1 *May 12th 2018*+* Allow `~NAME[N]` tag inside `~GENSYM[X]`+* Support HDL record selector generation [#313](https://github.com/clash-lang/clash-compiler/pull/313)+ ## 0.99 *March 31st 2018* * New features:   * Support for `clash-prelude-0.99`:
clash-lib.cabal view
@@ -1,5 +1,5 @@ Name:                 clash-lib-Version:              0.99+Version:              0.99.1 Synopsis:             CAES Language for Synchronous Hardware - As a Library Description:   CλaSH (pronounced ‘clash’) is a functional hardware description language that@@ -96,7 +96,7 @@                       TupleSections                       ViewPatterns -  Build-depends:      aeson                   >= 0.6.2.0  && < 1.3,+  Build-depends:      aeson                   >= 0.6.2.0  && < 1.4,                       ansi-wl-pprint          >= 0.6.8.2  && < 1.0,                       attoparsec              >= 0.10.4.0 && < 0.14,                       base                    >= 4.8      && < 5,@@ -107,7 +107,7 @@                       data-binary-ieee754     >= 0.4.4    && < 0.6,                       deepseq                 >= 1.3.0.2  && < 1.5,                       directory               >= 1.2.0.1  && < 1.4,-                      errors                  >= 1.4.2    && < 2.3,+                      errors                  >= 1.4.2    && < 2.4,                       fgl                     >= 5.4.2.4  && < 5.7,                       filepath                >= 1.3.0.1  && < 1.5,                       ghc                     >= 8.0.2    && < 8.6,
src/Clash/Backend.hs view
@@ -65,6 +65,8 @@   hdlTypeErrValue  :: HWType       -> Mon (State state) Doc   -- | Convert a Netlist HWType to the root of a target HDL type   hdlTypeMark      :: HWType       -> Mon (State state) Doc+  -- | Create a record selector+  hdlRecSel        :: HWType -> Int -> Mon (State state) Doc   -- | Create a signal declaration from an identifier (Text) and Netlist HWType   hdlSig           :: Text -> HWType -> Mon (State state) Doc   -- | Create a generative block statement marker
src/Clash/Backend/SystemVerilog.hs view
@@ -99,6 +99,7 @@   hdlType _       = verilogType   hdlTypeErrValue = verilogTypeErrValue   hdlTypeMark     = verilogTypeMark+  hdlRecSel       = verilogRecSel   hdlSig t ty     = sigDecl (string t) ty   genStmt True    = do cnt <- use genDepth                        genDepth += 1@@ -630,6 +631,12 @@     _ -> char '\'' <> braces (int (2^n) <+> braces (verilogTypeErrValue elTy)) verilogTypeErrValue String = "\"ERROR\"" verilogTypeErrValue ty  = braces (int (typeSize ty) <+> braces "1'bx")++verilogRecSel+  :: HWType+  -> Int+  -> SystemVerilogM Doc+verilogRecSel ty i = tyName ty <> "_sel" <> int i  decls :: [Declaration] -> SystemVerilogM Doc decls [] = emptyDoc
src/Clash/Backend/VHDL.hs view
@@ -97,6 +97,7 @@     _           -> vhdlType ty   hdlTypeErrValue = vhdlTypeErrValue   hdlTypeMark     = vhdlTypeMark+  hdlRecSel       = vhdlRecSel   hdlSig t ty     = sigDecl (pretty t) ty   genStmt         = const emptyDoc   inst            = inst_@@ -705,6 +706,12 @@ vhdlTypeErrValue (Void {})           = "std_logic_vector'(0 downto 1 => '-')" vhdlTypeErrValue String              = "\"ERROR\"" vhdlTypeErrValue t                   = vhdlTypeMark t <> "'" <> parens (int 0 <+> "to" <+> int (typeSize t - 1) <+> rarrow <+> "'-'")++vhdlRecSel+  :: HWType+  -> Int+  -> VHDLM Doc+vhdlRecSel ty i = tyName ty <> "_sel" <> int i  decls :: [Declaration] -> VHDLM Doc decls [] = emptyDoc
src/Clash/Backend/Verilog.hs view
@@ -90,6 +90,7 @@   hdlType _       = verilogType   hdlTypeErrValue = verilogTypeErrValue   hdlTypeMark     = verilogTypeMark+  hdlRecSel       = verilogRecSel   hdlSig t ty     = sigDecl (string t) ty   genStmt True    = do cnt <- use genDepth                        genDepth += 1@@ -295,6 +296,14 @@ -- | Convert a Netlist HWType to an error VHDL value for that type verilogTypeErrValue :: HWType -> VerilogM Doc verilogTypeErrValue ty = braces (int (typeSize ty) <+> braces "1'bx")++verilogRecSel+  :: HWType+  -> Int+  -> VerilogM Doc+verilogRecSel ty i = case modifier 0 (Indexed (ty,0,i)) of+  Just (start,end) -> brackets (int start <> colon <> int end)+  _ -> error "Can't make a record selector"  decls :: [Declaration] -> VerilogM Doc decls [] = emptyDoc
src/Clash/Netlist/BlackBox/Parser.hs view
@@ -98,6 +98,7 @@      <|> (HdlSyn Other)    <$  string "~OTHERSYN"      <|> (BV True)         <$> (string "~TOBV" *> brackets' pSigD) <*> brackets' pTagE      <|> (BV False)        <$> (string "~FROMBV" *> brackets' pSigD) <*> brackets' pTagE+     <|> Sel               <$> (string "~SEL" *> brackets' pTagE) <*> brackets' natural'      <|> IsLit             <$> (string "~ISLIT" *> brackets' natural')      <|> IsVar             <$> (string "~ISVAR" *> brackets' natural')      <|> IsGated           <$> (string "~ISGATED" *> brackets' natural')
src/Clash/Netlist/BlackBox/Types.hs view
@@ -47,6 +47,7 @@              | HdlSyn HdlSyn     -- ^ Hole indicating which synthesis tool we're                                  -- generating HDL for              | BV !Bool [Element] !Element -- ^ Convert to (True)/from(False) a bit-vector+             | Sel !Element !Int -- ^ Record selector of a type              | IsLit !Int              | IsVar !Int              | IsGated !Int
src/Clash/Netlist/BlackBox/Util.hs view
@@ -139,6 +139,9 @@             . map (\case { C t -> t                          ; O _ | Identifier t _ <- fst (bbResult bbCtx)                                -> t+                         ; N n | let (e,_,_) = bbInputs bbCtx !! n+                               , Just t <- exprToText e+                               -> t                          ; _   -> error "unexpected element in GENSYM"})  setCompName :: Identifier -> BlackBoxTemplate -> BlackBoxTemplate@@ -427,6 +430,10 @@   let ty = lineToType b [e]   renderOneLine <$> getMon (fromBV ty e') +renderTag b (Sel e n) =+  let ty = lineToType b [e]+  in  renderOneLine <$> getMon (hdlRecSel ty n)+ renderTag b (Typ Nothing)   = fmap renderOneLine . getMon . hdlType Internal . snd $ bbResult b renderTag b (Typ (Just n))  = let (_,ty,_) = bbInputs b !! n                               in  renderOneLine <$> getMon (hdlType Internal ty)@@ -574,6 +581,9 @@     if b        then string "~TOBV" <> brackets (string es') <> brackets (string e')        else string "~FROMBV" <> brackets (string es') <> brackets (string e')+prettyElem (Sel e i) = do+  e' <- prettyElem e+  renderOneLine <$> (string "~SEL" <> brackets (string e') <> brackets (int i)) prettyElem (IsLit i) = renderOneLine <$> (string "~ISLIT" <> brackets (int i)) prettyElem (IsVar i) = renderOneLine <$> (string "~ISVAR" <> brackets (int i)) prettyElem (IsGated i) = renderOneLine <$> (string "~ISGATED" <> brackets (int i))@@ -609,4 +619,5 @@       SigD es _ -> usedArguments es       BV _ es _ -> usedArguments es       StrCmp _ i -> [i]+      GenSym es _ -> usedArguments es       _ -> []
src/Clash/Primitives/Types.hs view
@@ -38,7 +38,8 @@   , imports  :: [a]     -- ^ VHDL only: add /use/ declarations for the given names   , include :: Maybe ((S.Text,S.Text),a)-    -- ^ Intel/Quartus only: create a /.qsys/ file from the given template.+    -- ^ Create a file to be included with the generated primitive. The fields+    -- are ((name, extension), content), where content is a template of the file     -- Defaults to @Nothing@ when not specified in the /.json/ file   , template :: !(Either a a) -- ^ Either a /declaration/ or an /expression/ template.   }