X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=c%CE%BBash%2FCLasH%2FVHDL%2FGenerate.hs;h=61e95b450d10313901b973f402717f7ba9656c69;hb=0dcd1ce078cbae64bc2b968b4c8233c9b94727dc;hp=afd1741d28dd81924032573bd5f10fdf39011fff;hpb=254a259d6cfa363ac4da8c69b665ce4ce2a29ee7;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git "a/c\316\273ash/CLasH/VHDL/Generate.hs" "b/c\316\273ash/CLasH/VHDL/Generate.hs" index afd1741..61e95b4 100644 --- "a/c\316\273ash/CLasH/VHDL/Generate.hs" +++ "b/c\316\273ash/CLasH/VHDL/Generate.hs" @@ -134,8 +134,14 @@ getArchitecture fname = makeCached fname tsArchitectures $ do (state_proc, resbndr) <- case (Maybe.catMaybes in_state_maybes, Maybe.catMaybes out_state_maybes, init_state) of ([in_state], [out_state], Nothing) -> do nonEmpty <- hasNonEmptyType in_state - if nonEmpty then error ("No initial state defined for: " ++ show fname) else return ([],[]) - ([in_state], [out_state], Just resetval) -> mkStateProcSm (in_state, out_state,resetval) + if nonEmpty + then error ("No initial state defined for: " ++ show fname) + else return ([],[]) + ([in_state], [out_state], Just resetval) -> do + nonEmpty <- hasNonEmptyType in_state + if nonEmpty + then mkStateProcSm (in_state, out_state, resetval) + else error ("Initial state defined for function with only substate: " ++ show fname) ([], [], Just _) -> error $ "Initial state defined for state-less function: " ++ show fname ([], [], Nothing) -> return ([],[]) (ins, outs, res) -> error $ "Weird use of state in " ++ show fname ++ ". In: " ++ show ins ++ " Out: " ++ show outs @@ -1548,7 +1554,8 @@ type BuiltinBuilder = type NameTable = Map.Map String (Int, BuiltinBuilder ) -- | The builtin functions we support. Maps a name to an argument count and a --- builder function. +-- builder function. If you add a name to this map, don't forget to add +-- it to VHDL.Constants/builtinIds as well. globalNameTable :: NameTable globalNameTable = Map.fromList [ (exId , (2, genFCall True ) )