From f785b208f4857571a952c0befde58a7b4c37b0dc Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Mon, 31 Dec 2018 12:14:25 +0100 Subject: Add doctest test --- src/Test/VeriFuzz/Verilog/Mutate.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Test') 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 +-- instantiateMod :: ModDecl -> ModDecl -> ModDecl instantiateMod mod main = main & moduleItems %~ ((out ++ regIn)++) -- cgit