Add idle event
This commit is contained in:
@@ -77,6 +77,8 @@ class AxiMasterWrite:
|
|||||||
self.int_write_resp_queue_list = [deque() for k in range(self.id_count)]
|
self.int_write_resp_queue_list = [deque() for k in range(self.id_count)]
|
||||||
|
|
||||||
self.in_flight_operations = 0
|
self.in_flight_operations = 0
|
||||||
|
self._idle = Event()
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
self.width = len(self.w_channel.bus.wdata)
|
self.width = len(self.w_channel.bus.wdata)
|
||||||
self.byte_size = 8
|
self.byte_size = 8
|
||||||
@@ -132,6 +134,7 @@ class AxiMasterWrite:
|
|||||||
wuser = list(wuser)
|
wuser = list(wuser)
|
||||||
|
|
||||||
self.in_flight_operations += 1
|
self.in_flight_operations += 1
|
||||||
|
self._idle.clear()
|
||||||
|
|
||||||
cmd = AxiWriteCmd(address, bytearray(data), awid, burst, size, lock,
|
cmd = AxiWriteCmd(address, bytearray(data), awid, burst, size, lock,
|
||||||
cache, prot, qos, region, user, wuser, event)
|
cache, prot, qos, region, user, wuser, event)
|
||||||
@@ -143,8 +146,7 @@ class AxiMasterWrite:
|
|||||||
|
|
||||||
async def wait(self):
|
async def wait(self):
|
||||||
while not self.idle():
|
while not self.idle():
|
||||||
self.write_resp_sync.clear()
|
await self._idle.wait()
|
||||||
await self.write_resp_sync.wait()
|
|
||||||
|
|
||||||
def write_resp_ready(self):
|
def write_resp_ready(self):
|
||||||
return bool(self.write_resp_queue)
|
return bool(self.write_resp_queue)
|
||||||
@@ -360,6 +362,9 @@ class AxiMasterWrite:
|
|||||||
|
|
||||||
self.in_flight_operations -= 1
|
self.in_flight_operations -= 1
|
||||||
|
|
||||||
|
if self.in_flight_operations == 0:
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
|
|
||||||
class AxiMasterRead:
|
class AxiMasterRead:
|
||||||
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):
|
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.int_read_resp_queue_list = [deque() for k in range(self.id_count)]
|
||||||
|
|
||||||
self.in_flight_operations = 0
|
self.in_flight_operations = 0
|
||||||
|
self._idle = Event()
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
self.width = len(self.r_channel.bus.rdata)
|
self.width = len(self.r_channel.bus.rdata)
|
||||||
self.byte_size = 8
|
self.byte_size = 8
|
||||||
@@ -439,6 +446,7 @@ class AxiMasterRead:
|
|||||||
prot = AxiProt(prot)
|
prot = AxiProt(prot)
|
||||||
|
|
||||||
self.in_flight_operations += 1
|
self.in_flight_operations += 1
|
||||||
|
self._idle.clear()
|
||||||
|
|
||||||
cmd = AxiReadCmd(address, length, arid, burst, size, lock, cache, prot, qos, region, user, event)
|
cmd = AxiReadCmd(address, length, arid, burst, size, lock, cache, prot, qos, region, user, event)
|
||||||
self.read_command_queue.append(cmd)
|
self.read_command_queue.append(cmd)
|
||||||
@@ -449,8 +457,7 @@ class AxiMasterRead:
|
|||||||
|
|
||||||
async def wait(self):
|
async def wait(self):
|
||||||
while not self.idle():
|
while not self.idle():
|
||||||
self.read_data_sync.clear()
|
await self._idle.wait()
|
||||||
await self.read_data_sync.wait()
|
|
||||||
|
|
||||||
def read_data_ready(self):
|
def read_data_ready(self):
|
||||||
return bool(self.read_data_queue)
|
return bool(self.read_data_queue)
|
||||||
@@ -657,6 +664,9 @@ class AxiMasterRead:
|
|||||||
|
|
||||||
self.in_flight_operations -= 1
|
self.in_flight_operations -= 1
|
||||||
|
|
||||||
|
if self.in_flight_operations == 0:
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
|
|
||||||
class AxiMaster:
|
class AxiMaster:
|
||||||
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):
|
def __init__(self, entity, name, clock, reset=None, max_burst_len=256):
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ class AxiLiteMasterWrite:
|
|||||||
self.int_write_resp_command_sync = Event()
|
self.int_write_resp_command_sync = Event()
|
||||||
|
|
||||||
self.in_flight_operations = 0
|
self.in_flight_operations = 0
|
||||||
|
self._idle = Event()
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
self.width = len(self.w_channel.bus.wdata)
|
self.width = len(self.w_channel.bus.wdata)
|
||||||
self.byte_size = 8
|
self.byte_size = 8
|
||||||
@@ -90,6 +92,7 @@ class AxiLiteMasterWrite:
|
|||||||
raise ValueError("Expected event object")
|
raise ValueError("Expected event object")
|
||||||
|
|
||||||
self.in_flight_operations += 1
|
self.in_flight_operations += 1
|
||||||
|
self._idle.clear()
|
||||||
|
|
||||||
self.write_command_queue.append(AxiLiteWriteCmd(address, bytearray(data), prot, event))
|
self.write_command_queue.append(AxiLiteWriteCmd(address, bytearray(data), prot, event))
|
||||||
self.write_command_sync.set()
|
self.write_command_sync.set()
|
||||||
@@ -99,8 +102,7 @@ class AxiLiteMasterWrite:
|
|||||||
|
|
||||||
async def wait(self):
|
async def wait(self):
|
||||||
while not self.idle():
|
while not self.idle():
|
||||||
self.write_resp_sync.clear()
|
await self._idle.wait()
|
||||||
await self.write_resp_sync.wait()
|
|
||||||
|
|
||||||
def write_resp_ready(self):
|
def write_resp_ready(self):
|
||||||
return bool(self.write_resp_queue)
|
return bool(self.write_resp_queue)
|
||||||
@@ -227,6 +229,9 @@ class AxiLiteMasterWrite:
|
|||||||
|
|
||||||
self.in_flight_operations -= 1
|
self.in_flight_operations -= 1
|
||||||
|
|
||||||
|
if self.in_flight_operations == 0:
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
|
|
||||||
class AxiLiteMasterRead:
|
class AxiLiteMasterRead:
|
||||||
def __init__(self, entity, name, clock, reset=None):
|
def __init__(self, entity, name, clock, reset=None):
|
||||||
@@ -252,6 +257,8 @@ class AxiLiteMasterRead:
|
|||||||
self.int_read_resp_command_sync = Event()
|
self.int_read_resp_command_sync = Event()
|
||||||
|
|
||||||
self.in_flight_operations = 0
|
self.in_flight_operations = 0
|
||||||
|
self._idle = Event()
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
self.width = len(self.r_channel.bus.rdata)
|
self.width = len(self.r_channel.bus.rdata)
|
||||||
self.byte_size = 8
|
self.byte_size = 8
|
||||||
@@ -272,6 +279,7 @@ class AxiLiteMasterRead:
|
|||||||
raise ValueError("Expected event object")
|
raise ValueError("Expected event object")
|
||||||
|
|
||||||
self.in_flight_operations += 1
|
self.in_flight_operations += 1
|
||||||
|
self._idle.clear()
|
||||||
|
|
||||||
self.read_command_queue.append(AxiLiteReadCmd(address, length, prot, event))
|
self.read_command_queue.append(AxiLiteReadCmd(address, length, prot, event))
|
||||||
self.read_command_sync.set()
|
self.read_command_sync.set()
|
||||||
@@ -281,8 +289,7 @@ class AxiLiteMasterRead:
|
|||||||
|
|
||||||
async def wait(self):
|
async def wait(self):
|
||||||
while not self.idle():
|
while not self.idle():
|
||||||
self.read_data_sync.clear()
|
await self._idle.wait()
|
||||||
await self.read_data_sync.wait()
|
|
||||||
|
|
||||||
def read_data_ready(self):
|
def read_data_ready(self):
|
||||||
return bool(self.read_data_queue)
|
return bool(self.read_data_queue)
|
||||||
@@ -397,6 +404,9 @@ class AxiLiteMasterRead:
|
|||||||
|
|
||||||
self.in_flight_operations -= 1
|
self.in_flight_operations -= 1
|
||||||
|
|
||||||
|
if self.in_flight_operations == 0:
|
||||||
|
self._idle.set()
|
||||||
|
|
||||||
|
|
||||||
class AxiLiteMaster:
|
class AxiLiteMaster:
|
||||||
def __init__(self, entity, name, clock, reset=None):
|
def __init__(self, entity, name, clock, reset=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user