aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Simulator/General.hs
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2019-02-01 19:39:52 +0000
committerYann Herklotz <ymherklotz@gmail.com>2019-02-01 19:39:52 +0000
commit1067284cc1f6ca8ba646545c5b8d0a79cc2e41ad (patch)
tree2c9a8d54bf6f9870f0ae62c150803ccec90d46e7 /src/VeriFuzz/Simulator/General.hs
parenta38289ca9d96e97bc4e65b67c50f5805d56a3d86 (diff)
downloadverismith-1067284cc1f6ca8ba646545c5b8d0a79cc2e41ad.tar.gz
verismith-1067284cc1f6ca8ba646545c5b8d0a79cc2e41ad.zip
More restructuring
Diffstat (limited to 'src/VeriFuzz/Simulator/General.hs')
-rw-r--r--src/VeriFuzz/Simulator/General.hs70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/VeriFuzz/Simulator/General.hs b/src/VeriFuzz/Simulator/General.hs
deleted file mode 100644
index dbd1da0..0000000
--- a/src/VeriFuzz/Simulator/General.hs
+++ /dev/null
@@ -1,70 +0,0 @@
-{-|
-Module : VeriFuzz.Simulator.General
-Description : Class of the simulator.
-Copyright : (c) 2018-2019, Yann Herklotz Grave
-License : BSD-3
-Maintainer : ymherklotz [at] gmail [dot] com
-Stability : experimental
-Portability : POSIX
-
-Class of the simulator and the synthesize tool.
--}
-
-module VeriFuzz.Simulator.General where
-
-import Data.Bits (shiftL)
-import Data.ByteString (ByteString)
-import qualified Data.ByteString as B
-import Data.Text (Text)
-import qualified Data.Text as T
-import Prelude hiding (FilePath)
-import Shelly
-import System.FilePath.Posix (takeBaseName)
-import VeriFuzz.Verilog.AST
-
--- | Simulator class.
-class Simulator a where
- toText :: a -> Text
-
--- | Simulation type class.
-class (Simulator a) => Simulate a where
- runSim :: a -- ^ Simulator instance
- -> ModDecl -- ^ Module to simulate
- -> [ByteString] -- ^ Inputs to simulate
- -> Sh Int -- ^ Returns the value of the hash at the output of the testbench.
-
--- | Synthesize type class.
-class (Simulator a) => Synthesize a where
- runSynth :: a -- ^ Synthesize tool instance
- -> ModDecl -- ^ Module to synthesize
- -> FilePath -- ^ Output verilog file for the module
- -> Sh () -- ^ does not return any values
-
-rootPath :: Sh FilePath
-rootPath = do
- current <- pwd
- maybe current fromText <$> get_env "VERIFUZZ_ROOT"
-
-timeout :: FilePath -> [Text] -> Sh Text
-timeout = command1 "timeout" ["180"] . toTextIgnore
-{-# INLINE timeout #-}
-
-timeout_ :: FilePath -> [Text] -> Sh ()
-timeout_ = command1_ "timeout" ["180"] . toTextIgnore
-{-# INLINE timeout_ #-}
-
--- | Helper function to convert bytestrings to integers
-bsToI :: ByteString -> Integer
-bsToI = B.foldl' (\i b -> (i `shiftL` 8) + fromIntegral b) 0
-{-# INLINE bsToI #-}
-
-noPrint :: Sh a -> Sh a
-noPrint =
- print_stdout False . print_stderr False
-
-echoP :: Text -> Sh ()
-echoP t = do
- fn <- pwd
- echo $ bname fn <> " :: " <> t
- where
- bname = T.pack . takeBaseName . T.unpack . toTextIgnore