From d1b04fc068b1484f8bd0020598d3a2f023772f46 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Mon, 11 May 2020 22:28:35 +0100 Subject: Tests passing for new reduction --- src/Verismith/Reduce.hs | 4 ++++ src/Verismith/Verilog/Mutate.hs | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Verismith/Reduce.hs b/src/Verismith/Reduce.hs index 8595066..6b18232 100644 --- a/src/Verismith/Reduce.hs +++ b/src/Verismith/Reduce.hs @@ -35,6 +35,9 @@ module Verismith.Reduce , removeConstInConcat , takeReplace , filterExpr + , ReduceAnn(..) + , tagAlways + , untagAlways ) where @@ -61,6 +64,7 @@ import Verismith.Verilog import Verismith.Verilog.AST import Verismith.Verilog.Mutate import Verismith.Verilog.Parser +import Verismith.Verilog.CodeGen -- $strategy diff --git a/src/Verismith/Verilog/Mutate.hs b/src/Verismith/Verilog/Mutate.hs index 260d759..b48ab11 100644 --- a/src/Verismith/Verilog/Mutate.hs +++ b/src/Verismith/Verilog/Mutate.hs @@ -106,6 +106,9 @@ instance Mutate Assign where instance Mutate ContAssign where mutExpr f (ContAssign a e) = ContAssign a $ f e +instance Mutate (CasePair ann) where + mutExpr f (CasePair e s) = CasePair (f e) $ mutExpr f s + instance Mutate (Statement ann) where mutExpr f (TimeCtrl d s) = TimeCtrl d $ mutExpr f <$> s mutExpr f (EventCtrl e s) = EventCtrl e $ mutExpr f <$> s @@ -116,6 +119,8 @@ instance Mutate (Statement ann) where mutExpr f (SysTaskEnable a) = SysTaskEnable $ mutExpr f a mutExpr f (CondStmnt a b c) = CondStmnt (f a) (mutExpr f <$> b) $ mutExpr f <$> c mutExpr f (ForLoop a1 e a2 s) = ForLoop a1 e a2 $ mutExpr f s + mutExpr f (StmntAnn a s) = StmntAnn a $ mutExpr f s + mutExpr f (StmntCase t e cp cd) = StmntCase t (f e) (mutExpr f cp) $ mutExpr f cd instance Mutate Parameter where mutExpr _ = id @@ -128,12 +133,15 @@ instance Mutate (ModItem ann) where mutExpr f (ModInst a b conns) = ModInst a b $ mutExpr f conns mutExpr f (Initial s) = Initial $ mutExpr f s mutExpr f (Always s) = Always $ mutExpr f s + mutExpr f (ModItemAnn a s) = ModItemAnn a $ mutExpr f s mutExpr _ d@Decl{} = d mutExpr _ p@ParamDecl{} = p mutExpr _ l@LocalParamDecl{} = l instance Mutate (ModDecl ann) where - mutExpr f (ModDecl a b c d e) = ModDecl (mutExpr f a) (mutExpr f b) (mutExpr f c) (mutExpr f d) (mutExpr f e) + mutExpr f (ModDecl a b c d e) = + ModDecl (mutExpr f a) (mutExpr f b) (mutExpr f c) (mutExpr f d) (mutExpr f e) + mutExpr f (ModDeclAnn a m) = ModDeclAnn a $ mutExpr f m instance Mutate (Verilog ann) where mutExpr f (Verilog a) = Verilog $ mutExpr f a -- cgit