mirror of
https://github.com/alexforencich/verilog-ethernet.git
synced 2025-01-28 07:03:08 +08:00
Be more pythonic
This commit is contained in:
parent
c5837daa2f
commit
2ebffeb223
@ -261,7 +261,7 @@ class AXIStreamSource(object):
|
|||||||
return len(self.queue)
|
return len(self.queue)
|
||||||
|
|
||||||
def empty(self):
|
def empty(self):
|
||||||
return self.count() == 0
|
return not self.queue
|
||||||
|
|
||||||
def create_logic(self,
|
def create_logic(self,
|
||||||
clk,
|
clk,
|
||||||
@ -376,12 +376,12 @@ class AXIStreamSink(object):
|
|||||||
self.read_queue = []
|
self.read_queue = []
|
||||||
|
|
||||||
def recv(self):
|
def recv(self):
|
||||||
if len(self.queue) > 0:
|
if self.queue:
|
||||||
return self.queue.pop(0)
|
return self.queue.pop(0)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def read(self, count=-1):
|
def read(self, count=-1):
|
||||||
while len(self.queue) > 0:
|
while self.queue:
|
||||||
self.read_queue.extend(self.queue.pop(0).data)
|
self.read_queue.extend(self.queue.pop(0).data)
|
||||||
if count < 0:
|
if count < 0:
|
||||||
count = len(self.read_queue)
|
count = len(self.read_queue)
|
||||||
@ -393,7 +393,7 @@ class AXIStreamSink(object):
|
|||||||
return len(self.queue)
|
return len(self.queue)
|
||||||
|
|
||||||
def empty(self):
|
def empty(self):
|
||||||
return self.count() == 0
|
return not self.queue
|
||||||
|
|
||||||
def create_logic(self,
|
def create_logic(self,
|
||||||
clk,
|
clk,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user