diff --git a/tb/arp_ep.py b/tb/arp_ep.py index 8c296bf14..f7909637c 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 260e765f3..185b1ac25 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 82123c2fe..a578b1500 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 dbabe9a3b..46a63f17d 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 4a9e2f2d9..03e633aeb 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 8e93c2993..2a4b3626b 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 a31451d44..537309e84 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 ff7483098..01b457187 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 23b01cbad..489ff043b 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 1d1c39e3e..417dc7100 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 b4571d53d..f25965141 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 6899a6665..461859e5d 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 8b4fe0bbf..c74132b5c 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 c2e108410..687605efd 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 db4cb1667..6cd5ab452 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 a80f9251e..7c723518c 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 c25275a5d..5215d82c4 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 dc99d0ef3..a6f122649 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 d3c086ef0..8c3216af8 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 699276ce1..d9cd5524f 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 2f539f4fc..0914cefe3 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 f8cb1e9d5..1d11f45da 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 d33a649af..090ce99a6 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 c877a68a7..987549ee0 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 b57963fac..8bda3a376 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 199fb08a6..afe1cbe7d 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 9399be2de..a4b9da14b 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 71089f1d9..b15abdaec 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 124309eff..e6fa9221e 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 add42f539..854b69992 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 e9a89bb5b..2c2b4757e 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 ff0f131a7..cab09c353 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 e05227351..b42196b9b 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 c68bb1a70..8c3fa6e34 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 f9b2f9666..707f7b764 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 f73631254..70eec26db 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 a1311ae37..6d276d06b 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 f0ba7e88f..4eb1b7bfe 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 d7f87954d..5ffb109ed 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 afd64ceb3..c42f7e749 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 30412987c..8db947c56 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 2ef007d4c..8748bccbe 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 976098c8f..4ac5616c7 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 aae612801..b860a05e7 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 7656167d0..659ffa83e 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 9f56e2bd0..755e13a47 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 dd1c54d10..56b6de966 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 e16978825..ef28100ac 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 08c670950..9dac1b9db 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 f50818cba..f70122101 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 98833866c..d9775d43f 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 6c3ff3411..705da471d 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 8cf0c9a1a..b4f304660 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 6b7047651..5e216ba2c 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 ab24c73c6..df95e52dd 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 be2f69062..98db8ce38 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 043fe8926..100d4400c 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 6a9d00382..d5b464b4a 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 177ef1896..197d85d33 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 95412139f..c814cc4cc 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)