コード例 #1
0
ファイル: log.py プロジェクト: axelomega/cocotb
    def format(self, record):
        """pretify the log output, annotate with simulation time"""
        if record.args: msg = record.msg % record.args
        else:           msg = record.msg

        msg = str(msg)
        level = record.levelname.ljust(_LEVEL_CHARS)
        timeh, timel = simulator.get_sim_time()

        return self._format(timeh, timel, level, record, msg)
コード例 #2
0
ファイル: log.py プロジェクト: axelomega/cocotb
    def format(self, record):
        """pretify the log output, annotate with simulation time"""

        if record.args: msg = record.msg % record.args
        else:           msg = record.msg

        msg = SimColourLogFormatter.loglevel2colour[record.levelno] % msg
        level = SimColourLogFormatter.loglevel2colour[record.levelno] % \
                                        record.levelname.ljust(_LEVEL_CHARS)

        timeh, timel = simulator.get_sim_time()
        return self._format(timeh, timel, level, record, msg)
コード例 #3
0
ファイル: utils.py プロジェクト: mciepluc/cocotb
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator

    Kwargs:
        units (str):  String specifying the units of the result. (None,'fs','ps','ns','us','ms','sec')
                      None will return the raw simulation time.

    Returns:
        The simulation time in the specified units
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result
コード例 #4
0
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator

    Kwargs:
        units (str):  String specifying the units of the result. (None,'fs','ps','ns','us','ms','sec')
                      None will return the raw simulation time.

    Returns:
        The simulation time in the specified units
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result
コード例 #5
0
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator.

    Args:
        units (str or None, optional): String specifying the units of the result
            (one of ``None``, ``'fs'``, ``'ps'``, ``'ns'``, ``'us'``, ``'ms'``, ``'sec'``).
            ``None`` will return the raw simulation time.

    Returns:
        The simulation time in the specified units.
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result
コード例 #6
0
ファイル: utils.py プロジェクト: TC01/cocotb
def get_sim_time(units=None):
    """Retrieves the simulation time from the simulator.

    Args:
        units (str or None, optional): String specifying the units of the result
            (one of ``None``, ``'fs'``, ``'ps'``, ``'ns'``, ``'us'``, ``'ms'``, ``'sec'``).
            ``None`` will return the raw simulation time.

    Returns:
        The simulation time in the specified units.
    """
    timeh, timel = simulator.get_sim_time()

    result = (timeh << 32 | timel)

    if units is not None:
        result = get_time_from_sim_steps(result, units)

    return result