From 6c027c162bedad467bd0259d4a296dcbeff6d8aa Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 18 May 2021 19:16:41 +0100 Subject: Add top-level argument interface for EMI --- src/Verismith/OptParser.hs | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'src/Verismith/OptParser.hs') 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 @@ -312,6 +374,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" -- cgit