From 5a4b480c7eb240dec7ac79de777120dedc74c757 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Sat, 21 Mar 2015 22:31:01 -0700 Subject: [PATCH] Update testbenches for python 3 --- tb/arp_ep.py | 10 +++++++--- tb/eth_ep.py | 10 +++++++--- tb/gmii_ep.py | 2 +- tb/ip_ep.py | 10 +++++++--- tb/test_arp.py | 8 ++++++-- tb/test_arp_64.py | 8 ++++++-- tb/test_arp_cache.py | 2 +- tb/test_arp_eth_rx.py | 8 ++++++-- tb/test_arp_eth_rx_64.py | 8 ++++++-- tb/test_arp_eth_tx.py | 8 ++++++-- tb/test_arp_eth_tx_64.py | 8 ++++++-- tb/test_axis_eth_fcs.py | 8 ++++++-- tb/test_axis_eth_fcs_64.py | 8 ++++++-- tb/test_axis_eth_fcs_check.py | 8 ++++++-- tb/test_axis_eth_fcs_insert.py | 8 ++++++-- tb/test_axis_eth_fcs_insert_64.py | 8 ++++++-- tb/test_axis_eth_fcs_insert_64_pad.py | 8 ++++++-- tb/test_axis_eth_fcs_insert_pad.py | 8 ++++++-- tb/test_eth_arb_mux_4.py | 8 ++++++-- tb/test_eth_arb_mux_64_4.py | 8 ++++++-- tb/test_eth_axis_rx.py | 8 ++++++-- tb/test_eth_axis_rx_64.py | 8 ++++++-- tb/test_eth_axis_tx.py | 8 ++++++-- tb/test_eth_axis_tx_64.py | 8 ++++++-- tb/test_eth_demux_4.py | 8 ++++++-- tb/test_eth_demux_64_4.py | 8 ++++++-- tb/test_eth_mac_1g.py | 8 ++++++-- tb/test_eth_mac_1g_rx.py | 8 ++++++-- tb/test_eth_mac_1g_tx.py | 8 ++++++-- tb/test_eth_mux_4.py | 8 ++++++-- tb/test_eth_mux_64_4.py | 8 ++++++-- tb/test_ip.py | 8 ++++++-- tb/test_ip_64.py | 8 ++++++-- tb/test_ip_arb_mux_4.py | 8 ++++++-- tb/test_ip_arb_mux_64_4.py | 8 ++++++-- tb/test_ip_complete.py | 8 ++++++-- tb/test_ip_complete_64.py | 8 ++++++-- tb/test_ip_demux_4.py | 8 ++++++-- tb/test_ip_demux_64_4.py | 8 ++++++-- tb/test_ip_eth_rx.py | 8 ++++++-- tb/test_ip_eth_rx_64.py | 8 ++++++-- tb/test_ip_eth_tx.py | 8 ++++++-- tb/test_ip_eth_tx_64.py | 8 ++++++-- tb/test_ip_mux_4.py | 8 ++++++-- tb/test_ip_mux_64_4.py | 8 ++++++-- tb/test_udp.py | 8 ++++++-- tb/test_udp_64.py | 8 ++++++-- tb/test_udp_arb_mux_4.py | 8 ++++++-- tb/test_udp_arb_mux_64_4.py | 8 ++++++-- tb/test_udp_complete.py | 8 ++++++-- tb/test_udp_complete_64.py | 8 ++++++-- tb/test_udp_demux_4.py | 8 ++++++-- tb/test_udp_demux_64_4.py | 8 ++++++-- tb/test_udp_ip_rx.py | 8 ++++++-- tb/test_udp_ip_rx_64.py | 8 ++++++-- tb/test_udp_ip_tx.py | 8 ++++++-- tb/test_udp_ip_tx_64.py | 8 ++++++-- tb/test_udp_mux_4.py | 8 ++++++-- tb/test_udp_mux_64_4.py | 8 ++++++-- tb/udp_ep.py | 10 +++++++--- 60 files changed, 354 insertions(+), 122 deletions(-) diff --git a/tb/arp_ep.py b/tb/arp_ep.py index 8c296bf1..f7909637 100644 --- a/tb/arp_ep.py +++ b/tb/arp_ep.py @@ -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): diff --git a/tb/eth_ep.py b/tb/eth_ep.py index 260e765f..185b1ac2 100644 --- a/tb/eth_ep.py +++ b/tb/eth_ep.py @@ -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) diff --git a/tb/gmii_ep.py b/tb/gmii_ep.py index 82123c2f..a578b150 100644 --- a/tb/gmii_ep.py +++ b/tb/gmii_ep.py @@ -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) diff --git a/tb/ip_ep.py b/tb/ip_ep.py index dbabe9a3..46a63f17 100644 --- a/tb/ip_ep.py +++ b/tb/ip_ep.py @@ -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) diff --git a/tb/test_arp.py b/tb/test_arp.py index 4a9e2f2d..03e633ae 100755 --- a/tb/test_arp.py +++ b/tb/test_arp.py @@ -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 diff --git a/tb/test_arp_64.py b/tb/test_arp_64.py index 8e93c299..2a4b3626 100755 --- a/tb/test_arp_64.py +++ b/tb/test_arp_64.py @@ -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 diff --git a/tb/test_arp_cache.py b/tb/test_arp_cache.py index a31451d4..537309e8 100755 --- a/tb/test_arp_cache.py +++ b/tb/test_arp_cache.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python """ Copyright (c) 2014 Alex Forencich diff --git a/tb/test_arp_eth_rx.py b/tb/test_arp_eth_rx.py index ff748309..01b45718 100755 --- a/tb/test_arp_eth_rx.py +++ b/tb/test_arp_eth_rx.py @@ -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 diff --git a/tb/test_arp_eth_rx_64.py b/tb/test_arp_eth_rx_64.py index 23b01cba..489ff043 100755 --- a/tb/test_arp_eth_rx_64.py +++ b/tb/test_arp_eth_rx_64.py @@ -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 diff --git a/tb/test_arp_eth_tx.py b/tb/test_arp_eth_tx.py index 1d1c39e3..417dc710 100755 --- a/tb/test_arp_eth_tx.py +++ b/tb/test_arp_eth_tx.py @@ -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 diff --git a/tb/test_arp_eth_tx_64.py b/tb/test_arp_eth_tx_64.py index b4571d53..f2596514 100755 --- a/tb/test_arp_eth_tx_64.py +++ b/tb/test_arp_eth_tx_64.py @@ -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 diff --git a/tb/test_axis_eth_fcs.py b/tb/test_axis_eth_fcs.py index 6899a666..461859e5 100755 --- a/tb/test_axis_eth_fcs.py +++ b/tb/test_axis_eth_fcs.py @@ -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 diff --git a/tb/test_axis_eth_fcs_64.py b/tb/test_axis_eth_fcs_64.py index 8b4fe0bb..c74132b5 100755 --- a/tb/test_axis_eth_fcs_64.py +++ b/tb/test_axis_eth_fcs_64.py @@ -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 diff --git a/tb/test_axis_eth_fcs_check.py b/tb/test_axis_eth_fcs_check.py index c2e10841..687605ef 100755 --- a/tb/test_axis_eth_fcs_check.py +++ b/tb/test_axis_eth_fcs_check.py @@ -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 diff --git a/tb/test_axis_eth_fcs_insert.py b/tb/test_axis_eth_fcs_insert.py index db4cb166..6cd5ab45 100755 --- a/tb/test_axis_eth_fcs_insert.py +++ b/tb/test_axis_eth_fcs_insert.py @@ -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 diff --git a/tb/test_axis_eth_fcs_insert_64.py b/tb/test_axis_eth_fcs_insert_64.py index a80f9251..7c723518 100755 --- a/tb/test_axis_eth_fcs_insert_64.py +++ b/tb/test_axis_eth_fcs_insert_64.py @@ -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 diff --git a/tb/test_axis_eth_fcs_insert_64_pad.py b/tb/test_axis_eth_fcs_insert_64_pad.py index c25275a5..5215d82c 100755 --- a/tb/test_axis_eth_fcs_insert_64_pad.py +++ b/tb/test_axis_eth_fcs_insert_64_pad.py @@ -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 diff --git a/tb/test_axis_eth_fcs_insert_pad.py b/tb/test_axis_eth_fcs_insert_pad.py index dc99d0ef..a6f12264 100755 --- a/tb/test_axis_eth_fcs_insert_pad.py +++ b/tb/test_axis_eth_fcs_insert_pad.py @@ -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 diff --git a/tb/test_eth_arb_mux_4.py b/tb/test_eth_arb_mux_4.py index d3c086ef..8c3216af 100755 --- a/tb/test_eth_arb_mux_4.py +++ b/tb/test_eth_arb_mux_4.py @@ -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 diff --git a/tb/test_eth_arb_mux_64_4.py b/tb/test_eth_arb_mux_64_4.py index 699276ce..d9cd5524 100755 --- a/tb/test_eth_arb_mux_64_4.py +++ b/tb/test_eth_arb_mux_64_4.py @@ -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 diff --git a/tb/test_eth_axis_rx.py b/tb/test_eth_axis_rx.py index 2f539f4f..0914cefe 100755 --- a/tb/test_eth_axis_rx.py +++ b/tb/test_eth_axis_rx.py @@ -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 diff --git a/tb/test_eth_axis_rx_64.py b/tb/test_eth_axis_rx_64.py index f8cb1e9d..1d11f45d 100755 --- a/tb/test_eth_axis_rx_64.py +++ b/tb/test_eth_axis_rx_64.py @@ -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 diff --git a/tb/test_eth_axis_tx.py b/tb/test_eth_axis_tx.py index d33a649a..090ce99a 100755 --- a/tb/test_eth_axis_tx.py +++ b/tb/test_eth_axis_tx.py @@ -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 diff --git a/tb/test_eth_axis_tx_64.py b/tb/test_eth_axis_tx_64.py index c877a68a..987549ee 100755 --- a/tb/test_eth_axis_tx_64.py +++ b/tb/test_eth_axis_tx_64.py @@ -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 diff --git a/tb/test_eth_demux_4.py b/tb/test_eth_demux_4.py index b57963fa..8bda3a37 100755 --- a/tb/test_eth_demux_4.py +++ b/tb/test_eth_demux_4.py @@ -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 diff --git a/tb/test_eth_demux_64_4.py b/tb/test_eth_demux_64_4.py index 199fb08a..afe1cbe7 100755 --- a/tb/test_eth_demux_64_4.py +++ b/tb/test_eth_demux_64_4.py @@ -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 diff --git a/tb/test_eth_mac_1g.py b/tb/test_eth_mac_1g.py index 9399be2d..a4b9da14 100755 --- a/tb/test_eth_mac_1g.py +++ b/tb/test_eth_mac_1g.py @@ -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 diff --git a/tb/test_eth_mac_1g_rx.py b/tb/test_eth_mac_1g_rx.py index 71089f1d..b15abdae 100755 --- a/tb/test_eth_mac_1g_rx.py +++ b/tb/test_eth_mac_1g_rx.py @@ -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 diff --git a/tb/test_eth_mac_1g_tx.py b/tb/test_eth_mac_1g_tx.py index 124309ef..e6fa9221 100755 --- a/tb/test_eth_mac_1g_tx.py +++ b/tb/test_eth_mac_1g_tx.py @@ -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 diff --git a/tb/test_eth_mux_4.py b/tb/test_eth_mux_4.py index add42f53..854b6999 100755 --- a/tb/test_eth_mux_4.py +++ b/tb/test_eth_mux_4.py @@ -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 diff --git a/tb/test_eth_mux_64_4.py b/tb/test_eth_mux_64_4.py index e9a89bb5..2c2b4757 100755 --- a/tb/test_eth_mux_64_4.py +++ b/tb/test_eth_mux_64_4.py @@ -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 diff --git a/tb/test_ip.py b/tb/test_ip.py index ff0f131a..cab09c35 100755 --- a/tb/test_ip.py +++ b/tb/test_ip.py @@ -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 diff --git a/tb/test_ip_64.py b/tb/test_ip_64.py index e0522735..b42196b9 100755 --- a/tb/test_ip_64.py +++ b/tb/test_ip_64.py @@ -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 diff --git a/tb/test_ip_arb_mux_4.py b/tb/test_ip_arb_mux_4.py index c68bb1a7..8c3fa6e3 100755 --- a/tb/test_ip_arb_mux_4.py +++ b/tb/test_ip_arb_mux_4.py @@ -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 diff --git a/tb/test_ip_arb_mux_64_4.py b/tb/test_ip_arb_mux_64_4.py index f9b2f966..707f7b76 100755 --- a/tb/test_ip_arb_mux_64_4.py +++ b/tb/test_ip_arb_mux_64_4.py @@ -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 diff --git a/tb/test_ip_complete.py b/tb/test_ip_complete.py index f7363125..70eec26d 100755 --- a/tb/test_ip_complete.py +++ b/tb/test_ip_complete.py @@ -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 diff --git a/tb/test_ip_complete_64.py b/tb/test_ip_complete_64.py index a1311ae3..6d276d06 100755 --- a/tb/test_ip_complete_64.py +++ b/tb/test_ip_complete_64.py @@ -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 diff --git a/tb/test_ip_demux_4.py b/tb/test_ip_demux_4.py index f0ba7e88..4eb1b7bf 100755 --- a/tb/test_ip_demux_4.py +++ b/tb/test_ip_demux_4.py @@ -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 diff --git a/tb/test_ip_demux_64_4.py b/tb/test_ip_demux_64_4.py index d7f87954..5ffb109e 100755 --- a/tb/test_ip_demux_64_4.py +++ b/tb/test_ip_demux_64_4.py @@ -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 diff --git a/tb/test_ip_eth_rx.py b/tb/test_ip_eth_rx.py index afd64ceb..c42f7e74 100755 --- a/tb/test_ip_eth_rx.py +++ b/tb/test_ip_eth_rx.py @@ -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 diff --git a/tb/test_ip_eth_rx_64.py b/tb/test_ip_eth_rx_64.py index 30412987..8db947c5 100755 --- a/tb/test_ip_eth_rx_64.py +++ b/tb/test_ip_eth_rx_64.py @@ -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 diff --git a/tb/test_ip_eth_tx.py b/tb/test_ip_eth_tx.py index 2ef007d4..8748bccb 100755 --- a/tb/test_ip_eth_tx.py +++ b/tb/test_ip_eth_tx.py @@ -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 diff --git a/tb/test_ip_eth_tx_64.py b/tb/test_ip_eth_tx_64.py index 976098c8..4ac5616c 100755 --- a/tb/test_ip_eth_tx_64.py +++ b/tb/test_ip_eth_tx_64.py @@ -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 diff --git a/tb/test_ip_mux_4.py b/tb/test_ip_mux_4.py index aae61280..b860a05e 100755 --- a/tb/test_ip_mux_4.py +++ b/tb/test_ip_mux_4.py @@ -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 diff --git a/tb/test_ip_mux_64_4.py b/tb/test_ip_mux_64_4.py index 7656167d..659ffa83 100755 --- a/tb/test_ip_mux_64_4.py +++ b/tb/test_ip_mux_64_4.py @@ -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 diff --git a/tb/test_udp.py b/tb/test_udp.py index 9f56e2bd..755e13a4 100755 --- a/tb/test_udp.py +++ b/tb/test_udp.py @@ -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 diff --git a/tb/test_udp_64.py b/tb/test_udp_64.py index dd1c54d1..56b6de96 100755 --- a/tb/test_udp_64.py +++ b/tb/test_udp_64.py @@ -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 diff --git a/tb/test_udp_arb_mux_4.py b/tb/test_udp_arb_mux_4.py index e1697882..ef28100a 100755 --- a/tb/test_udp_arb_mux_4.py +++ b/tb/test_udp_arb_mux_4.py @@ -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 diff --git a/tb/test_udp_arb_mux_64_4.py b/tb/test_udp_arb_mux_64_4.py index 08c67095..9dac1b9d 100755 --- a/tb/test_udp_arb_mux_64_4.py +++ b/tb/test_udp_arb_mux_64_4.py @@ -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 diff --git a/tb/test_udp_complete.py b/tb/test_udp_complete.py index f50818cb..f7012210 100755 --- a/tb/test_udp_complete.py +++ b/tb/test_udp_complete.py @@ -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 diff --git a/tb/test_udp_complete_64.py b/tb/test_udp_complete_64.py index 98833866..d9775d43 100755 --- a/tb/test_udp_complete_64.py +++ b/tb/test_udp_complete_64.py @@ -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 diff --git a/tb/test_udp_demux_4.py b/tb/test_udp_demux_4.py index 6c3ff341..705da471 100755 --- a/tb/test_udp_demux_4.py +++ b/tb/test_udp_demux_4.py @@ -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 diff --git a/tb/test_udp_demux_64_4.py b/tb/test_udp_demux_64_4.py index 8cf0c9a1..b4f30466 100755 --- a/tb/test_udp_demux_64_4.py +++ b/tb/test_udp_demux_64_4.py @@ -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 diff --git a/tb/test_udp_ip_rx.py b/tb/test_udp_ip_rx.py index 6b704765..5e216ba2 100755 --- a/tb/test_udp_ip_rx.py +++ b/tb/test_udp_ip_rx.py @@ -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 diff --git a/tb/test_udp_ip_rx_64.py b/tb/test_udp_ip_rx_64.py index ab24c73c..df95e52d 100755 --- a/tb/test_udp_ip_rx_64.py +++ b/tb/test_udp_ip_rx_64.py @@ -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 diff --git a/tb/test_udp_ip_tx.py b/tb/test_udp_ip_tx.py index be2f6906..98db8ce3 100755 --- a/tb/test_udp_ip_tx.py +++ b/tb/test_udp_ip_tx.py @@ -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 diff --git a/tb/test_udp_ip_tx_64.py b/tb/test_udp_ip_tx_64.py index 043fe892..100d4400 100755 --- a/tb/test_udp_ip_tx_64.py +++ b/tb/test_udp_ip_tx_64.py @@ -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 diff --git a/tb/test_udp_mux_4.py b/tb/test_udp_mux_4.py index 6a9d0038..d5b464b4 100755 --- a/tb/test_udp_mux_4.py +++ b/tb/test_udp_mux_4.py @@ -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 diff --git a/tb/test_udp_mux_64_4.py b/tb/test_udp_mux_64_4.py index 177ef189..197d85d3 100755 --- a/tb/test_udp_mux_64_4.py +++ b/tb/test_udp_mux_64_4.py @@ -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 diff --git a/tb/udp_ep.py b/tb/udp_ep.py index 95412139..c814cc4c 100644 --- a/tb/udp_ep.py +++ b/tb/udp_ep.py @@ -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)