aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorYann Herklotz <git@ymhg.org>2019-04-25 16:17:03 +0100
committerYann Herklotz <git@ymhg.org>2019-04-25 16:17:03 +0100
commit1486a2afa481de46938c1bc122c469975978593f (patch)
treefca2744cf098de64cf31d761e8157e1ca04fcb95 /app
parente116c73bc75188db5cae0cda3f5251c0f69b822b (diff)
downloadverismith-1486a2afa481de46938c1bc122c469975978593f.tar.gz
verismith-1486a2afa481de46938c1bc122c469975978593f.zip
Add --num command line option
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs13
1 files changed, 11 insertions, 2 deletions
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