aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorYann Herklotz Grave <git@yannherklotzgrave.com>2019-03-07 17:37:17 +0000
committerYann Herklotz Grave <git@yannherklotzgrave.com>2019-03-07 17:37:17 +0000
commite0584a769484a7b91a63840420986220df1734b2 (patch)
treeefdd1915c1e0de4aa1e02cec4df57a66153f5d7a /app
parent24df5f787068a50bc90433e7073bba0ab82d1938 (diff)
downloadverismith-e0584a769484a7b91a63840420986220df1734b2.tar.gz
verismith-e0584a769484a7b91a63840420986220df1734b2.zip
Add more options to main app
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 3d80c86..f9ecb52 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -17,16 +17,17 @@ instance Show Tool where
show XST = "xst"
show Icarus = "icarus"
-data Opts = Fuzz { fuzzOutput :: Text
+data Opts = Fuzz { fuzzOutput :: {-# UNPACK #-} !Text
}
- | Rerun { tool :: Tool
+ | Rerun { tools :: [Tool]
+ , input :: {-# UNPACK #-} !S.FilePath
}
- | Generate { fileName :: S.FilePath
+ | Generate { fileName :: {-# UNPACK #-} !S.FilePath
}
- | Parse { fileName :: S.FilePath
+ | Parse { fileName :: {-# UNPACK #-} !S.FilePath
}
- | Reduce { fileName :: S.FilePath
- , top :: Text
+ | Reduce { fileName :: {-# UNPACK #-} !S.FilePath
+ , top :: {-# UNPACK #-} !Text
}
myForkIO :: IO () -> IO (MVar ())
@@ -65,7 +66,7 @@ fuzzOpts = Fuzz <$> textOption
rerunOpts :: Parser Opts
rerunOpts =
Rerun
- <$> ( option
+ <$> some (option
(optReader parseSynth)
( long "synth"
<> metavar "SYNTH"
@@ -82,6 +83,13 @@ rerunOpts =
<> value Icarus
)
)
+ <*> (S.fromText <$> textOption
+ ( long "input"
+ <> short 'i'
+ <> metavar "FILE"
+ <> help "Verilog file input."
+ <> showDefault
+ <> value "rtl.v"))
genOpts :: Parser Opts
genOpts = Generate . S.fromText <$> textOption
@@ -197,7 +205,7 @@ handleOpts (Parse f) = do
Left l -> print l
Right v -> print $ V.GenVerilog v
where file = T.unpack . S.toTextIgnore $ f
-handleOpts (Rerun _ ) = undefined
+handleOpts (Rerun _ _) = undefined
handleOpts (Reduce f t) = do
verilogSrc <- readFile file
case V.parseVerilog file verilogSrc of