diff --git a/logic_memory_mapper/gen_elhal.py b/logic_memory_mapper/gen_elhal.py index 6f588d6..f7f807c 100644 --- a/logic_memory_mapper/gen_elhal.py +++ b/logic_memory_mapper/gen_elhal.py @@ -38,7 +38,13 @@ class MemMapperElHal(MemMapperBase): print('MemMapperElHal') self.__useByteAddrs = False self.__enableTag = '' + self.__classSuffix = 'Auto' MemMapperBase.__init__(self) + + # --------------------------------------------------------- + # --------------------------------------------------------- + def setDerivedClassOn(self): + self.__classSuffix = '' # --------------------------------------------------------- # Configure the byte address output mode @@ -144,7 +150,7 @@ class MemMapperElHal(MemMapperBase): processStr = subBlocks[sb][attr.PROCESS] if processStr == 'enabled' or self.__enableTag in processStr: if sb.split(':')[0] not in sbList and sb != 'local' : - wfp.write('#include "C' + self._underScore2CamelCase(sb.split(':')[0]) + 'Auto.h"\n') + wfp.write('#include "C' + self._underScore2CamelCase(sb.split(':')[0]) + self.__classSuffix + '.h"\n') sbList.append(sb.split(':')[0]) if tagStr == 'CLASS': @@ -339,7 +345,7 @@ class MemMapperElHal(MemMapperBase): if sb != 'local' and bus == 'csr' and (processStr == 'enabled' or self.__enableTag in processStr) : sbRoot = sb.split(':')[0] instance = subBlocks[sb][attr.INSTANCE] - opStr += ' p' + self._underScore2CamelCase(sbRoot) + self._underScore2CamelCase(instance) + ' = new C' + self._underScore2CamelCase(sbRoot) + 'Auto(' + opStr += ' p' + self._underScore2CamelCase(sbRoot) + self._underScore2CamelCase(instance) + ' = new C' + self._underScore2CamelCase(sbRoot) + self.__classSuffix + '(' firstLoop = False for busName in sbDict[sb] : @@ -372,7 +378,7 @@ class MemMapperElHal(MemMapperBase): instance = subBlocks[sb][attr.INSTANCE] processStr = subBlocks[sb][attr.PROCESS] if processStr == 'enabled' or self.__enableTag in processStr: - opStr = ' C' + self._underScore2CamelCase(sb.split(':')[0]) + 'Auto* p' + \ + opStr = ' C' + self._underScore2CamelCase(sb.split(':')[0]) + self.__classSuffix + '* p' + \ self._underScore2CamelCase(sb.split(':')[0]) + \ self._underScore2CamelCase(instance) + ';\n' wfp.write(opStr) @@ -412,6 +418,9 @@ def processCmdLine(): # Process common command line options with inherited static base class method MemMapperElHal.processCmdLine(parser) + # Specific command line options added here + parser.add_argument('-D', '--derived_classes', dest='devClasses', default=False, action='store_true', help='Use derived classes as class types of child objects (default false)') + return parser.parse_args() # ############################################################### @@ -430,6 +439,8 @@ if __name__ == '__main__': # Do initialisation for text object specific configurations memMap.setByteAddrMode(True) memMap.setEnableTag(enTag) + if cmdArgs.devClasses: + memMap.setDerivedClassOn() memMapHdrs.setByteAddrMode(True) memMapHdrs.setHeadersMode(True)