sim/gtkwave: Update/fix SignalNamespace import (And make it public in fhdl/namer).

This commit is contained in:
Florent Kermarrec 2023-11-09 10:29:43 +01:00
parent 4b9c866d76
commit 4ba3ad5409
2 changed files with 6 additions and 6 deletions

View File

@ -11,7 +11,7 @@ from typing import Optional, Sequence, Any, Callable, Generator, Dict, Tuple
from migen import *
from litex.gen.fhdl.namer import Namespace
from litex.gen.fhdl.namer import SignalNamespace
from litex.soc.interconnect import stream
@ -52,7 +52,7 @@ class GTKWSave:
"""
def __init__(self,
vns: Namespace,
vns: SignalNamespace,
savefile: str,
dumpfile: str,
filtersdir: str = None,
@ -62,7 +62,7 @@ class GTKWSave:
`prefix` is prepended to all signal names and defaults to the one used by Litex simulator.
"""
self.vns = vns # Namespace output of Builder.build, required to resolve signal names
self.vns = vns # SignalNamespace output of Builder.build, required to resolve signal names
self.prefix = prefix
self.savefile = savefile
self.dumpfile = dumpfile

View File

@ -386,7 +386,7 @@ def _build_signal_name_dict(signals):
# Signal Namespace Class ---------------------------------------------------------------------------
class _SignalNamespace:
class SignalNamespace:
"""
A _SignalNamespace object manages unique naming for signals within a hardware design.
@ -463,14 +463,14 @@ def build_signal_namespace(signals, reserved_keywords=set()):
reserved_keywords (set, optional): A set of keywords that cannot be used as signal names.
Returns:
Namespace: An object that contains the mapping of signals to unique names and provides methods to access them.
SignalNamespace: An object that contains the mapping of signals to unique names and provides methods to access them.
"""
# Create the primary signal-to-name dictionary.
pnd = _build_signal_name_dict(signals)
# Initialize the namespace with reserved keywords and the primary mapping.
namespace = _SignalNamespace(pnd, reserved_keywords)
namespace = SignalNamespace(pnd, reserved_keywords)
# Handle signals with overridden names, ensuring they are processed in a consistent order.
signals_with_name_override = filter(lambda s: s.name_override is not None, signals)