diff options
author | Yann Herklotz <git@ymhg.org> | 2019-04-10 23:42:58 +0100 |
---|---|---|
committer | Yann Herklotz <git@ymhg.org> | 2019-04-10 23:42:58 +0100 |
commit | 186bb5f37770c150bd8e601e9761211af6a9c277 (patch) | |
tree | 33ccc13403d1c9a168909b1e9987f29028834396 /src/VeriFuzz/Verilog/Arbitrary.hs | |
parent | aefb46596f3f2302540a83b2be8b042232822a2f (diff) | |
download | verismith-186bb5f37770c150bd8e601e9761211af6a9c277.tar.gz verismith-186bb5f37770c150bd8e601e9761211af6a9c277.zip |
Fix the generation of modules and add initialisation
Diffstat (limited to 'src/VeriFuzz/Verilog/Arbitrary.hs')
-rw-r--r-- | src/VeriFuzz/Verilog/Arbitrary.hs | 19 |
1 files changed, 10 insertions, 9 deletions
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 |