aboutsummaryrefslogtreecommitdiffstats
path: root/src/VeriFuzz/Env.hs
blob: 6448bdfbc9bca2c2415a6d3340ffeb9faec5eed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{-|
Module      : VeriFuzz.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.Env where

import           Prelude           hiding (FilePath)
import           Shelly
import           VeriFuzz.Icarus
import           VeriFuzz.Internal
import           VeriFuzz.XST
import           VeriFuzz.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
                         }