From 31a1d39cf329012d821c15ea43198151b3ced89c Mon Sep 17 00:00:00 2001 From: Colin Marquardt Date: Wed, 17 Jul 2024 19:42:33 +0200 Subject: [PATCH] Import hexdump from scapy.utils --- src/cocotb_bus/drivers/avalon.py | 5 +++-- src/cocotb_bus/drivers/xgmii.py | 3 ++- src/cocotb_bus/monitors/avalon.py | 5 +++-- src/cocotb_bus/monitors/xgmii.py | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cocotb_bus/drivers/avalon.py b/src/cocotb_bus/drivers/avalon.py index 34e36a8e..200143ce 100644 --- a/src/cocotb_bus/drivers/avalon.py +++ b/src/cocotb_bus/drivers/avalon.py @@ -14,10 +14,11 @@ import random from typing import Iterable, Union, Optional +from scapy.utils import hexdump + import cocotb from cocotb.decorators import coroutine from cocotb.triggers import RisingEdge, FallingEdge, ReadOnly, NextTimeStep -from cocotb.utils import hexdump from cocotb.binary import BinaryValue from cocotb.result import TestError @@ -790,7 +791,7 @@ async def _driver_send(self, pkt: Union[bytes, Iterable], sync: bool = True, cha # Avoid spurious object creation by recycling if isinstance(pkt, bytes): self.log.debug("Sending packet of length %d bytes", len(pkt)) - self.log.debug(hexdump(pkt)) + self.log.debug("Packet:", hexdump(pkt)) await self._send_string(pkt, sync=sync, channel=channel) self.log.debug("Successfully sent packet of length %d bytes", len(pkt)) elif isinstance(pkt, str): diff --git a/src/cocotb_bus/drivers/xgmii.py b/src/cocotb_bus/drivers/xgmii.py index a6bfeddf..fefa065a 100644 --- a/src/cocotb_bus/drivers/xgmii.py +++ b/src/cocotb_bus/drivers/xgmii.py @@ -8,8 +8,9 @@ import struct import zlib +from scapy.utils import hexdump + from cocotb.triggers import RisingEdge -from cocotb.utils import hexdump from cocotb.binary import BinaryValue from cocotb.handle import SimHandleBase diff --git a/src/cocotb_bus/monitors/avalon.py b/src/cocotb_bus/monitors/avalon.py index 7b4b095a..ab8dcedf 100644 --- a/src/cocotb_bus/monitors/avalon.py +++ b/src/cocotb_bus/monitors/avalon.py @@ -13,7 +13,8 @@ import warnings -from cocotb.utils import hexdump +from scapy.utils import hexdump + from cocotb.triggers import RisingEdge from cocotb.binary import BinaryValue @@ -190,7 +191,7 @@ def valid(): if self.bus.endofpacket.value: self.log.info("Received a packet of %d bytes", len(pkt)) - self.log.debug(hexdump(pkt)) + self.log.debug("Packet:", hexdump(pkt)) self.channel = channel if self.report_channel: self._recv({"data": pkt, "channel": channel}) diff --git a/src/cocotb_bus/monitors/xgmii.py b/src/cocotb_bus/monitors/xgmii.py index 8d9bef1a..bf3c5c12 100644 --- a/src/cocotb_bus/monitors/xgmii.py +++ b/src/cocotb_bus/monitors/xgmii.py @@ -15,7 +15,8 @@ import struct import zlib -from cocotb.utils import hexdump +from scapy.utils import hexdump + from cocotb.triggers import RisingEdge from cocotb_bus.monitors import Monitor