blob: 01604317b850cba4e68895ac4fd23a4f390c6994 (
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
|
{-|
Module : VeriFuzz.Sim.Identity
Description : The identity simulator and synthesiser.
Copyright : (c) 2019, Yann Herklotz Grave
License : GPL-3
Maintainer : ymherklotz [at] gmail [dot] com
Stability : experimental
Portability : POSIX
The identity simulator and synthesiser.
-}
module VeriFuzz.Sim.Identity where
import Control.DeepSeq (NFData, rnf, rwhnf)
import Data.Text (Text, unpack)
import Prelude hiding (FilePath)
import Shelly (FilePath)
import Shelly.Lifted (writefile)
import VeriFuzz.Sim.Internal
import VeriFuzz.Verilog.AST
import VeriFuzz.Verilog.CodeGen
data Identity = Identity { identityDesc :: {-# UNPACK #-} !Text
, identityOutput :: {-# UNPACK #-} !FilePath
}
instance Tool Identity where
toText (Identity d _) = d
instance Show Identity where
show t = unpack $ toText t
instance Synthesiser Identity where
runSynth = runSynthIdentity
synthOutput = identityOutput
setSynthOutput (Identity a _) = Identity a
instance NFData Identity where
rnf = rwhnf
runSynthIdentity :: Identity -> SourceInfo -> ResultSh ()
runSynthIdentity (Identity _ out) src =
writefile out $ genSource src
|