Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Changes for BF16 #82

Closed
wants to merge 14 commits into from
2 changes: 1 addition & 1 deletion riscv_ctg/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def gen_bitmanip_dataset(bit_width,sign=True):
# increment each value in dataset, increment each value in dataset, add them to the dataset
return dataset + [x - 1 for x in dataset] + [x+1 for x in dataset] + dataset0

template_fnames = ["template.yaml","imc.yaml","fd.yaml"]
template_fnames = ["template.yaml","imc.yaml","fd.yaml","inx.yaml"]

template_files = [os.path.join(root,"data/"+f) for f in template_fnames]

Expand Down
21 changes: 17 additions & 4 deletions riscv_ctg/ctg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from math import *
from riscv_ctg.__init__ import __version__

def create_test(usage_str, node,label,base_isa,max_inst, op_template, randomize, out_dir, xlen, flen):
def create_test(usage_str, node,label,base_isa,max_inst, op_template, randomize, out_dir, xlen, flen, inxFlag):
iflen = 0
if 'mnemonics' not in node and 'csr_comb' not in node:
logger.warning("Neither mnemonics nor csr_comb node not found in covergroup: " + str(label))
Expand All @@ -42,9 +42,13 @@ def gen_test(op_node, opcode):
fprefix = os.path.join(out_dir,str(label))
logger.info('Generating Test for :' + str(label) +"-" + opcode)
formattype = op_node['formattype']
gen = Generator(formattype,op_node,opcode,randomize,xlen,flen,iflen,base_isa)
gen = Generator(formattype,op_node,opcode,randomize,xlen,flen,iflen,base_isa,inxFlag)
op_comb = gen.opcomb(node)
print("op_comb:")
print(op_comb)
val_comb = gen.valcomb(node)
print("val_comb:")
print(val_comb)
instr_dict = gen.correct_val(
gen.valreg(
gen.testreg(
Expand Down Expand Up @@ -100,7 +104,7 @@ def gen_test(op_node, opcode):
logger.info('Writing tests for csr_comb')
csr_comb_gen.write_test(fprefix, node, usage_str, label, csr_comb_instr_dict)

def ctg(verbose, out, random ,xlen_arg,flen_arg, cgf_file,num_procs,base_isa, max_inst):
def ctg(verbose, out, random ,xlen_arg,flen_arg, cgf_file,num_procs,base_isa, max_inst,inxFlag):
logger.level(verbose)
logger.info('****** RISC-V Compliance Test Generator {0} *******'.format(__version__ ))
logger.info('Copyright (c) 2020, InCore Semiconductors Pvt. Ltd.')
Expand All @@ -123,9 +127,18 @@ def ctg(verbose, out, random ,xlen_arg,flen_arg, cgf_file,num_procs,base_isa, ma
usage_str = const.usage.safe_substitute(base_isa=base_isa, \
cgf=cgf_argument, version = __version__, time=mytime, \
randomize=randomize_argument,xlen=str(xlen_arg))
# ---------------------------------
# IITM Changes
# This <inxFlag> is introduced to handle the template conflict over float instructions
# ---------------------------------
if inxFlag:
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)
cgf = expand_cgf(cgf_file,xlen,flen)
pool = mp.Pool(num_procs)
#print(cgf.items())
results = pool.starmap(create_test, [(usage_str, node,label,base_isa,max_inst, op_template,
randomize, out_dir, xlen, flen) for label,node in cgf.items()])
randomize, out_dir, xlen, flen, inxFlag) for label,node in cgf.items()])
pool.close()
Loading
Loading