Extended HTML auto-generation to add a subtype field from the JSON if it exists

This commit is contained in:
Simon Southwell 2019-12-03 15:46:46 +00:00
commit 60602e1a2e
2 changed files with 15 additions and 2 deletions

View file

@ -67,7 +67,7 @@ class MemMapperHtm(MemMapperBase):
self.__imagePrintWidth = 128
# The number of columns in the register table
self.__numOfCols = 7
self.__numOfCols = 8
MemMapperBase.__init__(self)
@ -305,7 +305,7 @@ class MemMapperHtm(MemMapperBase):
self.__drawContents([jsonDict[0][attr.IP_NAME], jsonDict[0][attr.DESCRIPTION]], wfp, True)
# Output the column header
self.__drawContents(['Register Name', addrBannerStr, 'Field', 'Bits', 'Type', 'Reset', 'Description'], wfp, True)
self.__drawContents(['Register Name', addrBannerStr, 'Field', 'Bits', 'Type', 'subtype', 'Reset', 'Description'], wfp, True)
return wfp
@ -442,6 +442,11 @@ class MemMapperHtm(MemMapperBase):
regType = regDict[regName][attr.TYPE]
else:
regType = ' '
if attr.SUBTYPE in regDict[regName] :
regSubType = regDict[regName][attr.SUBTYPE]
else :
regSubType = ' '
# If no reset, then reset specified in fields, so blank the register reset, else fetch it
if attr.RESET in regDict[regName]:
@ -465,6 +470,7 @@ class MemMapperHtm(MemMapperBase):
' ',
regDict[regName][attr.WIDTH],
regType,
regSubType,
reset,
regDict[regName][attr.DESCRIPTION]]
@ -493,6 +499,11 @@ class MemMapperHtm(MemMapperBase):
resetVal = '0'
else :
resetVal = fields[fieldName][attr.RESET]
if attr.SUBTYPE in fields[fieldName] :
regSubType = fields[fieldName][attr.SUBTYPE]
else :
regSubType = ''
bitLen = int(fields[fieldName][attr.BIT_LEN], 0)
if bitLen == 1 :
@ -505,6 +516,7 @@ class MemMapperHtm(MemMapperBase):
entryList = [fieldName.upper(),
bitStr,
fields[fieldName][attr.TYPE],
regSubType,
resetVal,
fields[fieldName][attr.DESCRIPTION]
]

View file

@ -38,6 +38,7 @@ class attr :
ADDRESS = 'address'
ADDR_RANGE = 'addr_range'
TYPE = 'type'
SUBTYPE = 'subtype'
RESET = 'reset'
WIDTH = 'width'
DESCRIPTION = 'description'