diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2019-02-03 01:58:30 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2019-02-03 01:58:30 +0000 |
commit | c5de519edec68e495a68c49509d5233bd7b93dc0 (patch) | |
tree | 1fbe2a13977b2b42011d25a36040c46ab9e1a713 | |
parent | bab6f7e21b3e16ae49233287d4ce7b4348b232c8 (diff) | |
download | verismith-c5de519edec68e495a68c49509d5233bd7b93dc0.tar.gz verismith-c5de519edec68e495a68c49509d5233bd7b93dc0.zip |
Small fixes to module generation
-rw-r--r-- | src/VeriFuzz/Gen.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/VeriFuzz/Gen.hs b/src/VeriFuzz/Gen.hs index 5bf1af1..c246e4e 100644 --- a/src/VeriFuzz/Gen.hs +++ b/src/VeriFuzz/Gen.hs @@ -46,18 +46,21 @@ randomOrdAssigns :: [Identifier] -> [Identifier] -> [Gen ModItem] randomOrdAssigns inp ids = snd $ foldr gen (inp, []) ids where - gen cid (i, o) = (cid : i, o ++ [random i $ ContAssign cid]) + gen cid (i, o) = (cid : i, random i (ContAssign cid) : o) randomMod :: Int -> Int -> Gen ModDecl randomMod inps total = do - let ids = toId <$> [1..total] - x <- sequence . randomOrdAssigns (take inps ids) $ drop inps ids + x <- sequence $ randomOrdAssigns start end ident <- sequence $ toPort <$> ids let inputs = take inps ident let other = drop inps ident let y = ModCA . ContAssign "y" . fold $ Id <$> drop inps ids let yport = [Port Wire (sumSize other) "y"] - return . initMod . declareMod other .ModDecl "test_module" yport inputs $ x ++ [y] + return . initMod . declareMod other . ModDecl "test_module" yport inputs $ x ++ [y] + where + ids = toId <$> [1..total] + end = drop inps ids + start = take inps ids fromGraph :: Gen ModDecl fromGraph = do |