aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2019-02-03 01:58:30 +0000
committerYann Herklotz <ymherklotz@gmail.com>2019-02-03 01:58:30 +0000
commitc5de519edec68e495a68c49509d5233bd7b93dc0 (patch)
tree1fbe2a13977b2b42011d25a36040c46ab9e1a713 /src
parentbab6f7e21b3e16ae49233287d4ce7b4348b232c8 (diff)
downloadverismith-c5de519edec68e495a68c49509d5233bd7b93dc0.tar.gz
verismith-c5de519edec68e495a68c49509d5233bd7b93dc0.zip
Small fixes to module generation
Diffstat (limited to 'src')
-rw-r--r--src/VeriFuzz/Gen.hs11
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