map (Arrow.second $ AST.DesignFile full_context) units
where
- init_session = VHDLState Map.empty Map.empty Map.empty Map.empty globalNameTable
+ init_session = VHDLState Map.empty Map.empty Map.empty Map.empty
(units, final_session) =
State.runState (createLibraryUnits binds) init_session
tyfun_decls = Map.elems (final_session ^.vsTypeFuns)
IdInfo.VanillaGlobal -> do
-- It's a global value imported from elsewhere. These can be builtin
-- functions.
- funSignatures <- getA vsNameTable
signatures <- getA vsSignatures
- case (Map.lookup (varToString f) funSignatures) of
+ case (Map.lookup (varToString f) globalNameTable) of
Just (arg_count, builder) ->
if length valargs == arg_count then
case builder of
-- A map of a Haskell function to a hardware signature
type SignatureMap = Map.Map CoreSyn.CoreBndr Entity
-type Builder = Either ([AST.Expr] -> AST.Expr) (Entity -> [CoreSyn.CoreBndr] -> AST.GenerateSm)
-
--- A map of a builtin function to VHDL function builder
-type NameTable = Map.Map String (Int, Builder )
-
data VHDLState = VHDLState {
-- | A map of Core type -> VHDL Type
vsTypes_ :: TypeMap,
vsTypeFuns_ :: TypeFunMap,
-- | A map of HsFunction -> hardware signature (entity name, port names,
-- etc.)
- vsSignatures_ :: SignatureMap,
- -- | A map of Vector HsFunctions -> VHDL function call
- vsNameTable_ :: NameTable
+ vsSignatures_ :: SignatureMap
}
-- Derive accessors
-- | A substate containing just the types
type TypeState = State.State TypeMap
+type Builder = Either ([AST.Expr] -> AST.Expr) (Entity -> [CoreSyn.CoreBndr] -> AST.GenerateSm)
+
+-- A map of a builtin function to VHDL function builder
+type NameTable = Map.Map String (Int, Builder )
+
-- vim: set ts=8 sw=2 sts=2 expandtab: