diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-11-05 10:17:31 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-11-05 10:17:31 +0000 |
commit | dbdea9bc47513b3643c981043c806647fdcf89b4 (patch) | |
tree | f89b4387e9d78166ccb52b3dab6d970d3ece06c2 /src/Verismith.hs | |
parent | a083073ec8ccac04861e06223b117304bd517565 (diff) | |
download | verismith-dbdea9bc47513b3643c981043c806647fdcf89b4.tar.gz verismith-dbdea9bc47513b3643c981043c806647fdcf89b4.zip |
Add reduction pass to remove constants from concat
Diffstat (limited to 'src/Verismith.hs')
-rw-r--r-- | src/Verismith.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Verismith.hs b/src/Verismith.hs index 45977fe..19237ae 100644 --- a/src/Verismith.hs +++ b/src/Verismith.hs @@ -148,12 +148,19 @@ handleOpts (Generate f c) = do $ T.unpack . toTextIgnore <$> f -handleOpts (Parse f) = do +handleOpts (Parse f t o rc) = do verilogSrc <- T.readFile file case parseVerilog (T.pack file) verilogSrc of Left l -> print l - Right v -> print $ GenVerilog v - where file = T.unpack . toTextIgnore $ f + Right v -> + case (o, GenVerilog + . mapply rc (takeReplace . removeConstInConcat) + $ SourceInfo t v) of + (Nothing, a) -> print a + (Just o', a) -> writeFile (T.unpack $ toTextIgnore o') $ show a + where + file = T.unpack . toTextIgnore $ f + mapply i f = if i then f else id handleOpts (Reduce f t _ ls' False) = do src <- parseSourceInfoFile t (toTextIgnore f) datadir <- getDataDir |