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:
hdlConvertorAst.to.hdl_ast_modifier.HdlAstModifier
Verilog 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¶
hdlConvertorAst.translate.common.name_scope module¶
-
class
hdlConvertorAst.translate.common.name_scope.
LanguageKeyword
[source]¶ Bases:
object
Base 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:
Exception
An 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:
dict
Scope 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 metainformations 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)¶
-
_NameScope__discard_prefix_cntrs_from_children
(prefix)¶ Discard all prefix counters from all childrens in order to prevent children from looping trought all occupied names.
-
_NameScope__incrPrefixCntr
(prefix, currentVal)¶ Returns: str
-
__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:
KeyError
And exception which is rised if the name is not registered at all.