From d3a445954d4e2f93ff64839f4db72e7541b69a86 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 5 Mar 2009 14:36:36 +0100 Subject: [PATCH] Remove createEntity from the VHDLState monad. --- Translator.hs | 2 +- VHDL.hs | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Translator.hs b/Translator.hs index 5e36b38..6a78425 100644 --- a/Translator.hs +++ b/Translator.hs @@ -92,7 +92,7 @@ moduleToVHDL core list = do -- Create entities and architectures for them Monad.zipWithM processBind statefuls binds modFuncs nameFlatFunction - modFuncs VHDL.createEntity + modFuncMap $ Map.mapWithKey (\hsfunc fdata -> fdata {funcEntity = VHDL.createEntity hsfunc fdata}) modFuncs VHDL.createArchitecture funcs <- getFuncs return $ VHDL.getDesignFiles (map snd funcs) diff --git a/VHDL.hs b/VHDL.hs index d9dce9e..6f3705e 100644 --- a/VHDL.hs +++ b/VHDL.hs @@ -38,13 +38,12 @@ getDesignFiles funcs = createEntity :: HsFunction -- | The function signature -> FuncData -- | The function data collected so far - -> VHDLState () + -> Maybe Entity -- | The resulting entity createEntity hsfunc fdata = - let func = flatFunc fdata in - case func of + case flatFunc fdata of -- Skip (builtin) functions without a FlatFunction - Nothing -> do return () + Nothing -> Nothing -- Create an entity for all other functions Just flatfunc -> let @@ -60,9 +59,8 @@ createEntity hsfunc fdata = then Nothing else Just $ AST.PackageDec pkg_id (map AST.PDITD $ ty_decls ++ ty_decls') AST.EntityDec entity_id _ = ent_decl' - entity' = Entity entity_id args' res' (Just ent_decl') pkg_decl - in do - setEntity hsfunc entity' + in + Just $ Entity entity_id args' res' (Just ent_decl') pkg_decl where mkMap :: [(SignalId, SignalInfo)] -- 2.30.2