Add idle event

This commit is contained in:
Alex Forencich
2020-12-24 19:25:26 -08:00
parent fcf6374c3c
commit ecb2f5ae81
2 changed files with 28 additions and 8 deletions

View File

@@ -77,6 +77,8 @@ class AxiMasterWrite:
self.int_write_resp_queue_list = [deque() for k in range(self.id_count)]
self.in_flight_operations = 0
self._idle = Event()
self._idle.set()
self.width = len(self.w_channel.bus.wdata)
self.byte_size = 8
@@ -132,6 +134,7 @@ class AxiMasterWrite:
wuser = list(wuser)
self.in_flight_operations += 1
self._idle.clear()
cmd = AxiWriteCmd(address, bytearray(data), awid, burst, size, lock,
cache, prot, qos, region, user, wuser, event)
@@ -143,8 +146,7 @@ class AxiMasterWrite:
async def wait(self):
while not self.idle():
self.write_resp_sync.clear()
await self.write_resp_sync.wait()
await self._idle.wait()
def write_resp_ready(self):
return bool(self.write_resp_queue)
@@ -360,6 +362,9 @@ class AxiMasterWrite:
self.in_flight_operations -= 1
if self.in_flight_operations == 0:
self._idle.set()
class AxiMasterRead:
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):
@@ -390,6 +395,8 @@ class AxiMasterRead:
self.int_read_resp_queue_list = [deque() for k in range(self.id_count)]
self.in_flight_operations = 0
self._idle = Event()
self._idle.set()
self.width = len(self.r_channel.bus.rdata)
self.byte_size = 8
@@ -439,6 +446,7 @@ class AxiMasterRead:
prot = AxiProt(prot)
self.in_flight_operations += 1
self._idle.clear()
cmd = AxiReadCmd(address, length, arid, burst, size, lock, cache, prot, qos, region, user, event)
self.read_command_queue.append(cmd)
@@ -449,8 +457,7 @@ class AxiMasterRead:
async def wait(self):
while not self.idle():
self.read_data_sync.clear()
await self.read_data_sync.wait()
await self._idle.wait()
def read_data_ready(self):
return bool(self.read_data_queue)
@@ -657,6 +664,9 @@ class AxiMasterRead:
self.in_flight_operations -= 1
if self.in_flight_operations == 0:
self._idle.set()
class AxiMaster:
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):

View File

@@ -68,6 +68,8 @@ class AxiLiteMasterWrite:
self.int_write_resp_command_sync = Event()
self.in_flight_operations = 0
self._idle = Event()
self._idle.set()
self.width = len(self.w_channel.bus.wdata)
self.byte_size = 8
@@ -90,6 +92,7 @@ class AxiLiteMasterWrite:
raise ValueError("Expected event object")
self.in_flight_operations += 1
self._idle.clear()
self.write_command_queue.append(AxiLiteWriteCmd(address, bytearray(data), prot, event))
self.write_command_sync.set()
@@ -99,8 +102,7 @@ class AxiLiteMasterWrite:
async def wait(self):
while not self.idle():
self.write_resp_sync.clear()
await self.write_resp_sync.wait()
await self._idle.wait()
def write_resp_ready(self):
return bool(self.write_resp_queue)
@@ -227,6 +229,9 @@ class AxiLiteMasterWrite:
self.in_flight_operations -= 1
if self.in_flight_operations == 0:
self._idle.set()
class AxiLiteMasterRead:
def __init__(self, entity, name, clock, reset=None):
@@ -252,6 +257,8 @@ class AxiLiteMasterRead:
self.int_read_resp_command_sync = Event()
self.in_flight_operations = 0
self._idle = Event()
self._idle.set()
self.width = len(self.r_channel.bus.rdata)
self.byte_size = 8
@@ -272,6 +279,7 @@ class AxiLiteMasterRead:
raise ValueError("Expected event object")
self.in_flight_operations += 1
self._idle.clear()
self.read_command_queue.append(AxiLiteReadCmd(address, length, prot, event))
self.read_command_sync.set()
@@ -281,8 +289,7 @@ class AxiLiteMasterRead:
async def wait(self):
while not self.idle():
self.read_data_sync.clear()
await self.read_data_sync.wait()
await self._idle.wait()
def read_data_ready(self):
return bool(self.read_data_queue)
@@ -397,6 +404,9 @@ class AxiLiteMasterRead:
self.in_flight_operations -= 1
if self.in_flight_operations == 0:
self._idle.set()
class AxiLiteMaster:
def __init__(self, entity, name, clock, reset=None):