...
 
Commits (2)
......@@ -290,6 +290,8 @@ class AwlOpTranslator(object):
self.__mnemonics2constOperTab = self.__getConstOperTable()
def __translateIndirectAddressing(self, opDesc, rawOps):
#@cy cdef uint64_t area_u64
# rawOps starts _after_ the opening bracket '['
try:
if rawOps[0].upper() in ("AR1", "AR2"):
......@@ -359,15 +361,16 @@ class AwlOpTranslator(object):
if area < 0:
raise AwlSimError("Invalid memory area type in "
"indirect addressing operator")
if area == PointerConst.AREA_NONE_S:
area_u64 = area
if area_u64 == PointerConst.AREA_NONE_S:
raise AwlSimError("No memory area code specified in "
"indirect addressing operator")
if area in (AwlIndirectOpConst.EXT_AREA_T_S,
AwlIndirectOpConst.EXT_AREA_Z_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_DB_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_DI_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_FC_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_FB_S):
if area_u64 in (AwlIndirectOpConst.EXT_AREA_T_S,
AwlIndirectOpConst.EXT_AREA_Z_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_DB_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_DI_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_FC_S,
AwlIndirectOpConst.EXT_AREA_BLKREF_FB_S):
expectedOffsetOpWidth = 16
else:
expectedOffsetOpWidth = 32
......
......@@ -150,6 +150,7 @@ class CallStackElem(object): #+cdef
#@cy cdef AwlOffset loffset
#@cy cdef int32_t dbNumber
#@cy cdef int64_t area
#@cy cdef uint64_t area_u64
#@cy cdef AwlOperator storeOper
#@cy cdef uint32_t widthMaskAll
......@@ -173,18 +174,19 @@ class CallStackElem(object): #+cdef
storeOper.offset = loffset.addInt(2, 0)
storeOper.width = 32
area = AwlIndirectOpConst.optype2area(rvalueOp.operType)
if area == PointerConst.AREA_L_S:
area = PointerConst.AREA_VL_S
elif area == PointerConst.AREA_VL_S:
raise AwlSimError("Cannot forward VL-parameter "
"to called FC")
elif area == PointerConst.AREA_DI_S:
area = PointerConst.AREA_DB_S
elif area < 0:
if area < 0: #+unlikely
raise AwlSimBug("FC_trans_dbpointerInVL: Invalid rValueOp area. "
"(area=%d, operType=%d)" % (area, rvalueOp.operType))
area_u64 = area
if area_u64 == PointerConst.AREA_L_S:
area_u64 = PointerConst.AREA_VL_S
elif area_u64 == PointerConst.AREA_VL_S: #+unlikely
raise AwlSimError("Cannot forward VL-parameter "
"to called FC")
elif area_u64 == PointerConst.AREA_DI_S:
area_u64 = PointerConst.AREA_DB_S
cpu.store(storeOper,
make_AwlMemoryObject_fromScalar32(area | rvalueOp.offset.toPointerValue()),
make_AwlMemoryObject_fromScalar32(area_u64 | rvalueOp.offset.toPointerValue()),
widthMaskAll)
# Return the operator for the DB pointer.
return make_AwlOperator(AwlOperatorTypes.MEM_VL,
......
......@@ -176,7 +176,7 @@ cdef inline AwlMemoryObject alloc_AwlMemoryObject(uint32_t width) except NULL:
memObj = &memObjPool[memObjPoolIndex]
memObjPoolIndex = (memObjPoolIndex + 1) & indexMask
memObj.width = width
memObj.width = <uint16_t>width
return memObj
......@@ -295,18 +295,18 @@ cdef inline uint32_t AwlMemoryObject_asScalar8(AwlMemoryObject memObj):
cdef inline uint32_t AwlMemoryObject_asScalar16(AwlMemoryObject memObj):
cdef const uint8_t *dataBytes
dataBytes = &memObj.dataBytes[0]
return be16toh((<uint16_t *>dataBytes)[0])
return be16toh((<const uint16_t *>dataBytes)[0])
cdef inline uint32_t AwlMemoryObject_asScalar24(AwlMemoryObject memObj):
cdef const uint8_t *dataBytes
dataBytes = &memObj.dataBytes[0]
return ((<uint32_t>be16toh((<uint16_t *>dataBytes)[0]) << 8) |
return ((<uint32_t>be16toh((<const uint16_t *>dataBytes)[0]) << 8) |
<uint32_t>dataBytes[2])
cdef inline uint32_t AwlMemoryObject_asScalar32(AwlMemoryObject memObj):
cdef const uint8_t *dataBytes
dataBytes = &memObj.dataBytes[0]
return be32toh((<uint32_t *>dataBytes)[0])
return be32toh((<const uint32_t *>dataBytes)[0])
cdef bytearray AwlMemoryObject_asBytes(AwlMemoryObject memObj)
......