From: Andrew Bardsley Date: Sun, 22 Nov 2015 10:10:21 +0000 (-0500) Subject: config: Added missing types to JSON/INI Python reader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4375678a0d8429ee51882d328f851402b61d6ac5;p=gem5.git config: Added missing types to JSON/INI Python reader Added the missing types EthernetAddr and Current to the JSON/INI file reader example configs/example/read_config.py. Also added __str__ to EthernetAddr to make values appear in the same form in JSON an INI files. --- diff --git a/configs/example/read_config.py b/configs/example/read_config.py index ecb2950e6..dfd5b7f1a 100644 --- a/configs/example/read_config.py +++ b/configs/example/read_config.py @@ -101,6 +101,7 @@ param_parsers = { 'NumericParamValue': simple_parser(cast=long), 'TickParamValue': tick_parser(), 'Frequency': tick_parser(cast=m5.objects.Latency), + 'Current': simple_parser(suffix='A'), 'Voltage': simple_parser(suffix='V'), 'Enum': simple_parser(), 'MemorySize': simple_parser(suffix='B'), @@ -108,7 +109,8 @@ param_parsers = { 'AddrRange': addr_range_parser, 'String': simple_parser(), 'MemoryBandwidth': memory_bandwidth_parser, - 'Time': simple_parser() + 'Time': simple_parser(), + 'EthernetAddr': simple_parser() } for name, parser in param_parsers.iteritems(): diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 846c5416e..f1eead80d 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -930,6 +930,9 @@ class EthernetAddr(ParamValue): from m5.internal.params import EthAddr return EthAddr(self.value) + def __str__(self): + return self.value + def ini_str(self): return self.value