Lazy logging

This commit is contained in:
Alex Forencich
2021-11-09 00:53:37 -08:00
parent 43de2ea9b0
commit 3fd016a84c
4 changed files with 31 additions and 23 deletions

View File

@@ -397,6 +397,7 @@ class AxiMasterWrite(Reset):
wuser = cmd.wuser wuser = cmd.wuser
if self.log.isEnabledFor(logging.INFO):
self.log.info("Write start addr: 0x%08x awid: 0x%x prot: %s data: %s", self.log.info("Write start addr: 0x%08x awid: 0x%x prot: %s data: %s",
cmd.address, awid, cmd.prot, ' '.join((f'{c:02x}' for c in cmd.data))) cmd.address, awid, cmd.prot, ' '.join((f'{c:02x}' for c in cmd.data)))
@@ -884,6 +885,7 @@ class AxiMasterRead(Reset):
if not self.ruser_present: if not self.ruser_present:
user = None user = None
if self.log.isEnabledFor(logging.INFO):
self.log.info("Read complete addr: 0x%08x prot: %s resp: %s data: %s", self.log.info("Read complete addr: 0x%08x prot: %s resp: %s data: %s",
cmd.address, cmd.prot, resp, ' '.join((f'{c:02x}' for c in data))) cmd.address, cmd.prot, resp, ' '.join((f'{c:02x}' for c in data)))

View File

@@ -147,6 +147,7 @@ class AxiRamWrite(Memory, Reset):
data = data.to_bytes(self.byte_lanes, 'little') data = data.to_bytes(self.byte_lanes, 'little')
if self.log.isEnabledFor(logging.DEBUG):
self.log.debug("Write word awid: 0x%x addr: 0x%08x wstrb: 0x%02x data: %s", self.log.debug("Write word awid: 0x%x addr: 0x%08x wstrb: 0x%02x data: %s",
awid, cur_addr, strb, ' '.join((f'{c:02x}' for c in data))) awid, cur_addr, strb, ' '.join((f'{c:02x}' for c in data)))
@@ -281,6 +282,7 @@ class AxiRamRead(Memory, Reset):
await self.r_channel.send(r) await self.r_channel.send(r)
if self.log.isEnabledFor(logging.DEBUG):
self.log.debug("Read word awid: 0x%x addr: 0x%08x data: %s", self.log.debug("Read word awid: 0x%x addr: 0x%08x data: %s",
arid, cur_addr, ' '.join((f'{c:02x}' for c in data))) arid, cur_addr, ' '.join((f'{c:02x}' for c in data)))

View File

@@ -222,6 +222,7 @@ class AxiLiteMasterWrite(Reset):
offset = 0 offset = 0
if self.log.isEnabledFor(logging.INFO):
self.log.info("Write start addr: 0x%08x prot: %s data: %s", self.log.info("Write start addr: 0x%08x prot: %s data: %s",
cmd.address, cmd.prot, ' '.join((f'{c:02x}' for c in cmd.data))) cmd.address, cmd.prot, ' '.join((f'{c:02x}' for c in cmd.data)))
@@ -493,6 +494,7 @@ class AxiLiteMasterRead(Reset):
for j in range(start, stop): for j in range(start, stop):
data.extend(bytearray([(cycle_data >> j*8) & 0xff])) data.extend(bytearray([(cycle_data >> j*8) & 0xff]))
if self.log.isEnabledFor(logging.INFO):
self.log.info("Read complete addr: 0x%08x prot: %s resp: %s data: %s", self.log.info("Read complete addr: 0x%08x prot: %s resp: %s data: %s",
cmd.address, cmd.prot, resp, ' '.join((f'{c:02x}' for c in data))) cmd.address, cmd.prot, resp, ' '.join((f'{c:02x}' for c in data)))

View File

@@ -113,6 +113,7 @@ class AxiLiteRamWrite(Memory, Reset):
data = data.to_bytes(self.byte_lanes, 'little') data = data.to_bytes(self.byte_lanes, 'little')
if self.log.isEnabledFor(logging.INFO):
self.log.info("Write data awaddr: 0x%08x awprot: %s wstrb: 0x%02x data: %s", self.log.info("Write data awaddr: 0x%08x awprot: %s wstrb: 0x%02x data: %s",
addr, prot, strb, ' '.join((f'{c:02x}' for c in data))) addr, prot, strb, ' '.join((f'{c:02x}' for c in data)))
@@ -204,6 +205,7 @@ class AxiLiteRamRead(Memory, Reset):
await self.r_channel.send(r) await self.r_channel.send(r)
if self.log.isEnabledFor(logging.INFO):
self.log.info("Read data araddr: 0x%08x arprot: %s data: %s", self.log.info("Read data araddr: 0x%08x arprot: %s data: %s",
addr, prot, ' '.join((f'{c:02x}' for c in data))) addr, prot, ' '.join((f'{c:02x}' for c in data)))