From 60602e1a2ee65180fb680ae22480476a464fbb2c Mon Sep 17 00:00:00 2001 From: Simon Southwell Date: Tue, 3 Dec 2019 15:46:46 +0000 Subject: [PATCH] Extended HTML auto-generation to add a subtype field from the JSON if it exists --- logic_memory_mapper/gen_htm.py | 16 ++++++++++++++-- logic_memory_mapper/memMapperBase.py | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/logic_memory_mapper/gen_htm.py b/logic_memory_mapper/gen_htm.py index b7b7f76..8746952 100644 --- a/logic_memory_mapper/gen_htm.py +++ b/logic_memory_mapper/gen_htm.py @@ -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] ] diff --git a/logic_memory_mapper/memMapperBase.py b/logic_memory_mapper/memMapperBase.py index 49c5e9d..69fd0e5 100644 --- a/logic_memory_mapper/memMapperBase.py +++ b/logic_memory_mapper/memMapperBase.py @@ -38,6 +38,7 @@ class attr : ADDRESS = 'address' ADDR_RANGE = 'addr_range' TYPE = 'type' + SUBTYPE = 'subtype' RESET = 'reset' WIDTH = 'width' DESCRIPTION = 'description'