def generate_bsvcpp(filelist, project_dir, dutname, bsvdefines, s2hinterface, h2sinterface, nf): global noisyFlag noisyFlag=nf for inputfile in filelist: syntax_parse(open(inputfile).read(),inputfile, bsvdefines) ## code generation pass swProxies = [] hwProxies = [] swWrappers = [] hwWrappers = [] for i in set(s2hinterface + h2sinterface): ifc = globalv.globalvars[i] ifc = ifc.instantiate(dict(zip(ifc.params, ifc.params))) ifc.ind = AST.Interface(i, [], [], None, ifc.package) ifc.ind.insertPutFailedMethod() ifc.ind.req = ifc ifc.assignRequestResponseChannels() ifc.ind.assignRequestResponseChannels() if i in s2hinterface: swProxies.append(ifc) hwWrappers.append(ifc) if i in h2sinterface: hwProxies.append(ifc) swWrappers.append(ifc) cppgen.generate_cpp(globalv.globaldecls, project_dir, noisyFlag, swProxies, swWrappers) bsvgen.generate_bsv(globalimports, project_dir, noisyFlag, hwProxies, hwWrappers, dutname)
def generate_bsvcpp(filelist, project_dir, bsvdefines, interfaces, bsvpath): for inputfile in filelist: syntax_parse(open(inputfile).read(), inputfile, bsvdefines, bsvpath) ## code generation pass ilist = [] for i in interfaces: ifc = globalv.globalvars.get(i) if not ifc: print('Connectal: Unable to locate the interface:', i) for keys in globalv.globalvars: print(' ', keys) sys.exit(1) ifc = ifc.instantiate(dict(zip(ifc.params, ifc.params))) ilist.append(ifc) for ditem in ifc.decls: for pitem in ditem.params: thisType = pitem.type p = globalv.globalvars.get(thisType.name) if p and thisType.params and p.params: myName = '%sL_%s_P' % (thisType.name, '_'.join( [t.name for t in thisType.params if t])) pitem.oldtype = pitem.type pitem.type = AST.Type(myName, []) if not globalv.globalvars.get(myName): globalv.add_new( AST.TypeDef( p.tdtype.instantiate( dict(zip(p.params, thisType.params))), myName, [])) jsondata = AST.serialize_json(ilist, globalimports, bsvdefines) if project_dir: cppgen.generate_cpp(project_dir, noisyFlag, jsondata) bsvgen.generate_bsv(project_dir, noisyFlag, False, jsondata)
def generate_bsvcpp(filelist, project_dir, bsvdefines, interfaces): for inputfile in filelist: syntax_parse(open(inputfile).read(),inputfile, bsvdefines) ## code generation pass ilist = [] for i in interfaces: ifc = globalv.globalvars.get(i) if not ifc: print 'Connectal: Unable to locate the interface:', i for keys in globalv.globalvars: print ' ', keys sys.exit(1) ifc = ifc.instantiate(dict(zip(ifc.params, ifc.params))) ilist.append(ifc) for ditem in ifc.decls: for pitem in ditem.params: thisType = pitem.type p = globalv.globalvars.get(thisType.name) if p and thisType.params and p.params: myName = '%sL_%s_P' % (thisType.name, '_'.join([t.name for t in thisType.params if t])) pitem.oldtype = pitem.type pitem.type = AST.Type(myName, []) if not globalv.globalvars.get(myName): globalv.add_new(AST.TypeDef(p.tdtype.instantiate(dict(zip(p.params, thisType.params))), myName, [])) jsondata = AST.serialize_json(ilist, globalimports, bsvdefines) if project_dir: cppgen.generate_cpp(project_dir, noisyFlag, jsondata) bsvgen.generate_bsv(project_dir, noisyFlag, False, jsondata)
def generate_bsvcpp(filelist, project_dir, dutname, bsvdefines, interfaces, nf): global noisyFlag noisyFlag=nf for inputfile in filelist: syntax_parse(open(inputfile).read(),inputfile, bsvdefines) ## code generation pass ilist = [] for i in interfaces: ifc = globalv.globalvars[i] ifc = ifc.instantiate(dict(zip(ifc.params, ifc.params))) ifc.ind = AST.Interface(i, [], [], None, ifc.package) ifc.ind.req = ifc ilist.append(ifc) jsondata = AST.serialize_json(ilist, globalimports, dutname) cppgen.generate_cpp(project_dir, noisyFlag, jsondata) bsvgen.generate_bsv(project_dir, noisyFlag, jsondata)
debugfile=parserdir + '/parser.out') import parsetab sys.exit(0) ifitems = [] t = os.environ.get('INTERFACES') if t: t = t.split() for item in t: if item not in ifitems: ifitems.append(item) deflist = [] t = os.environ.get('BSVDEFINES_LIST') if t: deflist = t.split() noisyFlag = os.environ.get('D') == '1' if os.environ.get('D'): parseDebugFlag = True if noisyFlag: parseTrace = True project_dir = os.environ.get('DTOP') tmp = os.environ.get('PROTODEBUG') if tmp: print('JSONNN', tmp) j2file = open(tmp).read() jsondata = json.loads(j2file) cppgen.generate_cpp(project_dir, noisyFlag, jsondata) bsvgen.generate_bsv(project_dir, noisyFlag, True, jsondata) else: bsvpath = os.environ.get('BSVPATH', []).split(':') generate_bsvcpp(sys.argv[1:], project_dir, deflist, ifitems, bsvpath)
parser = yacc.yacc(outputdir=parserdir,debugfile=parserdir+'/parser.out') import parsetab sys.exit(0) ifitems = [] t = os.environ.get('INTERFACES') if t: t = t.split() for item in t: if item not in ifitems: ifitems.append(item) deflist = [] t = os.environ.get('BSVDEFINES_LIST') if t: deflist = t.split() noisyFlag = os.environ.get('V') == '1' if os.environ.get('D'): parseDebugFlag=True if noisyFlag: parseTrace=True project_dir = os.environ.get('DTOP') tmp = os.environ.get('PROTODEBUG') if tmp: print 'JSONNN', tmp j2file = open(tmp).read() jsondata = json.loads(j2file) cppgen.generate_cpp(project_dir, noisyFlag, jsondata) bsvgen.generate_bsv(project_dir, noisyFlag, True, jsondata) else: generate_bsvcpp(sys.argv[1:], project_dir, deflist, ifitems)