Sockeye: Complete new AST for Frontend
@@ -17,58 +17,77 @@ module SockeyeASTFrontend where
data SockeyeSpec = SockeyeSpec
{ modules :: [Module]
- , nodeDecls :: [NodeDecl]
+ , net :: [NetSpec]
}
-data ParamType = Index | Address
+data ParamType = IndexParam | AddressParam
data ModuleParam = ModuleParam
{ paramName :: !String
- , paramType :: !Maybe ParamType
+ , paramType :: Maybe ParamType
}
data Module = Module
- { inputPorts :: [NodeId]
- , outputPorts :: [NodeId]
+ { inputPorts :: [Identifier]
+ , outputPorts :: [Identifier]
, parameters :: [ModuleParam]
- , body :: [NodeDecl]
+ , body :: [NetSpec]
}
+data ModuleParamMap
+ = ModuleParamMap
+ { port :: Identifier
+ , nodeId :: Identifier
+ }
+
+data ModuleInstantiation
+ = ModuleInstantiation
+ { nameSpace :: Identifier
+ , arguments :: [Word]
+ , inputMappings :: [ModuleParamMap]
+ , outputMappings :: [ModuleParamMap]
+ }
+
+data NetSpec
+ = NodeDeclSpec NodeDecl
+ | ModuleInstSpec ModuleInstantiation
+
+
+
data NodeDecl = NodeDecl
- { nodeId :: NodeId
+ { nodeIds :: [Identifier]
, nodeSpec :: NodeSpec
}
-data NodeIdIndex = Index
- { index :: !Word }
- | Param
- { name :: !String }
+data IdentifierIndex
+ = NumberIndex !Word
+ | ParamIndex !String
-data NodeId = Single
- { prefix :: String }
+data Identifier
+ = Single
+ { prefix :: !String }
| Indexed
{ prefix :: !String }
| Multi
{ prefix :: !String
- , start :: NodeIdIndex
- , end :: NodeIdIndex
+ , start :: IdentifierIndex
+ , end :: IdentifierIndex
}
data NodeType = Memory | Device
data NodeSpec = NodeSpec
- { nodeType :: !Maybe NodeType
+ { nodeType :: Maybe NodeType
, accept :: [BlockSpec]
, translate :: [MapSpec]
- , overlay :: !String
+ , overlay :: Identifier
}
-data Address = Address
- { address :: Word }
- | Param
- { name :: String }
+data Address = Address !Word
+ | Param !String
-data BlockSpec = Singleton
+data BlockSpec
+ = Singleton
{ address :: !Address }
| Range
{ base :: !Address
@@ -79,11 +98,12 @@ data BlockSpec = Singleton
, bits :: !Word
}
-data MapDest = Direct
- { destNode :: !NodeId }
+data MapDest
+ = Direct
+ { destNode :: Identifier }
| BaseAddress
- { destNode :: !NodeId
- , destBase :: !Address
+ { destNode :: Identifier
+ , destBase :: Address
}
data MapSpec = MapSpec
