diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-05-20 12:51:26 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-05-20 12:51:26 +0100 |
commit | a6c69c67a9d3923443fccad77293c365f4bbc0d3 (patch) | |
tree | 8e11bec1a75f80a7fbbd713b6867c7ad2ba086cb /src/VeriFuzz/Reduce.hs | |
parent | b72c905c718ff52e623b748034d567cf8552b50e (diff) | |
parent | 9a051648695d459d4564be58ae4850e159cb3ba3 (diff) | |
download | verismith-a6c69c67a9d3923443fccad77293c365f4bbc0d3.tar.gz verismith-a6c69c67a9d3923443fccad77293c365f4bbc0d3.zip |
Merge branch 'master' of github.com:ymherklotz/verifuzz
Diffstat (limited to 'src/VeriFuzz/Reduce.hs')
-rw-r--r-- | src/VeriFuzz/Reduce.hs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/VeriFuzz/Reduce.hs b/src/VeriFuzz/Reduce.hs index d8a23ad..33cb648 100644 --- a/src/VeriFuzz/Reduce.hs +++ b/src/VeriFuzz/Reduce.hs @@ -282,11 +282,12 @@ fixModInst (SourceInfo _ (Verilog decl)) (ModInst n g i) = case m of Just m' -> ModInst n g . mapMaybe (fixModInst' m') $ zip i [0 ..] where m = safe head $ filter (isModule n) decl - fixModInst' (ModDecl _ o i' _ _) (ModConn e, n') | n' < length o + length i' = Just $ ModConn e - | otherwise = Nothing + fixModInst' (ModDecl _ o i' _ _) (ModConn e, n') + | n' < length o + length i' = Just $ ModConn e + | otherwise = Nothing fixModInst' (ModDecl _ o i'' _ _) (ModConnNamed i' e, _) | i' `elem` fmap _portName (o <> i'') = Just $ ModConnNamed i' e - | otherwise = Nothing + | otherwise = Nothing fixModInst _ a = a findActiveWires :: Identifier -> SourceInfo -> [Identifier] @@ -466,11 +467,12 @@ removeDecl src = foldr fix removed allMods where removeDecl' t src' = src' - & (\a -> a & aModule t . modItems %~ filter (isUsedDecl (used <> findActiveWires t a))) + & (\a -> a & aModule t . modItems %~ filter + (isUsedDecl (used <> findActiveWires t a)) + ) . (aModule t . modParams %~ filter (isUsedParam used)) . (aModule t . modInPorts %~ filter (isUsedPort used)) - where - used = nub $ allExprIds (src' ^. aModule t) + where used = nub $ allExprIds (src' ^. aModule t) allMods = src ^.. infoSrc . _Wrapped . traverse . modId fix t a = a & aModule t . modItems %~ fmap (fixModInst a) removed = foldr removeDecl' src allMods |