aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2021-05-21 18:29:44 +0100
committerYann Herklotz <git@yannherklotz.com>2021-05-21 18:29:44 +0100
commit3e1f8a25cd6fecc0fe5fd1635183296acd47b95c (patch)
treee5fc7257db765eafaf7a03f84fb013e3c6d5fe40
parentfeaf70849a93c60379104a6b4c1e7ee05afab340 (diff)
downloadverismith-3e1f8a25cd6fecc0fe5fd1635183296acd47b95c.tar.gz
verismith-3e1f8a25cd6fecc0fe5fd1635183296acd47b95c.zip
Fix top-level of interface
-rw-r--r--src/Verismith.hs25
-rw-r--r--src/Verismith/OptParser.hs13
2 files changed, 35 insertions, 3 deletions
diff --git a/src/Verismith.hs b/src/Verismith.hs
index 89eacca..726d6f9 100644
--- a/src/Verismith.hs
+++ b/src/Verismith.hs
@@ -74,6 +74,7 @@ import Verismith.Verilog
import Verismith.Verilog
import Verismith.Verilog.Distance
import Verismith.Verilog.Parser (parseSourceInfoFile)
+import Verismith.EMI
import Prelude hiding (FilePath)
toFP :: String -> FilePath
@@ -160,12 +161,32 @@ handleOpts (Fuzz o configF f k n nosim noequiv noreduction file top cc checker)
(toFP datadir)
cc
checker
+ )
+ defaultYosys
(fuzzMultiple gen)
return ()
-handleOpts (EMIOpts o configF f k n nosim noequiv noreduction) = do
+handleOpts (EMIOpts o configF f k n nosim noequiv noreduction top file) = do
config <- getConfig configF
datadir <- getDataDir
- putStrLn "Starting EMI testing..."
+ src <- parseSourceInfoFile top (T.pack file) :: IO (SourceInfo ())
+ let gen = proceduralEMI src config
+ _ <-
+ runFuzz
+ ( FuzzOpts
+ (Just $ fromText o)
+ f
+ k
+ n
+ nosim
+ noequiv
+ noreduction
+ config
+ (toFP datadir)
+ False
+ Nothing
+ )
+ defaultYosys
+ (fuzzMultipleEMI gen)
return ()
handleOpts (Generate f c) = do
config <- getConfig c
diff --git a/src/Verismith/OptParser.hs b/src/Verismith/OptParser.hs
index 1692985..a6b5fb9 100644
--- a/src/Verismith/OptParser.hs
+++ b/src/Verismith/OptParser.hs
@@ -54,7 +54,9 @@ data Opts
emiNum :: {-# UNPACK #-} !Int,
emiNoSim :: !Bool,
emiNoEquiv :: !Bool,
- emiNoReduction :: !Bool
+ emiNoReduction :: !Bool,
+ emiTopModule :: Text,
+ emiInputFile :: FilePath
}
| Generate
{ generateFilename :: !(Maybe FilePath),
@@ -243,6 +245,15 @@ emiOpts =
<> Opt.help
"Do not run reduction on a failed testcase."
)
+ <*> textOption
+ ( Opt.long "top"
+ <> Opt.short 't'
+ <> Opt.metavar "MODULE"
+ <> Opt.help "Top module for the Verilog module."
+ <> Opt.showDefault
+ <> Opt.value "top"
+ )
+ <*> Opt.strArgument (Opt.metavar "FILE" <> Opt.help "Verilog input file to pass to EMI.")
genOpts :: Parser Opts
genOpts =