Rename variables | Small fixes | Move out-srcs to new dir

This commit is contained in:
abejgonzalez
2022-10-13 15:39:48 -07:00
committed by joey0320
parent f5914ec9e9
commit 9f2fd22cc0
6 changed files with 133 additions and 115 deletions

View File

@@ -25,41 +25,41 @@ from typing import List, Optional
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Use CIRCT (firtool) smems JSONs to create DUT and test harness smems confs')
parser.add_argument('--in-smems-conf', type=str, required=True, help='')
parser.add_argument('--in-dut-smems-json', type=str, required=True, help='')
parser.add_argument('--in-tb-smems-json', type=str, required=True, help='')
parser.add_argument('--out-dut-smems-conf', type=str, required=True, help='')
parser.add_argument('--out-tb-smems-conf', type=str, required=True, help='')
parser.add_argument('--in-smems-conf', type=str, required=True, help='Overall smems conf file that contains all memory definitions')
parser.add_argument('--in-dut-smems-json', type=str, required=True, help='JSON indicating which mem modules are in the DUT')
parser.add_argument('--in-model-smems-json', type=str, required=True, help='JSON indicating which mem modules are in the top-most level module (but not in the DUT)')
parser.add_argument('--out-dut-smems-conf', type=str, required=True, help='Smems conf with only DUT mem module definitions')
parser.add_argument('--out-model-smems-conf', type=str, required=True, help='Smems conf with only top-most level mem module definitions (not including DUT modules)')
args = parser.parse_args()
with open(args.in_smems_conf) as isc:
with open(args.in_dut_smems_json) as idsj:
with open(args.in_tb_smems_json) as itsj:
idsj_data = json.load(idsj)
itsj_data = json.load(itsj)
with open(args.in_smems_conf) as isc, \
open(args.in_dut_smems_json) as idsj, \
open(args.in_model_smems_json) as itsj:
idsj_data = json.load(idsj)
itsj_data = json.load(itsj)
dut_mods = set()
for e in idsj_data:
dut_mods.add(e['module_name'])
dut_mods = set()
for e in idsj_data:
dut_mods.add(e['module_name'])
tb_mods = set()
for e in itsj_data:
tb_mods.add(e['module_name'])
model_mods = set()
for e in itsj_data:
model_mods.add(e['module_name'])
with open(args.out_dut_smems_conf, "w") as odsc:
with open(args.out_tb_smems_conf, "w") as otsc:
for l in isc:
sl = l.split()
with open(args.out_dut_smems_conf, "w") as odsc, \
open(args.out_model_smems_conf, "w") as otsc:
for l in isc:
sl = l.split()
# the line can't be split then stop immediately (normally an empty file)
if len(sl) > 2:
name = sl[1]
# the line can't be split then stop immediately (normally an empty file)
if len(sl) > 2:
name = sl[1]
if name in dut_mods:
odsc.write(l)
elif name in tb_mods:
otsc.write(l)
else:
assert False, "Unable to find smem CONF module in firtool emitted JSON files."
else:
exit(0)
if name in dut_mods:
odsc.write(l)
elif name in model_mods:
otsc.write(l)
else:
assert False, "Unable to find smem CONF module in firtool emitted JSON files."
else:
exit(0)