From 01212e37cdd1f1113fc9d06b4af1d3d4e61ce697 Mon Sep 17 00:00:00 2001 From: Alex Forencich Date: Thu, 17 Dec 2020 00:27:17 -0800 Subject: [PATCH] Minor refactoring, remove extra conversion --- cocotbext/axi/axi_master.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/cocotbext/axi/axi_master.py b/cocotbext/axi/axi_master.py index 1fabd9c..ec38c71 100644 --- a/cocotbext/axi/axi_master.py +++ b/cocotbext/axi/axi_master.py @@ -318,17 +318,16 @@ class AxiMasterWrite(object): user = [] for bid, burst_length in cmd.burst_list: - while True: - if self.int_write_resp_queue_list[bid]: - break - + while not self.int_write_resp_queue_list[bid]: await self.b_channel.wait() b = self.b_channel.recv() - if self.active_id[int(b.bid)] <= 0: + i = int(b.bid) + + if self.active_id[i] <= 0: raise Exception(f"Unexpected burst ID {bid}") - self.int_write_resp_queue_list[int(b.bid)].append(b) + self.int_write_resp_queue_list[i].append(b) b = self.int_write_resp_queue_list[bid].popleft() @@ -598,17 +597,16 @@ class AxiMasterRead(object): for rid, burst_length in cmd.burst_list: for k in range(burst_length): - while True: - if self.int_read_resp_queue_list[rid]: - break - + while not self.int_read_resp_queue_list[rid]: await self.r_channel.wait() r = self.r_channel.recv() - if self.active_id[int(r.rid)] <= 0: + i = int(r.rid) + + if self.active_id[i] <= 0: raise Exception(f"Unexpected burst ID {rid}") - self.int_read_resp_queue_list[int(r.rid)].append(r) + self.int_read_resp_queue_list[i].append(r) r = self.int_read_resp_queue_list[rid].popleft()