packages feed

clashilator 0.1.0 → 0.1.1

raw patch · 3 files changed

+21/−16 lines, 3 filesdep ~Cabaldep ~aesondep ~stache

Dependency ranges changed: Cabal, aeson, stache

Files

README.md view
@@ -3,8 +3,8 @@ This package provides Cabal `Setup.hs` functionality to automatically integrate Verilator into your Clash project. -* Detailed introduction: https://unsafeperform.io/blog/2020-05-07-integrating_verilator_and_clash_via_cabal/-* Example project: https://github.com/gergoerdi/clashilator-example+* Detailed introduction: <https://unsafePerform.IO/blog/2020-05-07-integrating_verilator_and_clash_via_cabal/>+* Example project: <https://github.com/gergoerdi/clashilator-example>  ## Usage @@ -17,12 +17,15 @@     :: "CLK" ::: Clock System     -> "FOO" ::: Signal System Bit     -> "BAR" ::: Signal System (Unsigned 4)-    -> ("BAZ" ::: Signal System (Unsigned 10), "QUUX" ::: Signal System Bit)+    -> ( "BAZ"  ::: Signal System (Unsigned 10)+       , "QUUX" ::: Signal System Bit+       ) topEntity = ... makeTopEntity 'topEntity ``` -and you put this in your Cabal file:+and you put this in your Cabal file (`x-clashilator-clock` can be+omitted if you have only a single clock):  ``` custom-setup
clashilator.cabal view
@@ -3,11 +3,9 @@ -- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 2a7cd4d926c1778ae4d73a15781b9025b1afc514077e52df91e0841f7543c1f8  name:           clashilator-version:        0.1.0+version:        0.1.1 synopsis:       Automated Clash to Verilator bridge description:    Code generator and @Setup.hs@ hooks to generate a Verilator simulation and access it from Clash category:       Hardware, Development@@ -41,8 +39,8 @@       src   ghc-options: -Wunused-imports   build-depends:-      Cabal >=3.2.1.0-    , aeson+      Cabal >=3.2.1 && <3.3+    , aeson >=1.5 && <1.6 || >=2.0 && <2.1     , base >=4.14 && <5     , clash-ghc >=1.4.2 && <1.5     , clash-lib >=1.4.2 && <1.5@@ -52,7 +50,7 @@     , lens     , optparse-applicative     , shake-    , stache+    , stache ==2.3.*     , text     , unordered-containers   default-language: Haskell2010@@ -68,8 +66,8 @@       src   ghc-options: -Wunused-imports   build-depends:-      Cabal >=3.2.1.0-    , aeson+      Cabal >=3.2.1 && <3.3+    , aeson >=1.5 && <1.6 || >=2.0 && <2.1     , base >=4.14 && <5     , clash-ghc >=1.4.2 && <1.5     , clash-lib >=1.4.2 && <1.5@@ -79,7 +77,7 @@     , lens     , optparse-applicative     , shake-    , stache+    , stache ==2.3.*     , text     , unordered-containers   default-language: Haskell2010
src/Clash/Clashilator.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE RecordWildCards, OverloadedStrings, ViewPatterns #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TemplateHaskell, CPP #-} module Clash.Clashilator (generateFiles) where  import Clash.Driver.Manifest@@ -17,7 +17,11 @@ import Text.Mustache import qualified Text.Mustache.Compile.TH as TH import Data.Aeson hiding (Options)-import qualified Data.HashMap.Strict as H+#if MIN_VERSION_aeson(2, 0, 0)+import qualified Data.Aeson.KeyMap as Aeson+#else+import qualified Data.HashMap.Strict as Aeson+#endif  data Port = Port Text Int     deriving Show@@ -97,7 +101,7 @@ markEnds [] = [] markEnds (v:vs) = markStart v : vs   where-    markStart (Object o) = Object $ o <> H.fromList [ "first" .= True ]+    markStart (Object o) = Object $ o <> Aeson.fromList [ "first" .= True ]  templates =     [ ("src/Interface.h", $(TH.compileMustacheFile "template/Interface.h.mustache"))