From 186bb5f37770c150bd8e601e9761211af6a9c277 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 10 Apr 2019 23:42:58 +0100 Subject: Fix the generation of modules and add initialisation --- src/VeriFuzz/Verilog/Arbitrary.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/VeriFuzz/Verilog/Arbitrary.hs') diff --git a/src/VeriFuzz/Verilog/Arbitrary.hs b/src/VeriFuzz/Verilog/Arbitrary.hs index 40b9787..52e0d5f 100644 --- a/src/VeriFuzz/Verilog/Arbitrary.hs +++ b/src/VeriFuzz/Verilog/Arbitrary.hs @@ -137,14 +137,15 @@ expr n | n == 0 = Hog.choice $ (Id <$> arb) : exprSafeList where subexpr y = expr (n `div` y) constExpr :: Gen ConstExpr -constExpr = Hog.recursive Hog.choice - [ ConstNum <$> genPositive <*> arb - , ParamId <$> arb - ] - [ Hog.subtermM constExpr (\e -> ConstUnOp <$> arb <*> pure e) - , Hog.subtermM2 constExpr constExpr (\a b -> ConstBinOp <$> pure a <*> arb <*> pure b) - , Hog.subterm3 constExpr constExpr constExpr ConstCond - ] +constExpr = Hog.recursive + Hog.choice + [ConstNum <$> genPositive <*> arb, ParamId <$> arb] + [ Hog.subtermM constExpr (\e -> ConstUnOp <$> arb <*> pure e) + , Hog.subtermM2 constExpr + constExpr + (\a b -> ConstBinOp <$> pure a <*> arb <*> pure b) + , Hog.subterm3 constExpr constExpr constExpr ConstCond + ] instance Arb ConstExpr where arb = constExpr @@ -203,7 +204,7 @@ instance Arb ModItem where , ModInst <$> arb <*> arb <*> listOf arb , Initial <$> arb , Always <$> (EventCtrl <$> arb <*> Hog.maybe arb) - , Decl <$> pure Nothing <*> arb + , Decl <$> pure Nothing <*> arb <*> pure Nothing ] modPortGen :: Gen Port -- cgit