hdlConvertorAst.translate.common package¶
Submodules¶
hdlConvertorAst.translate.common.add_call_operator_for_call_without_parenthesis module¶
- class hdlConvertorAst.translate.common.add_call_operator_for_call_without_parenthesis.AddCallOperatorForCallWithoutParenthesis[source]¶
Bases:
HdlAstModifierVerilog function call does not need to have () and it can be called just by its id. To simplify handling we decorete each such a call with a call operator in this transformation.
hdlConvertorAst.translate.common.discover_declarations module¶
- class hdlConvertorAst.translate.common.discover_declarations.DiscoverDeclarations(name_scope)[source]¶
Bases:
HdlAstVisitor
hdlConvertorAst.translate.common.name_scope module¶
- class hdlConvertorAst.translate.common.name_scope.LanguageKeyword[source]¶
Bases:
objectBase class for keywords of target language. Used to notify that the name represents a language keyword and thus shall not be modified.
- exception hdlConvertorAst.translate.common.name_scope.NameOccupiedErr(nameScope, name, usedOn)[source]¶
Bases:
ExceptionAn exception which is rised if the symbol name is used by a different object in current scope
- class hdlConvertorAst.translate.common.name_scope.NameScope(parent, name, ignorecase, debug=False)[source]¶
Bases:
dictScope of used names in hdl (node of hierarchical symbol table). Used to find an object for a HdlValueId or HdlValueId for an object and to resolve collision between different object of a same name if required.
Contains mapping {name: obj}
if name is discovered in scope it is converted to name_id where id is sequential number for prefix name_
- Variables:
~.level – describes how deeply nested is this NameScopeItem in name hierarchy
~.cntrsForPrefixNames – counters for prefix names (for each name which has to be renamed there is a counter which is used to find a non occupied name faster)
~.reversed – a reverse dict to this dict ({obj: name})
~.serializer_ctx – an object with meta-informations private to a current serializer
~.children – a dictionary {object which caused a NameScope fork: new NameScope}
- RE_LETTER = re.compile('[A-Za-z]')¶
- RE_NON_ID_CHAR = re.compile('[^A-Za-z_$0-9]', re.MULTILINE)¶
- __init__(parent, name, ignorecase, debug=False)[source]¶
- Parameters:
name (Optional[str]) – name of object which this namescope belongs to
ignorecase – if True the name comparison does not care about lowercase/uppercase
debug – If True name scopes are not required to have forward declarations and for any object some name is always resolved without raising definition errors
- Note:
parent=None, name=None for global namescope
- checked_name(suggested_name, obj)[source]¶
Get a non occupied name in current scope if name is occupied or name ends with _ the new name is generated.
- Returns:
str
- exception hdlConvertorAst.translate.common.name_scope.ObjectForNameNotFound[source]¶
Bases:
KeyErrorAnd exception which is rised if the name is not registered at all.
hdlConvertorAst.translate.common.resolve_names module¶
Use declarations collected from resolve_names and use them to associate HdlValueIds to a HdlObjects.
- class hdlConvertorAst.translate.common.resolve_names.ResolveNames(name_scope)[source]¶
Bases:
HdlAstVisitor