Replace SimLog with logger

This commit is contained in:
Alex Forencich
2020-12-10 02:20:14 -08:00
parent e6e8a06dfe
commit 2451921923
6 changed files with 22 additions and 20 deletions

View File

@@ -22,11 +22,11 @@ THE SOFTWARE.
"""
import logging
from collections import deque, namedtuple, Counter
import cocotb
from cocotb.triggers import Event
from cocotb.log import SimLog
from .version import __version__
from .constants import AxiBurstType, AxiLockType, AxiProt, AxiResp
@@ -49,7 +49,7 @@ AxiReadResp = namedtuple("AxiReadResp", ["address", "data", "resp", "user"])
class AxiMasterWrite(object):
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI master (write)")
self.log.info("cocotbext-axi version %s", __version__)
@@ -365,7 +365,7 @@ class AxiMasterWrite(object):
class AxiMasterRead(object):
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI master (read)")
self.log.info("cocotbext-axi version %s", __version__)

View File

@@ -22,8 +22,9 @@ THE SOFTWARE.
"""
import logging
import cocotb
from cocotb.log import SimLog
from .version import __version__
from .constants import AxiBurstType, AxiProt, AxiResp
@@ -33,7 +34,7 @@ from .memory import Memory
class AxiRamWrite(Memory):
def __init__(self, entity, name, clock, reset=None, size=1024, mem=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI RAM model (write)")
self.log.info("cocotbext-axi version %s", __version__)
@@ -145,7 +146,7 @@ class AxiRamWrite(Memory):
class AxiRamRead(Memory):
def __init__(self, entity, name, clock, reset=None, size=1024, mem=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI RAM model (read)")
self.log.info("cocotbext-axi version %s", __version__)

View File

@@ -22,11 +22,11 @@ THE SOFTWARE.
"""
import logging
from collections import deque, namedtuple
import cocotb
from cocotb.triggers import Event
from cocotb.log import SimLog
from .version import __version__
from .constants import AxiProt, AxiResp
@@ -45,7 +45,7 @@ AxiLiteReadResp = namedtuple("AxiLiteReadResp", ["address", "data", "resp"])
class AxiLiteMasterWrite(object):
def __init__(self, entity, name, clock, reset=None):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI lite master (write)")
self.log.info("cocotbext-axi version %s", __version__)
@@ -231,7 +231,7 @@ class AxiLiteMasterWrite(object):
class AxiLiteMasterRead(object):
def __init__(self, entity, name, clock, reset=None):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI lite master (read)")
self.log.info("cocotbext-axi version %s", __version__)

View File

@@ -22,8 +22,9 @@ THE SOFTWARE.
"""
import logging
import cocotb
from cocotb.log import SimLog
from .version import __version__
from .constants import AxiProt, AxiResp
@@ -33,7 +34,7 @@ from .memory import Memory
class AxiLiteRamWrite(Memory):
def __init__(self, entity, name, clock, reset=None, size=1024, mem=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI lite RAM model (write)")
self.log.info("cocotbext-axi version %s", __version__)
@@ -103,7 +104,7 @@ class AxiLiteRamWrite(Memory):
class AxiLiteRamRead(Memory):
def __init__(self, entity, name, clock, reset=None, size=1024, mem=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.log.info("AXI lite RAM model (read)")
self.log.info("cocotbext-axi version %s", __version__)

View File

@@ -22,12 +22,12 @@ THE SOFTWARE.
"""
import logging
from collections import deque
import cocotb
from cocotb.triggers import RisingEdge, ReadOnly, Timer, First, Event
from cocotb.bus import Bus
from cocotb.log import SimLog
from .version import __version__
@@ -215,7 +215,7 @@ class AxiStreamSource(object):
_optional_signals = ["tvalid", "tready", "tlast", "tkeep", "tid", "tdest", "tuser"]
def __init__(self, entity, name, clock, reset=None, byte_size=None, byte_lanes=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.entity = entity
self.clock = clock
self.reset = reset
@@ -429,7 +429,7 @@ class AxiStreamSink(object):
_optional_signals = ["tvalid", "tready", "tlast", "tkeep", "tid", "tdest", "tuser"]
def __init__(self, entity, name, clock, reset=None, byte_size=None, byte_lanes=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.entity = entity
self.clock = clock
self.reset = reset
@@ -632,7 +632,7 @@ class AxiStreamMonitor(object):
_optional_signals = ["tvalid", "tready", "tlast", "tkeep", "tid", "tdest", "tuser"]
def __init__(self, entity, name, clock, reset=None, byte_size=None, byte_lanes=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.entity = entity
self.clock = clock
self.reset = reset

View File

@@ -22,12 +22,12 @@ THE SOFTWARE.
"""
import logging
from collections import deque
import cocotb
from cocotb.triggers import RisingEdge, ReadOnly, Event, First, Timer
from cocotb.bus import Bus
from cocotb.log import SimLog
from collections import deque
class StreamTransaction(object):
@@ -65,7 +65,7 @@ class StreamBase(object):
_transaction_obj = StreamTransaction
def __init__(self, entity, name, clock, reset=None, *args, **kwargs):
self.log = SimLog("cocotb.%s.%s" % (entity._name, name))
self.log = logging.getLogger(f"cocotb.{entity._name}.{name}")
self.entity = entity
self.clock = clock
self.reset = reset