Skip to content

Commit

Permalink
Merge branch 'dev' into issue_template
Browse files Browse the repository at this point in the history
  • Loading branch information
UmerShahidengr authored Nov 7, 2024
2 parents b575510 + 45546e1 commit 6c13757
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion riscv-ctg/riscv_ctg/cross_comb.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self, base_isa_str, xlen_in, randomize, label):
global base_isa

# Template dictionary
self.OP_TEMPLATE = utils.load_yamls(const.template_files)
self.OP_TEMPLATE = utils.load_yaml(const.template_files)

xlen = xlen_in
base_isa = base_isa_str
Expand Down
2 changes: 1 addition & 1 deletion riscv-ctg/riscv_ctg/ctg.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def ctg(verbose, out, random ,xlen_arg,flen_arg, cgf_file,num_procs,base_isa, ma
const.template_files.remove([fd for fd in const.template_files if "fd.yaml" in fd][0])
else:
const.template_files.remove([fd for fd in const.template_files if "inx.yaml" in fd][0])
op_template = utils.load_yamls(const.template_files)
op_template = utils.load_yaml(const.template_files)
cgf = expand_cgf(cgf_file,xlen,flen)
pool = mp.Pool(num_procs)
results = pool.starmap(create_test, [(usage_str, node,label,base_isa,max_inst, op_template,
Expand Down
11 changes: 7 additions & 4 deletions riscv-ctg/riscv_ctg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
yaml.allow_unicode = True

def load_yaml(foo):
"""
Loads the template file or file list and returns the data in a dictionary.
"""
try:
if isinstance(foo, list):
with combineReader(foo) as fp:
return dict(yaml.load(fp))
with open(foo, "r") as file:
return dict(yaml.load(file))
except ruamel.yaml.constructor.DuplicateKeyError as msg:
Expand All @@ -33,7 +39,7 @@ def gen_format_data():
- ISA
- Mnemonics
'''
op_template = load_yaml(const.template_file)
op_template = load_yaml(const.template_files)

# Initialize nested dictionary
nested_dict = lambda: defaultdict(nested_dict)
Expand All @@ -60,9 +66,6 @@ def get_instr_list():

return instr_lst

def load_yamls(foo):
with combineReader(foo) as fp:
return dict(yaml.load(fp))

class makeUtil():
"""
Expand Down

0 comments on commit 6c13757

Please sign in to comment.