aboutsummaryrefslogtreecommitdiffstats
path: root/src/Verismith
diff options
context:
space:
mode:
Diffstat (limited to 'src/Verismith')
-rw-r--r--src/Verismith/EMI.hs18
-rw-r--r--src/Verismith/OptParser.hs73
2 files changed, 91 insertions, 0 deletions
diff --git a/src/Verismith/EMI.hs b/src/Verismith/EMI.hs
index 6891eda..555e371 100644
--- a/src/Verismith/EMI.hs
+++ b/src/Verismith/EMI.hs
@@ -97,3 +97,21 @@ proceduralEMI moddecl config = do
proceduralEMIIO :: ModDecl () -> Config -> IO (ModDecl ())
proceduralEMIIO t = Hog.sample . proceduralEMI t
+
+-- m = (head . head $ [verilog|
+-- module m;
+-- always @(posedge clk) begin
+-- if (z == 2) begin
+-- ry = 2;
+-- end
+-- x <= y;
+-- y <= z;
+-- end
+-- endmodule
+-- |] ^.. _Wrapped )
+-- p :: Show a => ModDecl a -> IO ()
+-- p = T.putStrLn . genSource
+--
+-- customConfig = defaultConfig &
+-- (configEMI . confEMIGenerateProb .~ 1)
+-- . (configEMI . confEMINoGenerateProb .~ 0)
diff --git a/src/Verismith/OptParser.hs b/src/Verismith/OptParser.hs
index c2b31fe..1692985 100644
--- a/src/Verismith/OptParser.hs
+++ b/src/Verismith/OptParser.hs
@@ -46,6 +46,16 @@ data Opts
fuzzCrossCheck :: !Bool,
fuzzChecker :: !(Maybe Text)
}
+ | EMIOpts
+ { emiOutput :: Text,
+ emiConfigFile :: !(Maybe FilePath),
+ emiForced :: !Bool,
+ emiKeepAll :: !Bool,
+ emiNum :: {-# UNPACK #-} !Int,
+ emiNoSim :: !Bool,
+ emiNoEquiv :: !Bool,
+ emiNoReduction :: !Bool
+ }
| Generate
{ generateFilename :: !(Maybe FilePath),
generateConfigFile :: !(Maybe FilePath)
@@ -182,6 +192,58 @@ fuzzOpts =
<> Opt.help "Define the checker to use."
)
+emiOpts :: Parser Opts
+emiOpts =
+ EMIOpts
+ <$> textOption
+ ( Opt.long "output"
+ <> Opt.short 'o'
+ <> Opt.metavar "DIR"
+ <> Opt.help "Output directory that the fuzz run takes place in."
+ <> Opt.showDefault
+ <> Opt.value "output"
+ )
+ <*> ( Opt.optional
+ . Opt.strOption
+ $ Opt.long "config"
+ <> Opt.short 'c'
+ <> Opt.metavar "FILE"
+ <> Opt.help "Config file for the current fuzz run."
+ )
+ <*> ( Opt.switch $
+ Opt.long "force" <> Opt.short 'f'
+ <> Opt.help
+ "Overwrite the specified directory."
+ )
+ <*> ( Opt.switch $
+ Opt.long "keep" <> Opt.short 'k'
+ <> Opt.help
+ "Keep all the directories."
+ )
+ <*> ( Opt.option Opt.auto $
+ Opt.long "num"
+ <> Opt.short 'n'
+ <> Opt.help "The number of fuzz runs that should be performed."
+ <> Opt.showDefault
+ <> Opt.value 1
+ <> Opt.metavar "INT"
+ )
+ <*> ( Opt.switch $
+ Opt.long "no-sim"
+ <> Opt.help
+ "Do not run simulation on the output netlist."
+ )
+ <*> ( Opt.switch $
+ Opt.long "no-equiv"
+ <> Opt.help
+ "Do not run an equivalence check on the output netlist."
+ )
+ <*> ( Opt.switch $
+ Opt.long "no-reduction"
+ <> Opt.help
+ "Do not run reduction on a failed testcase."
+ )
+
genOpts :: Parser Opts
genOpts =
Generate
@@ -313,6 +375,17 @@ argparse =
<> Opt.metavar "fuzz"
)
<|> Opt.hsubparser
+ ( Opt.command
+ "emi"
+ ( Opt.info
+ emiOpts
+ ( Opt.progDesc
+ "EMI testing using generated inputs, or existing Verilog designs."
+ )
+ )
+ <> Opt.metavar "emi"
+ )
+ <|> Opt.hsubparser
( Opt.command
"generate"
( Opt.info