aboutsummaryrefslogtreecommitdiffstats
path: root/src/Verismith/Tool
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-05-11 18:29:06 +0100
committerYann Herklotz <git@yannherklotz.com>2020-05-11 18:29:06 +0100
commit805f67c07cc15d784078b00a84f4055f84016cec (patch)
tree15c93eb5102e3813515d41204deb3f86f78f1994 /src/Verismith/Tool
parent54bb059ab6955f58f4a4b95cdd080775a56bc793 (diff)
downloadverismith-805f67c07cc15d784078b00a84f4055f84016cec.tar.gz
verismith-805f67c07cc15d784078b00a84f4055f84016cec.zip
Fix types with annotations
Diffstat (limited to 'src/Verismith/Tool')
-rw-r--r--src/Verismith/Tool/Icarus.hs9
-rw-r--r--src/Verismith/Tool/Identity.hs2
-rw-r--r--src/Verismith/Tool/Internal.hs10
-rw-r--r--src/Verismith/Tool/Quartus.hs2
-rw-r--r--src/Verismith/Tool/QuartusLight.hs2
-rw-r--r--src/Verismith/Tool/Template.hs2
-rw-r--r--src/Verismith/Tool/Vivado.hs2
-rw-r--r--src/Verismith/Tool/XST.hs2
-rw-r--r--src/Verismith/Tool/Yosys.hs8
9 files changed, 21 insertions, 18 deletions
diff --git a/src/Verismith/Tool/Icarus.hs b/src/Verismith/Tool/Icarus.hs
index 0fb2146..4b91652 100644
--- a/src/Verismith/Tool/Icarus.hs
+++ b/src/Verismith/Tool/Icarus.hs
@@ -103,7 +103,7 @@ mask = T.replace "x" "0"
callback :: ByteString -> Text -> ByteString
callback b t = b <> convert (mask t)
-runSimIcarus :: Icarus -> (SourceInfo ann) -> [ByteString] -> ResultSh ByteString
+runSimIcarus :: Show ann => Icarus -> (SourceInfo ann) -> [ByteString] -> ResultSh ByteString
runSimIcarus sim rinfo bss = do
let tb = ModDecl
"main"
@@ -159,7 +159,8 @@ counterTestBench (CounterEg _ states) m = tbModule filtered m
where
filtered = convert . fold . fmap snd . filter ((/= "clk") . fst) <$> states
-runSimIc' :: (Synthesiser b) => ([ByteString] -> (ModDecl ann) -> (Verilog ann))
+runSimIc' :: (Synthesiser b, Show ann)
+ => ([ByteString] -> (ModDecl ann) -> (Verilog ann))
-> FilePath
-> Icarus
-> b
@@ -194,7 +195,7 @@ runSimIc' fun datadir sim1 synth1 srcInfo bss bs = do
tbname = fromText $ toText synth1 <> "_testbench.v"
exename = toText synth1 <> "_main"
-runSimIc :: (Synthesiser b)
+runSimIc :: (Synthesiser b, Show ann)
=> FilePath -- ^ Data directory.
-> Icarus -- ^ Icarus simulator.
-> b -- ^ Synthesis tool to be tested.
@@ -206,6 +207,6 @@ runSimIc :: (Synthesiser b)
-> ResultSh ByteString
runSimIc = runSimIc' tbModule
-runSimIcEC :: (Synthesiser b) => FilePath -> Icarus -> b
+runSimIcEC :: (Synthesiser b, Show ann) => FilePath -> Icarus -> b
-> (SourceInfo ann) -> CounterEg -> Maybe ByteString -> ResultSh ByteString
runSimIcEC a b c d e = runSimIc' (const $ counterTestBench e) a b c d []
diff --git a/src/Verismith/Tool/Identity.hs b/src/Verismith/Tool/Identity.hs
index 8f6901f..804f096 100644
--- a/src/Verismith/Tool/Identity.hs
+++ b/src/Verismith/Tool/Identity.hs
@@ -44,7 +44,7 @@ instance Synthesiser Identity where
instance NFData Identity where
rnf = rwhnf
-runSynthIdentity :: Identity -> (SourceInfo ann) -> ResultSh ()
+runSynthIdentity :: Show ann => Identity -> (SourceInfo ann) -> ResultSh ()
runSynthIdentity (Identity _ out) = writefile out . genSource
defaultIdentity :: Identity
diff --git a/src/Verismith/Tool/Internal.hs b/src/Verismith/Tool/Internal.hs
index 77ec4c9..f462c74 100644
--- a/src/Verismith/Tool/Internal.hs
+++ b/src/Verismith/Tool/Internal.hs
@@ -65,9 +65,10 @@ class Tool a where
-- | Simulation type class.
class Tool a => Simulator a where
- runSim :: a -- ^ Simulator instance
- -> SourceInfo ann -- ^ Run information
- -> [ByteString] -- ^ Inputs to simulate
+ runSim :: Show ann
+ => a -- ^ Simulator instance
+ -> SourceInfo ann -- ^ Run information
+ -> [ByteString] -- ^ Inputs to simulate
-> ResultSh ByteString -- ^ Returns the value of the hash at the output of the testbench.
runSimWithFile :: a
-> FilePath
@@ -99,7 +100,8 @@ instance Monoid Failed where
-- | Synthesiser type class.
class Tool a => Synthesiser a where
- runSynth :: a -- ^ Synthesiser tool instance
+ runSynth :: Show ann
+ => a -- ^ Synthesiser tool instance
-> SourceInfo ann -- ^ Run information
-> ResultSh () -- ^ does not return any values
synthOutput :: a -> FilePath
diff --git a/src/Verismith/Tool/Quartus.hs b/src/Verismith/Tool/Quartus.hs
index e6624eb..ff8a62b 100644
--- a/src/Verismith/Tool/Quartus.hs
+++ b/src/Verismith/Tool/Quartus.hs
@@ -49,7 +49,7 @@ instance NFData Quartus where
defaultQuartus :: Quartus
defaultQuartus = Quartus Nothing "quartus" "syn_quartus.v"
-runSynthQuartus :: Quartus -> (SourceInfo ann) -> ResultSh ()
+runSynthQuartus :: Show ann => Quartus -> (SourceInfo ann) -> ResultSh ()
runSynthQuartus sim (SourceInfo top src) = do
dir <- liftSh pwd
let ex = execute_ SynthFail dir "quartus"
diff --git a/src/Verismith/Tool/QuartusLight.hs b/src/Verismith/Tool/QuartusLight.hs
index f703da0..cdf2636 100644
--- a/src/Verismith/Tool/QuartusLight.hs
+++ b/src/Verismith/Tool/QuartusLight.hs
@@ -49,7 +49,7 @@ instance NFData QuartusLight where
defaultQuartusLight :: QuartusLight
defaultQuartusLight = QuartusLight Nothing "quartus" "syn_quartus.v"
-runSynthQuartusLight :: QuartusLight -> (SourceInfo ann) -> ResultSh ()
+runSynthQuartusLight :: Show ann => QuartusLight -> (SourceInfo ann) -> ResultSh ()
runSynthQuartusLight sim (SourceInfo top src) = do
dir <- liftSh pwd
let ex = execute_ SynthFail dir "quartus"
diff --git a/src/Verismith/Tool/Template.hs b/src/Verismith/Tool/Template.hs
index a2e0675..5a20ff5 100644
--- a/src/Verismith/Tool/Template.hs
+++ b/src/Verismith/Tool/Template.hs
@@ -172,7 +172,7 @@ sbyConfig mt datadir sim1 sim2 (SourceInfo top _) = T.unlines
<$> deps
readL = T.intercalate "\n" $ mappend "read -formal " <$> deps
-icarusTestbench :: (Synthesiser a) => FilePath -> (Verilog ann) -> a -> Text
+icarusTestbench :: (Synthesiser a, Show ann) => FilePath -> (Verilog ann) -> a -> Text
icarusTestbench datadir t synth1 = T.unlines
[ "`include \"" <> ddir <> "/data/cells_cmos.v\""
, "`include \"" <> ddir <> "/data/cells_cyclone_v.v\""
diff --git a/src/Verismith/Tool/Vivado.hs b/src/Verismith/Tool/Vivado.hs
index 35cda2e..ef8b1b7 100644
--- a/src/Verismith/Tool/Vivado.hs
+++ b/src/Verismith/Tool/Vivado.hs
@@ -49,7 +49,7 @@ instance NFData Vivado where
defaultVivado :: Vivado
defaultVivado = Vivado Nothing "vivado" "syn_vivado.v"
-runSynthVivado :: Vivado -> (SourceInfo ann) -> ResultSh ()
+runSynthVivado :: Show ann => Vivado -> (SourceInfo ann) -> ResultSh ()
runSynthVivado sim (SourceInfo top src) = do
dir <- liftSh pwd
liftSh $ do
diff --git a/src/Verismith/Tool/XST.hs b/src/Verismith/Tool/XST.hs
index 1e37149..213fae8 100644
--- a/src/Verismith/Tool/XST.hs
+++ b/src/Verismith/Tool/XST.hs
@@ -51,7 +51,7 @@ instance NFData XST where
defaultXST :: XST
defaultXST = XST Nothing "xst" "syn_xst.v"
-runSynthXST :: XST -> (SourceInfo ann) -> ResultSh ()
+runSynthXST :: Show ann => XST -> (SourceInfo ann) -> ResultSh ()
runSynthXST sim (SourceInfo top src) = do
dir <- liftSh pwd
let exec n = execute_
diff --git a/src/Verismith/Tool/Yosys.hs b/src/Verismith/Tool/Yosys.hs
index 24b83fd..f68f39f 100644
--- a/src/Verismith/Tool/Yosys.hs
+++ b/src/Verismith/Tool/Yosys.hs
@@ -63,7 +63,7 @@ defaultYosys = Yosys Nothing "yosys" "syn_yosys.v"
yosysPath :: Yosys -> FilePath
yosysPath sim = maybe (S.fromText "yosys") (</> S.fromText "yosys") $ yosysBin sim
-runSynthYosys :: Yosys -> (SourceInfo ann) -> ResultSh ()
+runSynthYosys :: Show ann => Yosys -> (SourceInfo ann) -> ResultSh ()
runSynthYosys sim (SourceInfo _ src) = do
dir <- liftSh $ do
dir' <- S.pwd
@@ -83,7 +83,7 @@ runSynthYosys sim (SourceInfo _ src) = do
out = S.toTextIgnore $ synthOutput sim
runEquivYosys
- :: (Synthesiser a, Synthesiser b)
+ :: (Synthesiser a, Synthesiser b, Show ann)
=> Yosys
-> a
-> b
@@ -103,8 +103,8 @@ runEquivYosys yosys sim1 sim2 srcInfo = do
liftSh $ S.run_ (yosysPath yosys) [S.toTextIgnore checkFile]
where checkFile = S.fromText $ "test." <> toText sim1 <> "." <> toText sim2 <> ".ys"
-runEquiv
- :: (Synthesiser a, Synthesiser b) => Maybe Text -> FilePath -> a -> b -> (SourceInfo ann) -> ResultSh ()
+runEquiv :: (Synthesiser a, Synthesiser b, Show ann)
+ => Maybe Text -> FilePath -> a -> b -> (SourceInfo ann) -> ResultSh ()
runEquiv mt datadir sim1 sim2 srcInfo = do
dir <- liftSh S.pwd
liftSh $ do