Fix handling of parameters in JSON

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-06-07 20:39:53 +02:00
parent 9b87f132c8
commit 41b949832c
2 changed files with 6 additions and 2 deletions

View File

@ -348,7 +348,7 @@ void json_import_cell_attributes(Design *design, string &modname,
pId = param_node->data_dict_keys[param_id]; pId = param_node->data_dict_keys[param_id];
if (param->type == 'N') { if (param->type == 'N') {
cell->params[pId] = std::to_string(param_node->data_number);; cell->params[pId] = std::to_string(param->data_number);;
} else if (param->type == 'S') } else if (param->type == 'S')
cell->params[pId] = param->data_string; cell->params[pId] = param->data_string;
else else

View File

@ -15,7 +15,11 @@ for cell in sorted(design.cells, key=lambda x: x.first):
if len(cell.second.params) > 0: if len(cell.second.params) > 0:
print("\tParams:") print("\tParams:")
for param in cell.second.params: for param in cell.second.params:
print("\t\t{}: {}".format(param.first, param.second)) val = param.second
if val.isdigit():
val = bin(int(val))[2:]
val = "{}'b{}".format(len(val), val)
print("\t\t{}: {}".format(param.first, val))
if not cell.second.bel.nil(): if not cell.second.bel.nil():
print("\tBel: {}".format(chip.getBelName(cell.second.bel))) print("\tBel: {}".format(chip.getBelName(cell.second.bel)))