aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-05-11 22:28:35 +0100
committerYann Herklotz <git@yannherklotz.com>2020-05-11 22:28:35 +0100
commitd1b04fc068b1484f8bd0020598d3a2f023772f46 (patch)
treea8f67d67bc78f520fb599786bc130af8c52674ad /src
parent805f67c07cc15d784078b00a84f4055f84016cec (diff)
downloadverismith-d1b04fc068b1484f8bd0020598d3a2f023772f46.tar.gz
verismith-d1b04fc068b1484f8bd0020598d3a2f023772f46.zip
Tests passing for new reduction
Diffstat (limited to 'src')
-rw-r--r--src/Verismith/Reduce.hs4
-rw-r--r--src/Verismith/Verilog/Mutate.hs10
2 files changed, 13 insertions, 1 deletions
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