Explicit cast to integer before converting to enum or flag type

This commit is contained in:
Alex Forencich
2022-01-07 12:52:41 -08:00
parent 2d70e5cbe5
commit 873bb1a034
4 changed files with 10 additions and 10 deletions

View File

@@ -591,7 +591,7 @@ class AxiMasterWrite(Region, Reset):
for burst_length in cmd.burst_list:
b = await context.get_resp()
burst_resp = AxiResp(getattr(b, 'bresp', AxiResp.OKAY))
burst_resp = AxiResp(int(getattr(b, 'bresp', AxiResp.OKAY)))
burst_user = int(getattr(b, 'buser', 0))
if burst_resp != AxiResp.OKAY:
@@ -973,7 +973,7 @@ class AxiMasterRead(Region, Reset):
for r in burst:
cycle_data = int(r.rdata)
cycle_resp = AxiResp(getattr(r, "rresp", AxiResp.OKAY))
cycle_resp = AxiResp(int(getattr(r, "rresp", AxiResp.OKAY)))
cycle_user = int(getattr(r, "ruser", 0))
if cycle_resp != AxiResp.OKAY:

View File

@@ -115,8 +115,8 @@ class AxiSlaveWrite(Reset):
addr = int(aw.awaddr)
length = int(getattr(aw, 'awlen', 0))
size = int(getattr(aw, 'awsize', self.max_burst_size))
burst = AxiBurstType(getattr(aw, 'awburst', AxiBurstType.INCR))
prot = AxiProt(getattr(aw, 'awprot', AxiProt.NONSECURE))
burst = AxiBurstType(int(getattr(aw, 'awburst', AxiBurstType.INCR)))
prot = AxiProt(int(getattr(aw, 'awprot', AxiProt.NONSECURE)))
self.log.info("Write burst awid: 0x%x awaddr: 0x%08x awlen: %d awsize: %d awprot: %s",
awid, addr, length, size, prot)
@@ -275,8 +275,8 @@ class AxiSlaveRead(Reset):
addr = int(ar.araddr)
length = int(getattr(ar, 'arlen', 0))
size = int(getattr(ar, 'arsize', self.max_burst_size))
burst = AxiBurstType(getattr(ar, 'arburst', AxiBurstType.INCR))
prot = AxiProt(getattr(ar, 'arprot', AxiProt.NONSECURE))
burst = AxiBurstType(int(getattr(ar, 'arburst', AxiBurstType.INCR)))
prot = AxiProt(int(getattr(ar, 'arprot', AxiProt.NONSECURE)))
self.log.info("Read burst arid: 0x%x araddr: 0x%08x arlen: %d arsize: %d arprot: %s",
arid, addr, length, size, prot)

View File

@@ -311,7 +311,7 @@ class AxiLiteMasterWrite(Region, Reset):
for k in range(cmd.cycles):
b = await self.b_channel.recv()
cycle_resp = AxiResp(getattr(b, 'bresp', AxiResp.OKAY))
cycle_resp = AxiResp(int(getattr(b, 'bresp', AxiResp.OKAY)))
if cycle_resp != AxiResp.OKAY:
resp = cycle_resp
@@ -517,7 +517,7 @@ class AxiLiteMasterRead(Region, Reset):
r = await self.r_channel.recv()
cycle_data = int(r.rdata)
cycle_resp = AxiResp(getattr(r, 'rresp', AxiResp.OKAY))
cycle_resp = AxiResp(int(getattr(r, 'rresp', AxiResp.OKAY)))
if cycle_resp != AxiResp.OKAY:
resp = cycle_resp

View File

@@ -106,7 +106,7 @@ class AxiLiteSlaveWrite(Reset):
aw = await self.aw_channel.recv()
addr = (int(aw.awaddr) // self.byte_lanes) * self.byte_lanes
prot = AxiProt(getattr(aw, 'awprot', AxiProt.NONSECURE))
prot = AxiProt(int(getattr(aw, 'awprot', AxiProt.NONSECURE)))
w = await self.w_channel.recv()
@@ -221,7 +221,7 @@ class AxiLiteSlaveRead(Reset):
ar = await self.ar_channel.recv()
addr = (int(ar.araddr) // self.byte_lanes) * self.byte_lanes
prot = AxiProt(getattr(ar, 'arprot', AxiProt.NONSECURE))
prot = AxiProt(int(getattr(ar, 'arprot', AxiProt.NONSECURE)))
r = self.r_channel._transaction_obj()
r.rresp = AxiResp.OKAY