aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Icarus.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/VeriFuzz/Icarus.hs')
-rw-r--r--src/VeriFuzz/Icarus.hs28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/VeriFuzz/Icarus.hs b/src/VeriFuzz/Icarus.hs
index c8bfccd..45e932f 100644
--- a/src/VeriFuzz/Icarus.hs
+++ b/src/VeriFuzz/Icarus.hs
@@ -52,31 +52,27 @@ defaultIcarus = Icarus "iverilog" "vvp"
addDisplay :: [Stmnt] -> [Stmnt]
addDisplay s = concat $ transpose
- [s, replicate l $ TimeCtrl 1 Nothing, replicate l
- . SysTaskEnable $ Task "display" ["%b", Id "y"]]
+ [s, replicate l $ TimeCtrl 1 Nothing, replicate l . SysTaskEnable $ Task "display" ["%b", Id "y"]]
where l = length s
assignFunc :: [Port] -> ByteString -> Stmnt
-assignFunc inp bs =
- NonBlockAssign . Assign conc Nothing . Number (B.length bs * 8) $ bsToI bs
- where
- conc = RegConcat (portToExpr <$> inp)
+assignFunc inp bs = NonBlockAssign . Assign conc Nothing . Number (B.length bs * 8) $ bsToI bs
+ where conc = RegConcat (portToExpr <$> inp)
convert :: Text -> ByteString
convert =
toStrict
- . (encode :: Integer -> L.ByteString)
- . maybe 0 fst
- . listToMaybe
- . readInt 2 (`elem` ("01" :: String)) digitToInt
- . T.unpack
+ . (encode :: Integer -> L.ByteString)
+ . maybe 0 fst
+ . listToMaybe
+ . readInt 2 (`elem` ("01" :: String)) digitToInt
+ . T.unpack
mask :: Text -> Text
mask = T.replace "x" "0"
callback :: ByteString -> Text -> ByteString
-callback b t =
- b <> convert (mask t)
+callback b t = b <> convert (mask t)
runSimIcarus :: Icarus -> ModDecl -> [ByteString] -> Sh ByteString
runSimIcarus sim m bss = do
@@ -99,5 +95,7 @@ runSimIcarusWithFile sim f _ = do
echoP "Icarus: Compile"
_ <- logger dir "icarus" $ run (icarusPath sim) ["-o", "main", toTextIgnore f]
echoP "Icarus: Run"
- B.take 8 . BA.convert . (hash :: ByteString -> Digest SHA256) <$>
- logger dir "vvp" (runFoldLines (mempty :: ByteString) callback (vvpPath sim) ["main"])
+ B.take 8 . BA.convert . (hash :: ByteString -> Digest SHA256) <$> logger
+ dir
+ "vvp"
+ (runFoldLines (mempty :: ByteString) callback (vvpPath sim) ["main"])