public MemoryOverload( string id, RegType type, string description, string[] registerIds, string custom) { this.id = id; this.valueType = type; this.description = description; this.registerIds = registerIds; this.custom_Get = custom.Replace(" ", string.Empty); this.registerType = REGISTER_TYPE.OVERLOAD; if (this._HasCustomMethod) { this.customType = CUSTOM_TYPE.METHOD; } else if (this._HasCustomOperation) { this.customType = CUSTOM_TYPE.OPERATION; } else { // Selected dynamic member not exists Utils.Print("Get " + id + ": Error - Overload registers need custom field"); if (!MemoryMap.isUnityTest) { throw new OverloadEmptyCustomException(EXCEP_OVER_CUSTOM + ": " + id); } } if (this.HasCustomMethod) { if (this._HasCustomMethodId) { this.methodId = this.custom_Get.Substring(MemoryMap.METHOD_KEY.Length); } else { this.methodId = this.id + MemoryMap.METHOD_SUFIX_GET; } } }
public MemoryRegister( string id, RegType type, string description, int address, int size = MemRegister.DEF_SIZE, bool write = MemRegister.DEF_WRITE, string custom_Get = "", string custom_Set = "") { this.id = id; this.valueType = type; this.description = description; this.address = address; this.size = size; this.write = write; this.custom_Get = custom_Get.Replace(" ", string.Empty); this.custom_Set = custom_Set.Replace(" ", string.Empty); this.registerType = REGISTER_TYPE.REGISTER; // Custom Get if (this._HasCustomMethod_Get) { this.customType_Get = CUSTOM_TYPE.METHOD; } else if (this._HasCustomOperation_Get) { this.customType_Get = CUSTOM_TYPE.OPERATION; } else if (this._HasCustomFormat_Get) { this.customType_Get = CUSTOM_TYPE.FORMAT; } else { this.customType_Get = CUSTOM_TYPE.EMPTY; } if (this.HasCustomMethod_Get) { if (this._HasCustomMethodId_Get) { this.methodId_Get = this.custom_Get.Substring(MemoryMap.METHOD_KEY.Length); } else { this.methodId_Get = this.id + MemoryMap.METHOD_SUFIX_GET; } } // Custom Set if (this._HasCustomMethod_Set) { this.customType_Set = CUSTOM_TYPE.METHOD; } else if (this._HasCustomOperation_Set) { this.customType_Set = CUSTOM_TYPE.OPERATION; } else if (this._HasCustomFormat_Set) { this.customType_Set = CUSTOM_TYPE.FORMAT; } else { this.customType_Set = CUSTOM_TYPE.EMPTY; } if (this.HasCustomMethod_Set) { if (this._HasCustomMethodId_Set) { this.methodId_Set = this.custom_Set.Substring(MemoryMap.METHOD_KEY.Length); } else { this.methodId_Set = this.id + MemoryMap.METHOD_SUFIX_SET; } } }