Update testbenches for python 3

This commit is contained in:
Alex Forencich 2015-03-21 22:31:01 -07:00
parent 101d963c09
commit 5a4b480c7e
60 changed files with 354 additions and 122 deletions

View File

@ -25,9 +25,13 @@ THE SOFTWARE.
from myhdl import *
import axis_ep
import eth_ep
from Queue import Queue
import struct
try:
from queue import Queue
except ImportError:
from Queue import Queue
class ARPFrame(object):
def __init__(self,
eth_dest_mac=0,
@ -116,9 +120,9 @@ class ARPFrame(object):
self.arp_hlen = struct.unpack('B', data.payload.data[4:5])[0]
self.arp_plen = struct.unpack('B', data.payload.data[5:6])[0]
self.arp_oper = struct.unpack('>H', data.payload.data[6:8])[0]
self.arp_sha = struct.unpack('>Q', '\x00\x00'+data.payload.data[8:14])[0]
self.arp_sha = struct.unpack('>Q', b'\x00\x00'+data.payload.data[8:14])[0]
self.arp_spa = struct.unpack('>L', data.payload.data[14:18])[0]
self.arp_tha = struct.unpack('>Q', '\x00\x00'+data.payload.data[18:24])[0]
self.arp_tha = struct.unpack('>Q', b'\x00\x00'+data.payload.data[18:24])[0]
self.arp_tpa = struct.unpack('>L', data.payload.data[24:28])[0]
def __eq__(self, other):

View File

@ -24,10 +24,14 @@ THE SOFTWARE.
from myhdl import *
import axis_ep
from Queue import Queue
import struct
import zlib
try:
from queue import Queue
except ImportError:
from Queue import Queue
class EthFrame(object):
def __init__(self, payload=b'', eth_dest_mac=0, eth_src_mac=0, eth_type=0, eth_fcs=None):
self._payload = axis_ep.AXIStreamFrame()
@ -92,8 +96,8 @@ class EthFrame(object):
def parse_axis(self, data):
data = axis_ep.AXIStreamFrame(data).data
self.eth_dest_mac = struct.unpack('>Q', '\x00\x00'+data[0:6])[0]
self.eth_src_mac = struct.unpack('>Q', '\x00\x00'+data[6:12])[0]
self.eth_dest_mac = struct.unpack('>Q', b'\x00\x00'+data[0:6])[0]
self.eth_src_mac = struct.unpack('>Q', b'\x00\x00'+data[6:12])[0]
self.eth_type = struct.unpack('>H', data[12:14])[0]
data = data[14:]
self.payload = axis_ep.AXIStreamFrame(data)

View File

@ -55,7 +55,7 @@ def GMIISource(clk, rst,
if len(frame) == 0:
ifg_cnt = 12
elif not fifo.empty():
frame = fifo.get()
frame = list(fifo.get())
if name is not None:
print("[%s] Sending frame %s" % (name, repr(frame)))
txd.next = frame.pop(0)

View File

@ -25,11 +25,15 @@ THE SOFTWARE.
from myhdl import *
import axis_ep
import eth_ep
from Queue import Queue
import struct
try:
from queue import Queue
except ImportError:
from Queue import Queue
class IPFrame(object):
def __init__(self, payload='',
def __init__(self, payload=b'',
eth_dest_mac=0,
eth_src_mac=0,
eth_type=0,
@ -145,7 +149,7 @@ class IPFrame(object):
def build_eth(self):
self.build()
data = ''
data = b''
data += struct.pack('B', self.ip_version << 4 | self.ip_ihl)
data += struct.pack('B', self.ip_dscp << 2 | self.ip_ecn)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import arp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import arp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import arp_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import arp_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,10 +25,14 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
import struct
import zlib
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,10 +25,14 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
import struct
import zlib
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,10 +25,14 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
import struct
import zlib
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,10 +25,14 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
import struct
import zlib
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,10 +25,14 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
import struct
import zlib
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2015 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import axis_ep
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import arp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import arp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import udp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import udp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import arp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import arp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import udp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import udp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import eth_ep
import ip_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import udp_ep

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
"""
Copyright (c) 2014 Alex Forencich
@ -25,7 +25,11 @@ THE SOFTWARE.
from myhdl import *
import os
from Queue import Queue
try:
from queue import Queue
except ImportError:
from Queue import Queue
import udp_ep

View File

@ -26,11 +26,15 @@ from myhdl import *
import axis_ep
import eth_ep
import ip_ep
from Queue import Queue
import struct
try:
from queue import Queue
except ImportError:
from Queue import Queue
class UDPFrame(object):
def __init__(self, payload='',
def __init__(self, payload=b'',
eth_dest_mac=0,
eth_src_mac=0,
eth_type=0,
@ -204,7 +208,7 @@ class UDPFrame(object):
def build_ip(self):
self.build()
data = ''
data = b''
data += struct.pack('>H', self.udp_source_port)
data += struct.pack('>H', self.udp_dest_port)