hwt.serializer.generic package

This package contains common parts of serializers.

Submodules

hwt.serializer.generic.constant_cache module

class hwt.serializer.generic.constant_cache.ConstantCache(toHdlAst, tmpVars: TmpVarConstructor)[source]

Bases: object

Container of constants for serializer. Used to extract constants as constant variables.

__init__(toHdlAst, tmpVars: TmpVarConstructor)[source]
extract_const_val_as_const_var(val: HConst) RtlSignalBase[source]

Create a constant variable with a value specified or use existing variable with same value

hwt.serializer.generic.indent module

hwt.serializer.generic.indent.getIndent(indentNum: int)[source]

Cached indent getter function

hwt.serializer.generic.ops module

hwt.serializer.generic.tmpVarConstructor module

class hwt.serializer.generic.tmpVarConstructor.NoTmpVars[source]

Bases: object

create_cached(suggestedName, dtype, *args, **kwargs)[source]
create_var_cached(suggestedName, dtype, *args, **kwargs)[source]
class hwt.serializer.generic.tmpVarConstructor.TmpVarConstructor(toHdlAst, name_scope: NameScope)[source]

Bases: object

__init__(toHdlAst, name_scope: NameScope)[source]
create_var(suggestedName: str, dtype: HdlType, const=False, def_val: RtlSignalBase | HConst | None = None, postponed_init=False) RtlSignal[source]
create_var_cached(suggestedName: str, dtype: HdlType, const=False, def_val: RtlSignalBase | HConst | None = None, postponed_init=False, extra_args=None) Tuple[bool, RtlSignal][source]
finish_var_init(var: RtlSignal)[source]
sort_hdl_declarations_first()[source]
exception hwt.serializer.generic.tmpVarConstructor.TmpVarNotConstructableError[source]

Bases: NotImplementedError

hwt.serializer.generic.to_hdl_ast module

hwt.serializer.generic.utils module

class hwt.serializer.generic.utils.TmpVarsSwap(ctx, tmpVars)[source]

Bases: object

An object which is used as a context manager for tmpVars inside of ToHdlAst

__init__(ctx, tmpVars)[source]

hwt.serializer.generic.value module

class hwt.serializer.generic.value.ToHdlAst_Value[source]

Bases: object

Value_try_extract_as_const(val)[source]
as_hdl_HBitsConst(val: HBitsConst)[source]
as_hdl_HFloatConst(val)[source]
as_hdl_HFunctionConst(val: HFunctionConst)[source]
as_hdl_HStringConst(val: HStringConst)[source]
as_hdl_HdlSignalItem(si: HdlSignalItem | HdlIdDef, declaration=False)[source]
as_hdl_IntegerVal(val: HBitsConst)[source]
as_hdl_Value(val)[source]
Parameters:
  • dst – is signal connected with value

  • val – value object, can be instance of Signal or HConst

as_hdl_int(val: int)[source]
is_suitable_for_const_extract(val: HConst)[source]
Returns:

True if an value should be extracted as a constant if possible