diff options
author | Yann Herklotz <git@ymhg.org> | 2019-04-01 10:55:40 +0100 |
---|---|---|
committer | Yann Herklotz <git@ymhg.org> | 2019-04-01 10:55:40 +0100 |
commit | bac2f24871d95eeb3aa3fc898a7656fc4f5f094a (patch) | |
tree | abae8302d3a07eec39fe1a3d05077d4505a0b2bb /src/VeriFuzz/Gen.hs | |
parent | ce3b5a9dc47c2325e1e9cc61279972048b9fbabd (diff) | |
download | verismith-bac2f24871d95eeb3aa3fc898a7656fc4f5f094a.tar.gz verismith-bac2f24871d95eeb3aa3fc898a7656fc4f5f094a.zip |
Run through brittany
Diffstat (limited to 'src/VeriFuzz/Gen.hs')
-rw-r--r-- | src/VeriFuzz/Gen.hs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/VeriFuzz/Gen.hs b/src/VeriFuzz/Gen.hs index c3f2360..180d404 100644 --- a/src/VeriFuzz/Gen.hs +++ b/src/VeriFuzz/Gen.hs @@ -110,7 +110,7 @@ makeIdentifier prefix = do newPort :: PortType -> StateGen Port newPort pt = do ident <- makeIdentifier . T.toLower $ showT pt - p <- gen $ Port pt <$> QC.arbitrary <*> positiveArb <*> pure ident + p <- gen $ Port pt <$> QC.arbitrary <*> positiveArb <*> pure ident variables %= (p :) return p @@ -120,8 +120,7 @@ select ptype = do case filter chooseReg $ context ^.. variables . traverse of [] -> newPort ptype l -> gen $ QC.elements l - where - chooseReg (Port a _ _ _) = ptype == a + where chooseReg (Port a _ _ _) = ptype == a scopedExpr :: StateGen Expr scopedExpr = do @@ -156,7 +155,7 @@ assignment = do statement :: StateGen Statement statement = do prob <- askProbability - as <- assignment + as <- assignment gen $ QC.frequency [ (prob ^. probBlock , return $ BlockAssign as) , (prob ^. probNonBlock, return $ NonBlockAssign as) @@ -196,10 +195,9 @@ moduleDef top = do -- | Procedural generation method for random Verilog. Uses internal 'Reader' and -- 'State' to keep track of the current Verilog code structure. procedural :: Config -> Gen VerilogSrc -procedural config = - VerilogSrc - . (: []) - . Description - <$> QC.resize num (runReaderT (evalStateT (moduleDef True) context) config) - where context = Context [] 0 - num = config ^. configProperty . propSize +procedural config = VerilogSrc . (: []) . Description <$> QC.resize + num + (runReaderT (evalStateT (moduleDef True) context) config) + where + context = Context [] 0 + num = config ^. configProperty . propSize |