From dbdea9bc47513b3643c981043c806647fdcf89b4 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Tue, 5 Nov 2019 10:17:31 +0000 Subject: Add reduction pass to remove constants from concat --- src/Verismith.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Verismith.hs') 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 -- cgit