From 1486a2afa481de46938c1bc122c469975978593f Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Thu, 25 Apr 2019 16:17:03 +0100 Subject: Add --num command line option --- app/Main.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/Main.hs b/app/Main.hs index 4e6b3bc..277533c 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -21,6 +21,7 @@ data Opts = Fuzz { fuzzOutput :: {-# UNPACK #-} !Text , configFile :: !(Maybe FilePath) , forced :: !Bool , keepAll :: !Bool + , num :: {-# UNPACK #-} !Int } | Generate { mFileName :: !(Maybe FilePath) , configFile :: !(Maybe FilePath) @@ -79,6 +80,14 @@ fuzzOpts = <*> (switch $ long "keep" <> short 'k' <> help "Keep all the directories." ) + <*> (option auto $ + long "num" + <> short 'n' + <> help "The number of fuzz runs that should be performed." + <> showDefault + <> value 1 + <> metavar "INT" + ) genOpts :: Parser Opts genOpts = @@ -197,11 +206,11 @@ getConfig :: Maybe FilePath -> IO V.Config getConfig = maybe (return V.defaultConfig) V.parseConfigFile handleOpts :: Opts -> IO () -handleOpts (Fuzz out configF _ _) = do +handleOpts (Fuzz out configF _ _ n) = do config <- getConfig configF _ <- V.runFuzz config V.defaultYosys - (V.fuzzMultiple 5 Nothing (V.proceduralSrc "top" config)) + (V.fuzzMultiple n Nothing (V.proceduralSrc "top" config)) return () handleOpts (Generate f c) = do config <- getConfig c -- cgit