Improve parameter validation
This commit is contained in:
@@ -111,12 +111,16 @@ class AxiMasterWrite(object):
|
|||||||
raise Exception("Token is not unique")
|
raise Exception("Token is not unique")
|
||||||
self.active_tokens.add(token)
|
self.active_tokens.add(token)
|
||||||
|
|
||||||
|
burst = AxiBurstType(burst)
|
||||||
|
|
||||||
if size is None or size < 0:
|
if size is None or size < 0:
|
||||||
size = self.max_burst_size
|
size = self.max_burst_size
|
||||||
else:
|
elif size > self.max_burst_size:
|
||||||
if size > self.max_burst_size:
|
|
||||||
raise ValueError("Requested burst size exceeds maximum burst size allowed for bus width")
|
raise ValueError("Requested burst size exceeds maximum burst size allowed for bus width")
|
||||||
|
|
||||||
|
lock = AxiLockType(lock)
|
||||||
|
prot = AxiProt(prot)
|
||||||
|
|
||||||
self.in_flight_operations += 1
|
self.in_flight_operations += 1
|
||||||
|
|
||||||
cmd = AxiWriteCmd(address, bytearray(data), burst, size, lock, cache, prot, qos, region, user, token)
|
cmd = AxiWriteCmd(address, bytearray(data), burst, size, lock, cache, prot, qos, region, user, token)
|
||||||
@@ -409,12 +413,16 @@ class AxiMasterRead(object):
|
|||||||
raise Exception("Token is not unique")
|
raise Exception("Token is not unique")
|
||||||
self.active_tokens.add(token)
|
self.active_tokens.add(token)
|
||||||
|
|
||||||
|
burst = AxiBurstType(burst)
|
||||||
|
|
||||||
if size is None or size < 0:
|
if size is None or size < 0:
|
||||||
size = self.max_burst_size
|
size = self.max_burst_size
|
||||||
else:
|
elif size > self.max_burst_size:
|
||||||
if size > self.max_burst_size:
|
|
||||||
raise ValueError("Requested burst size exceeds maximum burst size allowed for bus width")
|
raise ValueError("Requested burst size exceeds maximum burst size allowed for bus width")
|
||||||
|
|
||||||
|
lock = AxiLockType(lock)
|
||||||
|
prot = AxiProt(prot)
|
||||||
|
|
||||||
self.in_flight_operations += 1
|
self.in_flight_operations += 1
|
||||||
|
|
||||||
cmd = AxiReadCmd(address, length, burst, size, lock, cache, prot, qos, region, user, token)
|
cmd = AxiReadCmd(address, length, burst, size, lock, cache, prot, qos, region, user, token)
|
||||||
|
|||||||
Reference in New Issue
Block a user