From 3e1f8a25cd6fecc0fe5fd1635183296acd47b95c Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Fri, 21 May 2021 18:29:44 +0100 Subject: Fix top-level of interface --- src/Verismith.hs | 25 +++++++++++++++++++++++-- src/Verismith/OptParser.hs | 13 ++++++++++++- 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 = -- cgit