def __init__(self, name, dir, ins, runs=None, dbg=None, bflags=None, xflags=None, sbtflags=[], mflags=None, srcdir=None, dstdir=None, narchs=None, xarchs=None, cc=None, rvcc=None, rv32=None): self.name = name self.dir = dir self.ins = ins self.runs = runs self.runs.name = name self.sbtflags = sbtflags self.dbg = dbg self.rv32 = rv32 xflags = cat(bflags, xflags) if dbg == "dbg": bflags = cat(bflags, "--dbg") xflags = cat(xflags, "--dbg --xdbg") elif dbg == "opt": bflags = cat(bflags, "--dbg --opt") xflags = cat(xflags, "--dbg --opt --xdbg") elif dbg == "xopt": bflags = cat(bflags, "--dbg --opt") xflags = cat(xflags, "--dbg --opt --xopt") else: bflags = cat(bflags, "--opt") xflags = cat(xflags, "--opt --xopt") self.narchs = narchs self.xarchs = xarchs self.gm = GenMake(narchs, xarchs, srcdir, dstdir, self.name, xflags, bflags, mflags, self.sbtflags, cc=cc, rvcc=rvcc)
def volstr(bind): src = Helper.cygpath(TOPDIR) dst = "/riscv-sbt" bmount = "--mount type=bind,source={},destination={}" vstr = bmount.format(src, dst) if bind: vstr = cat( vstr, bmount.format(path(src, "toolchain"), path(dst, "toolchain"))) else: vstr = cat(vstr, VOLS.volstr()) return vstr
def get(self): if not os.path.exists(self.dstdir): mkdir_if_needed(self.parent_dir) with cd(self.parent_dir): cmd = cat("git clone", self.clone_flags, self.url) shell(cmd) elif self.update: with cd(self.dstdir): shell("git fetch") with cd(self.dstdir): shell(("if [ `git rev-parse HEAD` != {0} ]; then " + "git checkout {0}; fi").format(self.commit.strip()))
def _bench(self, name, dir, ins, runs, dstdir=None, ctor=Bench, bflags=None, xflags=None, sbtflags=[], cc=None, rvcc=None, **kwargs): dstdir = dstdir if dstdir else path(self.dstdir, dir) bflags = cat(self.bflags, bflags) if GOPTS.rv_soft_float(): sbtflags = sbtflags + ["-soft-float-abi"] return ctor( name=name, dir=dir, ins=ins, runs=runs, srcdir=path(self.srcdir, dir), dstdir=dstdir, bflags=bflags, xflags=xflags, sbtflags=sbtflags, narchs=self.narchs, xarchs=self.xarchs, cc=cc, rvcc=rvcc, rv32=self.rv32, **kwargs)
def volstr(self): vstr = '' for k, v in self.vols.items(): vstr = cat(vstr, v.volstr()) return vstr