Skip to content

Commit

Permalink
Import hexdump from scapy.utils
Browse files Browse the repository at this point in the history
  • Loading branch information
cmarqu committed Jul 17, 2024
1 parent e749d69 commit 31a1d39
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/cocotb_bus/drivers/avalon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion src/cocotb_bus/drivers/xgmii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions src/cocotb_bus/monitors/avalon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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})
Expand Down
3 changes: 2 additions & 1 deletion src/cocotb_bus/monitors/xgmii.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31a1d39

Please sign in to comment.