aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test/VeriFuzz
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-12-31 12:14:25 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-12-31 12:14:25 +0100
commitf785b208f4857571a952c0befde58a7b4c37b0dc (patch)
tree1497cc9cb730e1318fca12acb194fd8ea9ca2cfe /src/Test/VeriFuzz
parent06a73c2872188d137d866c48fd912b2d48878634 (diff)
downloadverismith-f785b208f4857571a952c0befde58a7b4c37b0dc.tar.gz
verismith-f785b208f4857571a952c0befde58a7b4c37b0dc.zip
Add doctest test
Diffstat (limited to 'src/Test/VeriFuzz')
-rw-r--r--src/Test/VeriFuzz/Verilog/Mutate.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Test/VeriFuzz/Verilog/Mutate.hs b/src/Test/VeriFuzz/Verilog/Mutate.hs
index e9d7aed..258af84 100644
--- a/src/Test/VeriFuzz/Verilog/Mutate.hs
+++ b/src/Test/VeriFuzz/Verilog/Mutate.hs
@@ -18,6 +18,7 @@ import Data.Maybe (catMaybes, fromMaybe)
import Test.VeriFuzz.Internal.Gen
import Test.VeriFuzz.Internal.Shared
import Test.VeriFuzz.Verilog.AST
+import Test.VeriFuzz.Verilog.CodeGen
-- | Return if the 'Identifier' is in a 'ModDecl'.
inPort :: Identifier -> ModDecl -> Bool
@@ -78,6 +79,13 @@ nestUpTo i src =
-- | Add a Module Instantiation using 'ModInst' from the first module passed to
-- it to the body of the second module. It first has to make all the inputs into
-- @reg@.
+--
+-- >>> SrcShow $ instantiateMod (ModDecl (Identifier "m") [Port (PortNet Wire) 5 (Identifier "y")] [Port (PortNet Wire) 5 "x"] []) (ModDecl "main" [] [] [])
+-- module main;
+-- wire y;
+-- reg x;
+-- endmodule
+-- <BLANKLINE>
instantiateMod :: ModDecl -> ModDecl -> ModDecl
instantiateMod mod main =
main & moduleItems %~ ((out ++ regIn)++)