Add the current CoreModule to the session.
[matthijs/master-project/cλash.git] / TranslatorTypes.hs
index 733e65938bf84c20470de758e657be345e0fd990..e16c12ea3a6fa1678f76c7521c3d684dd84d5775 100644 (file)
@@ -5,15 +5,17 @@
 module TranslatorTypes where
 
 import qualified Control.Monad.State as State
+import qualified HscTypes
 import Flatten
 
 type FuncMap = [(HsFunction, 
     (FlatFunction))]
 
 data VHDLSession = VHDLSession {
+  coreMod   :: HscTypes.CoreModule, -- The current module
   nameCount :: Int,             -- A counter that can be used to generate unique names
   funcs     :: FuncMap          -- A map from HsFunction to FlatFunction, HWFunction, VHDL Entity and Architecture
-} deriving (Show)
+}
 
 -- Add the function to the session
 addFunc :: HsFunction -> FlatFunction -> VHDLState ()
@@ -21,6 +23,9 @@ addFunc hsfunc flatfunc = do
   fs <- State.gets funcs -- Get the funcs element from the session
   State.modify (\x -> x {funcs = (hsfunc, flatfunc) : fs }) -- Prepend name and f
 
+getModule :: VHDLState HscTypes.CoreModule
+getModule = State.gets coreMod -- Get the coreMod element from the session
+
 type VHDLState = State.State VHDLSession
 
 -- Makes the given name unique by appending a unique number.