From fd4b0b5152f94cd406f2e5de86ce7ed0a4d2cbd0 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 2 Apr 2019 19:47:32 +0100 Subject: Large refactor with passing tests --- src/VeriFuzz/Sim/Env.hs | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/VeriFuzz/Sim/Env.hs (limited to 'src/VeriFuzz/Sim/Env.hs') diff --git a/src/VeriFuzz/Sim/Env.hs b/src/VeriFuzz/Sim/Env.hs new file mode 100644 index 0000000..187afb3 --- /dev/null +++ b/src/VeriFuzz/Sim/Env.hs @@ -0,0 +1,58 @@ +{-| +Module : VeriFuzz.Sim.Env +Description : Environment to run the simulator and synthesisers in a matrix. +Copyright : (c) 2019, Yann Herklotz +License : GPL-3 +Maintainer : ymherklotz [at] gmail [dot] com +Stability : experimental +Portability : POSIX + +Environment to run the simulator and synthesisers in a matrix. +-} + +module VeriFuzz.Sim.Env + ( SynthTool(..) + , SimTool(..) + , SimEnv(..) + , SynthEnv(..) + ) +where + +import Prelude hiding (FilePath) +import Shelly +import VeriFuzz.Sim.Icarus +import VeriFuzz.Sim.Internal +import VeriFuzz.Sim.XST +import VeriFuzz.Sim.Yosys + +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 + } + + -- cgit