Don't generate VHDL for substate extractor cases.
[matthijs/master-project/cλash.git] / cλash / CLasH / VHDL / Generate.hs
index aea597679b85071769f50e40db2b0da8971df997..5698ef89a6efe29503b4c263b524c288a46f0016 100644 (file)
@@ -47,7 +47,7 @@ getEntity fname = Utils.makeCached fname tsEntities $ do
       -- Strip off lambda's, these will be arguments
       let (args, letexpr) = CoreSyn.collectBinders expr
       -- Generate ports for all non-state types
-      args' <- catMaybesM $ mapM mkMap (filter (not.hasStateType) args)
+      args' <- catMaybesM $ mapM mkMap args
       -- There must be a let at top level 
       let (CoreSyn.Let binds (CoreSyn.Var res)) = letexpr
       -- TODO: Handle Nothing
@@ -160,7 +160,10 @@ mkConcSm (bndr, app@(CoreSyn.App _ _))= do
 -- A single alt case must be a selector. This means thee scrutinee is a simple
 -- variable, the alternative is a dataalt with a single non-wild binder that
 -- is also returned.
-mkConcSm (bndr, expr@(CoreSyn.Case (CoreSyn.Var scrut) b ty [alt])) =
+mkConcSm (bndr, expr@(CoreSyn.Case (CoreSyn.Var scrut) b ty [alt])) 
+                -- Don't generate VHDL for substate extraction
+                | hasStateType bndr = return ([], [])
+                | otherwise =
   case alt of
     (CoreSyn.DataAlt dc, bndrs, (CoreSyn.Var sel_bndr)) -> do
       case List.elemIndex sel_bndr bndrs of