bench: hw_itl: Add comments
This commit is contained in:
parent
fd721ae24f
commit
0e80900426
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import cocotb
|
import cocotb
|
||||||
from cocotb.triggers import *
|
from cocotb.triggers import *
|
||||||
@ -14,6 +14,13 @@ import os
|
|||||||
import asyncio
|
import asyncio
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
||||||
|
'''
|
||||||
|
# Set up virtual device using
|
||||||
|
sudo ip link add virt0 type dummy
|
||||||
|
sudo ip link set up virt0
|
||||||
|
sudo ip addr add 192.168.2.10/24 dev virt0
|
||||||
|
'''
|
||||||
|
|
||||||
class MacDevReceiver():
|
class MacDevReceiver():
|
||||||
def __init__(self, dut, eth_tx, eth_rx, dev):
|
def __init__(self, dut, eth_tx, eth_rx, dev):
|
||||||
self.dut = dut
|
self.dut = dut
|
||||||
@ -28,7 +35,7 @@ class MacDevReceiver():
|
|||||||
ETH_P_ALL=3
|
ETH_P_ALL=3
|
||||||
self.macdev=socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(ETH_P_ALL))
|
self.macdev=socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(ETH_P_ALL))
|
||||||
self.macdev.bind((dev, 0))
|
self.macdev.bind((dev, 0))
|
||||||
fcntl.fcntl(self.macdev, fcntl.F_SETFL, os.O_NONBLOCK)
|
fcntl.fcntl(self.macdev, fcntl.F_SETFL, os.O_NONBLOCK) # Not the best way to poll, but I couldn't get asyncio to play nicely with threading...
|
||||||
|
|
||||||
async def main(self):
|
async def main(self):
|
||||||
ETH_HEAD = b'\x55\x55\x55\x55\xD5'
|
ETH_HEAD = b'\x55\x55\x55\x55\xD5'
|
||||||
|
Loading…
Reference in New Issue
Block a user