From ded363b471659ec93e3cba6f86f401ffdde33d96 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Thu, 25 Oct 2018 15:36:34 -0700 Subject: [PATCH] Rename status outputs --- rtl/axis_fifo.v | 12 ++-- tb/axis_ep.py | 27 ++++++-- tb/test_axis_fifo.v | 6 +- tb/test_axis_fifo_64.v | 6 +- tb/test_axis_frame_fifo.py | 126 +++++++++++++++++----------------- tb/test_axis_frame_fifo.v | 18 ++--- tb/test_axis_frame_fifo_64.py | 126 +++++++++++++++++----------------- tb/test_axis_frame_fifo_64.v | 18 ++--- 8 files changed, 177 insertions(+), 162 deletions(-) diff --git a/rtl/axis_fifo.v b/rtl/axis_fifo.v index 37e249f4..de2e90c1 100644 --- a/rtl/axis_fifo.v +++ b/rtl/axis_fifo.v @@ -79,9 +79,9 @@ module axis_fifo # /* * Status */ - output wire overflow, - output wire bad_frame, - output wire good_frame + output wire status_overflow, + output wire status_bad_frame, + output wire status_good_frame ); // check configuration @@ -168,9 +168,9 @@ assign m_axis_tid = ID_ENABLE ? m_axis_reg[ID_OFFSET +: ID_WIDTH] : {ID_ assign m_axis_tdest = DEST_ENABLE ? m_axis_reg[DEST_OFFSET +: DEST_WIDTH] : {DEST_WIDTH{1'b0}}; assign m_axis_tuser = USER_ENABLE ? m_axis_reg[USER_OFFSET +: USER_WIDTH] : {USER_WIDTH{1'b0}}; -assign overflow = overflow_reg; -assign bad_frame = bad_frame_reg; -assign good_frame = good_frame_reg; +assign status_overflow = overflow_reg; +assign status_bad_frame = bad_frame_reg; +assign status_good_frame = good_frame_reg; // Write logic always @* begin diff --git a/tb/axis_ep.py b/tb/axis_ep.py index 67417520..d794cc4a 100644 --- a/tb/axis_ep.py +++ b/tb/axis_ep.py @@ -248,6 +248,7 @@ class AXIStreamFrame(object): class AXIStreamSource(object): def __init__(self): + self.active = False self.has_logic = False self.queue = [] @@ -263,6 +264,13 @@ class AXIStreamSource(object): def empty(self): return not self.queue + def idle(self): + return not self.queue and not self.active + + def wait(self): + while not self.idle(): + yield self.clk.posedge + def create_logic(self, clk, rst, @@ -289,7 +297,7 @@ class AXIStreamSource(object): id = [] dest = [] user = [] - valid = False + self.active = False B = 0 N = len(tdata) M = len(tkeep) @@ -311,7 +319,7 @@ class AXIStreamSource(object): id = [] dest = [] user = [] - valid = False + self.active = False if B > 0: for s in tdata: s.next = 0 @@ -324,7 +332,7 @@ class AXIStreamSource(object): tvalid.next = False tlast.next = False else: - tvalid.next = valid and (tvalid or not pause) + tvalid.next = self.active and (tvalid or not pause) if tready and tvalid: if len(data) > 0: if B > 0: @@ -342,8 +350,8 @@ class AXIStreamSource(object): else: tvalid.next = False tlast.next = False - valid = False - if not valid and self.queue: + self.active = False + if not self.active and self.queue: frame = self.queue.pop(0) frame.B = B frame.N = N @@ -364,13 +372,14 @@ class AXIStreamSource(object): tuser.next = user.pop(0) tvalid.next = not pause tlast.next = len(data) == 0 - valid = True + self.active = True return instances() class AXIStreamSink(object): def __init__(self): + self.active = False self.has_logic = False self.queue = [] self.read_queue = [] @@ -396,6 +405,9 @@ class AXIStreamSink(object): def empty(self): return not self.queue + def idle(self): + return not self.active + def wait(self, timeout=0): if self.queue: return @@ -462,6 +474,7 @@ class AXIStreamSink(object): dest = [] user = [] first = True + self.active = False else: tready_int.next = True @@ -498,6 +511,7 @@ class AXIStreamSink(object): dest.append(int(tdest)) user.append(int(tuser)) first = False + self.active = True if tlast: frame = AXIStreamFrame() frame.B = B @@ -507,6 +521,7 @@ class AXIStreamSink(object): frame.parse(data, keep, id, dest, user) self.queue.append(frame) self.sync.next = not self.sync + self.active = False if name is not None: print("[%s] Got frame %s" % (name, repr(frame))) data = [] diff --git a/tb/test_axis_fifo.v b/tb/test_axis_fifo.v index 042477a6..6a8d4ee7 100644 --- a/tb/test_axis_fifo.v +++ b/tb/test_axis_fifo.v @@ -144,9 +144,9 @@ UUT ( .m_axis_tdest(m_axis_tdest), .m_axis_tuser(m_axis_tuser), // Status - .overflow(), - .bad_frame(), - .good_frame() + .status_overflow(), + .status_bad_frame(), + .status_good_frame() ); endmodule diff --git a/tb/test_axis_fifo_64.v b/tb/test_axis_fifo_64.v index cc36f5ab..e1ea50f6 100644 --- a/tb/test_axis_fifo_64.v +++ b/tb/test_axis_fifo_64.v @@ -144,9 +144,9 @@ UUT ( .m_axis_tdest(m_axis_tdest), .m_axis_tuser(m_axis_tuser), // Status - .overflow(), - .bad_frame(), - .good_frame() + .status_overflow(), + .status_bad_frame(), + .status_good_frame() ); endmodule diff --git a/tb/test_axis_frame_fifo.py b/tb/test_axis_frame_fifo.py index 0beddc0f..2bcc89f3 100755 --- a/tb/test_axis_frame_fifo.py +++ b/tb/test_axis_frame_fifo.py @@ -83,9 +83,9 @@ def bench(): m_axis_tid = Signal(intbv(0)[ID_WIDTH:]) m_axis_tdest = Signal(intbv(0)[DEST_WIDTH:]) m_axis_tuser = Signal(intbv(0)[USER_WIDTH:]) - overflow = Signal(bool(0)) - bad_frame = Signal(bool(0)) - good_frame = Signal(bool(0)) + status_overflow = Signal(bool(0)) + status_bad_frame = Signal(bool(0)) + status_good_frame = Signal(bool(0)) # sources and sinks source_pause = Signal(bool(0)) @@ -153,27 +153,27 @@ def bench(): m_axis_tdest=m_axis_tdest, m_axis_tuser=m_axis_tuser, - overflow=overflow, - bad_frame=bad_frame, - good_frame=good_frame + status_overflow=status_overflow, + status_bad_frame=status_bad_frame, + status_good_frame=status_good_frame ) @always(delay(4)) def clkgen(): clk.next = not clk - overflow_asserted = Signal(bool(0)) - bad_frame_asserted = Signal(bool(0)) - good_frame_asserted = Signal(bool(0)) + status_overflow_asserted = Signal(bool(0)) + status_bad_frame_asserted = Signal(bool(0)) + status_good_frame_asserted = Signal(bool(0)) @always(clk.posedge) def monitor(): - if (overflow): - overflow_asserted.next = 1 - if (bad_frame): - bad_frame_asserted.next = 1 - if (good_frame): - good_frame_asserted.next = 1 + if (status_overflow): + status_overflow_asserted.next = 1 + if (status_bad_frame): + status_bad_frame_asserted.next = 1 + if (status_good_frame): + status_good_frame_asserted.next = 1 @instance def check(): @@ -201,9 +201,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) @@ -212,9 +212,9 @@ def bench(): assert rx_frame == test_frame - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -231,9 +231,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) @@ -242,9 +242,9 @@ def bench(): assert rx_frame == test_frame - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield clk.posedge print("test 3: test packet with pauses") @@ -259,9 +259,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) yield clk.posedge @@ -285,9 +285,9 @@ def bench(): assert rx_frame == test_frame - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -312,9 +312,9 @@ def bench(): dest=2 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame1) source.send(test_frame2) @@ -329,9 +329,9 @@ def bench(): assert rx_frame == test_frame2 - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -356,9 +356,9 @@ def bench(): dest=2 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame1) source.send(test_frame2) @@ -382,9 +382,9 @@ def bench(): assert rx_frame == test_frame2 - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -409,9 +409,9 @@ def bench(): dest=2 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame1) source.send(test_frame2) @@ -435,9 +435,9 @@ def bench(): assert rx_frame == test_frame2 - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -455,9 +455,9 @@ def bench(): last_cycle_user=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) yield clk.posedge @@ -466,9 +466,9 @@ def bench(): assert sink.empty() - assert not overflow_asserted - assert bad_frame_asserted - assert not good_frame_asserted + assert not status_overflow_asserted + assert status_bad_frame_asserted + assert not status_good_frame_asserted yield delay(100) @@ -485,9 +485,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) yield clk.posedge @@ -496,9 +496,9 @@ def bench(): assert sink.empty() - assert overflow_asserted - assert not bad_frame_asserted - assert not good_frame_asserted + assert status_overflow_asserted + assert not status_bad_frame_asserted + assert not status_good_frame_asserted yield delay(100) diff --git a/tb/test_axis_frame_fifo.v b/tb/test_axis_frame_fifo.v index 41d90bd8..8ba096c2 100644 --- a/tb/test_axis_frame_fifo.v +++ b/tb/test_axis_frame_fifo.v @@ -72,9 +72,9 @@ wire m_axis_tlast; wire [ID_WIDTH-1:0] m_axis_tid; wire [DEST_WIDTH-1:0] m_axis_tdest; wire [USER_WIDTH-1:0] m_axis_tuser; -wire overflow; -wire bad_frame; -wire good_frame; +wire status_overflow; +wire status_bad_frame; +wire status_good_frame; initial begin // myhdl integration @@ -100,9 +100,9 @@ initial begin m_axis_tid, m_axis_tdest, m_axis_tuser, - overflow, - bad_frame, - good_frame + status_overflow, + status_bad_frame, + status_good_frame ); // dump file @@ -150,9 +150,9 @@ UUT ( .m_axis_tdest(m_axis_tdest), .m_axis_tuser(m_axis_tuser), // Status - .overflow(overflow), - .bad_frame(bad_frame), - .good_frame(good_frame) + .status_overflow(status_overflow), + .status_bad_frame(status_bad_frame), + .status_good_frame(status_good_frame) ); endmodule diff --git a/tb/test_axis_frame_fifo_64.py b/tb/test_axis_frame_fifo_64.py index 4fc12138..0d541dd3 100755 --- a/tb/test_axis_frame_fifo_64.py +++ b/tb/test_axis_frame_fifo_64.py @@ -83,9 +83,9 @@ def bench(): m_axis_tid = Signal(intbv(0)[ID_WIDTH:]) m_axis_tdest = Signal(intbv(0)[DEST_WIDTH:]) m_axis_tuser = Signal(intbv(0)[USER_WIDTH:]) - overflow = Signal(bool(0)) - bad_frame = Signal(bool(0)) - good_frame = Signal(bool(0)) + status_overflow = Signal(bool(0)) + status_bad_frame = Signal(bool(0)) + status_good_frame = Signal(bool(0)) # sources and sinks source_pause = Signal(bool(0)) @@ -153,27 +153,27 @@ def bench(): m_axis_tdest=m_axis_tdest, m_axis_tuser=m_axis_tuser, - overflow=overflow, - bad_frame=bad_frame, - good_frame=good_frame + status_overflow=status_overflow, + status_bad_frame=status_bad_frame, + status_good_frame=status_good_frame ) @always(delay(4)) def clkgen(): clk.next = not clk - overflow_asserted = Signal(bool(0)) - bad_frame_asserted = Signal(bool(0)) - good_frame_asserted = Signal(bool(0)) + status_overflow_asserted = Signal(bool(0)) + status_bad_frame_asserted = Signal(bool(0)) + status_good_frame_asserted = Signal(bool(0)) @always(clk.posedge) def monitor(): - if (overflow): - overflow_asserted.next = 1 - if (bad_frame): - bad_frame_asserted.next = 1 - if (good_frame): - good_frame_asserted.next = 1 + if (status_overflow): + status_overflow_asserted.next = 1 + if (status_bad_frame): + status_bad_frame_asserted.next = 1 + if (status_good_frame): + status_good_frame_asserted.next = 1 @instance def check(): @@ -201,9 +201,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) @@ -212,9 +212,9 @@ def bench(): assert rx_frame == test_frame - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -231,9 +231,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) @@ -242,9 +242,9 @@ def bench(): assert rx_frame == test_frame - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield clk.posedge print("test 3: test packet with pauses") @@ -259,9 +259,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) yield clk.posedge @@ -285,9 +285,9 @@ def bench(): assert rx_frame == test_frame - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -312,9 +312,9 @@ def bench(): dest=2 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame1) source.send(test_frame2) @@ -329,9 +329,9 @@ def bench(): assert rx_frame == test_frame2 - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -356,9 +356,9 @@ def bench(): dest=2 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame1) source.send(test_frame2) @@ -382,9 +382,9 @@ def bench(): assert rx_frame == test_frame2 - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -409,9 +409,9 @@ def bench(): dest=2 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame1) source.send(test_frame2) @@ -435,9 +435,9 @@ def bench(): assert rx_frame == test_frame2 - assert not overflow_asserted - assert not bad_frame_asserted - assert good_frame_asserted + assert not status_overflow_asserted + assert not status_bad_frame_asserted + assert status_good_frame_asserted yield delay(100) @@ -455,9 +455,9 @@ def bench(): last_cycle_user=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) yield clk.posedge @@ -466,9 +466,9 @@ def bench(): assert sink.empty() - assert not overflow_asserted - assert bad_frame_asserted - assert not good_frame_asserted + assert not status_overflow_asserted + assert status_bad_frame_asserted + assert not status_good_frame_asserted yield delay(100) @@ -485,9 +485,9 @@ def bench(): dest=1 ) - overflow_asserted.next = 0 - bad_frame_asserted.next = 0 - good_frame_asserted.next = 0 + status_overflow_asserted.next = 0 + status_bad_frame_asserted.next = 0 + status_good_frame_asserted.next = 0 source.send(test_frame) yield clk.posedge @@ -496,9 +496,9 @@ def bench(): assert sink.empty() - assert overflow_asserted - assert not bad_frame_asserted - assert not good_frame_asserted + assert status_overflow_asserted + assert not status_bad_frame_asserted + assert not status_good_frame_asserted yield delay(100) diff --git a/tb/test_axis_frame_fifo_64.v b/tb/test_axis_frame_fifo_64.v index 1f72e105..94e85891 100644 --- a/tb/test_axis_frame_fifo_64.v +++ b/tb/test_axis_frame_fifo_64.v @@ -72,9 +72,9 @@ wire m_axis_tlast; wire [ID_WIDTH-1:0] m_axis_tid; wire [DEST_WIDTH-1:0] m_axis_tdest; wire [USER_WIDTH-1:0] m_axis_tuser; -wire overflow; -wire bad_frame; -wire good_frame; +wire status_overflow; +wire status_bad_frame; +wire status_good_frame; initial begin // myhdl integration @@ -100,9 +100,9 @@ initial begin m_axis_tid, m_axis_tdest, m_axis_tuser, - overflow, - bad_frame, - good_frame + status_overflow, + status_bad_frame, + status_good_frame ); // dump file @@ -150,9 +150,9 @@ UUT ( .m_axis_tdest(m_axis_tdest), .m_axis_tuser(m_axis_tuser), // Status - .overflow(overflow), - .bad_frame(bad_frame), - .good_frame(good_frame) + .status_overflow(status_overflow), + .status_bad_frame(status_bad_frame), + .status_good_frame(status_good_frame) ); endmodule