GIS-6905 Added ability to override the '_system' suffix expected in the QSYS filename using a command line option (-q or --qsysSuffix)

This commit is contained in:
Simon Southwell 2018-06-26 11:40:01 +01:00
commit 5b23b59191
9 changed files with 24 additions and 23 deletions

View file

@ -302,5 +302,5 @@ if __name__ == '__main__':
memMap.setHeadersMode(cmdArgs.headersOnly)
# Run the program for C++ definitions generation
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'cpp', cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'cpp', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMap

View file

@ -421,5 +421,5 @@ if __name__ == '__main__':
cmdArgs.jsonFile)
# Run the program for C++ class generation
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, enTag, cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, enTag, cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMap

View file

@ -348,5 +348,5 @@ if __name__ == '__main__':
cmdArgs.jsonFile)
# Run the program for C++ class generation
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'cpp', cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'cpp', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMap

View file

@ -950,11 +950,11 @@ if __name__ == '__main__' :
memMapHdl = MemMapperHdl(cmdArgs.projName)
# Run the program for VHDL RTL generation
memMapHdl.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'hdl', cmdArgs.jsonFile, cmdArgs.buildDir)
memMapHdl.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'hdl', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMapHdl
memMapPkg = MemMapperPkg()
# Run the program for the package generation
memMapPkg.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'pkg', cmdArgs.jsonFile, cmdArgs.buildDir)
memMapPkg.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'pkg', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMapPkg

View file

@ -558,5 +558,5 @@ if __name__ == '__main__':
memMap.setByteAddrMode(cmdArgs.byteAddrs)
# Run the processing and generate output
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'txt', cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'txt', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMap

View file

@ -108,7 +108,7 @@ if __name__ == '__main__':
cmdArgs = processCmdLine()
# Run the program for C++ class generation
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'cpp', cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'cpp', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
bigDict = memMap.getBigDict()
suffix = memMap.getSuffix()

View file

@ -244,5 +244,5 @@ if __name__ == '__main__' :
cmdArgs = processCmdLine()
# Run the program for VHDL package generation
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMap

View file

@ -410,5 +410,5 @@ if __name__ == '__main__':
memMap.setByteAddrMode(cmdArgs.byteAddrs)
# Run the processing and generate output
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'txt', cmdArgs.jsonFile, cmdArgs.buildDir)
memMap.run(cmdArgs.topBlock, cmdArgs.busList, cmdArgs.repoDir, cmdArgs.opDir, cmdArgs.opFileSuffix, 'txt', cmdArgs.jsonFile, cmdArgs.buildDir, cmdArgs.qsysSuffix)
del memMap

View file

@ -270,11 +270,11 @@ class MemMapperBase :
# (private method)
# ---------------------------------------------------------
@staticmethod
def __getQsysInsts(topBlock, qsysPaths, busArray) :
def __getQsysInsts(topBlock, qsysPaths, busArray, qsysSuffix='_system') :
lineArray = ['a', 'b', 'c', 'd']
instArray = []
readFileName = qsysPaths[topBlock + '_system']
readFileName = qsysPaths[topBlock + qsysSuffix]
readFile = open(readFileName, 'r')
for line in readFile:
if ('end=' in lineArray[2]) and ('baseAddress' in line) :
@ -601,11 +601,12 @@ class MemMapperBase :
parser.add_argument('-o', '--output_dir', dest='opDir', default='', action='store', help='Specify output directory')
parser.add_argument('-d', '--build_dir', dest='buildDir', default='build', action='store', help='Specify build directory name (default \'build\')')
parser.add_argument('-s', '--file_suffix', dest='opFileSuffix', default='', action='store', help='Output file name suffix (default none)')
parser.add_argument('-q', '--qsys_suffix', dest='qsysSuffix', default='_system', action='store', help='QSYS file name suffix (default \'_system\'')
# ---------------------------------------------------------
# run
# ---------------------------------------------------------
def run(self, topBlock, busNames, repoDir='', opDir='', opSuffix='', enableTag='all', jsonFile='', buildDirName='build') :
def run(self, topBlock, busNames, repoDir='', opDir='', opSuffix='', enableTag='all', jsonFile='', buildDirName='build', qsysSuffix='_system') :
print('MemMapperBase')
@ -621,20 +622,20 @@ class MemMapperBase :
else :
startDir = repoDir
rootDir = startDir # Find the root of the repository
rootDir = startDir # Find the root of the repository
self.docDirs = self.__getDocDirs(rootDir) # Find all the places where JSON files might be.
buildDirs = self.__getBuildDirs(rootDir, buildDirName) # Find all the places where QSYS files might be.
self.jsonPaths[topBlock] = self.__getJsonPath(topBlock, self.docDirs) # Find where the top level JSON file is and place this into the JSON dictionary
self.docDirs = self.__getDocDirs(rootDir) # Find all the places where JSON files might be.
buildDirs = self.__getBuildDirs(rootDir, buildDirName) # Find all the places where QSYS files might be.
self.jsonPaths[topBlock] = self.__getJsonPath(topBlock, self.docDirs) # Find where the top level JSON file is and place this into the JSON dictionary
topDict = self.__getJsonDict(topBlock, self.jsonPaths) # Get the dictionary entry for the top block
topQsys = topDict[0]['qsys'] # Extract the top level Qsys system
qsysPaths[topQsys] = self.__getQsysPath(topQsys, buildDirs) # Get the path of this Qsys system and place this into the Qsys dictionary
qsysInsts = self.__getQsysInsts(topBlock, qsysPaths, busNames) # Find all the sub-block information in the Qsys system
ipArray = self.__processQsysInsts(qsysInsts) # Put these IP blocks into an array
topDict = self.__getJsonDict(topBlock, self.jsonPaths) # Get the dictionary entry for the top block
topQsys = topDict[0]['qsys'] # Extract the top level Qsys system
qsysPaths[topQsys] = self.__getQsysPath(topQsys, buildDirs) # Get the path of this Qsys system and place this into the Qsys dictionary
qsysInsts = self.__getQsysInsts(topBlock, qsysPaths, busNames, qsysSuffix) # Find all the sub-block information in the Qsys system
ipArray = self.__processQsysInsts(qsysInsts) # Put these IP blocks into an array
self.__getJsonPaths(self.jsonPaths, ipArray) # Find all the related JSON files for the IP from the QSYS
self.__processSubBlocks(ipArray, enableTag) # Process any sub-block JSON files, and add IP to array
self.__getJsonPaths(self.jsonPaths, ipArray) # Find all the related JSON files for the IP from the QSYS
self.__processSubBlocks(ipArray, enableTag) # Process any sub-block JSON files, and add IP to array
# If a specific JSON file path given, just process this
else :