aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Herklotz Grave <git@yannherklotzgrave.com>2019-03-01 12:31:05 +0000
committerYann Herklotz Grave <git@yannherklotzgrave.com>2019-03-01 12:31:05 +0000
commit833f140005b70ce54a462a38bb9ecb04321b135f (patch)
treed06481169a7c0283ecdc9f320894baddb5194722 /src
parent1f05f1050389917edeb64c0b32391da2f8ebe40b (diff)
downloadverismith-833f140005b70ce54a462a38bb9ecb04321b135f.tar.gz
verismith-833f140005b70ce54a462a38bb9ecb04321b135f.zip
Add Simulation and Synthesis environments
Diffstat (limited to 'src')
-rw-r--r--src/VeriFuzz/Env.hs43
1 files changed, 31 insertions, 12 deletions
diff --git a/src/VeriFuzz/Env.hs b/src/VeriFuzz/Env.hs
index c50be25..b7cfae0 100644
--- a/src/VeriFuzz/Env.hs
+++ b/src/VeriFuzz/Env.hs
@@ -12,22 +12,41 @@ Environment to run the simulator and synthesisers in a matrix.
module VeriFuzz.Env where
-import Control.Monad.Trans.Reader
-import Prelude hiding (FilePath)
+import Prelude hiding (FilePath)
import Shelly
import VeriFuzz.Icarus
+import VeriFuzz.Internal
import VeriFuzz.XST
import VeriFuzz.Yosys
--- | Environment used to run the main
-data SimMatrix = SimMatrix { yosys :: Yosys
- , xst :: Maybe Xst
- , icarus :: Maybe Icarus
- }
+data SynthTool = XstSynth {-# UNPACK #-} !Xst
+ | YosysSynth {-# UNPACK #-} !Yosys
+ deriving (Eq, Show)
+
+instance Tool SynthTool where
+ toText (XstSynth xst) = toText xst
+ toText (YosysSynth yosys) = toText yosys
+
+instance Synthesisor SynthTool where
+ runSynth (XstSynth xst) = runSynth xst
+ runSynth (YosysSynth yosys) = runSynth yosys
+
+newtype SimTool = IcarusSim Icarus
+ deriving (Eq, Show)
+
+instance Tool SimTool where
+ toText (IcarusSim icarus) = toText icarus
+
+instance Simulator SimTool where
+ runSim (IcarusSim icarus) = runSim icarus
+ runSimWithFile (IcarusSim icarus) = runSimWithFile icarus
+
+data SimEnv = SimEnv { simTools :: [SimTool]
+ , simDir :: FilePath
+ }
+
+data SynthEnv = SynthEnv { synthTools :: [SynthTool]
+ , synthDir :: FilePath
+ }
-type SimEnv = ReaderT SimMatrix IO
-runAll :: SimEnv ()
-runAll = do
- _ <- asks xst
- shelly $ run_ "echo" ["Hello World"]