Fix testbench again.
[matthijs/master-project/cλash.git] / cλash / CLasH / Translator.hs
index 20dab4f7c77de618a2faebc2e97dc392ea17d02a..fb02355b96156383a2112742b841bc50aa53ed57 100644 (file)
@@ -31,6 +31,7 @@ import CLasH.Translator.Annotations
 import CLasH.Utils.Core.CoreTools
 import CLasH.Utils.GhcTools
 import CLasH.VHDL
+import CLasH.VHDL.Testbench
 
 -- | Turn Haskell to VHDL, Usings Strings to indicate the Top Entity, Initial
 --   State and Test Inputs.
@@ -104,8 +105,8 @@ moduleToVHDL env cores topbinds' init test stateful = do
     let all_bindings = concat (map (\x -> CoreSyn.flattenBinds (HscTypes.cm_binds x)) cores)
     -- Store the bindings we loaded
     tsBindings %= Map.fromList all_bindings 
-    --let testexprs = case testInput of [] -> [] ; [x] -> reduceCoreListToHsList x
-    createDesignFiles topbinds 
+    test_binds <- Monad.zipWithM (createTestbench Nothing) testInput topbinds
+    createDesignFiles (topbinds ++ test_binds)
   mapM (putStr . render . Ppr.ppr . snd) vhdl
   return vhdl