xilinx: ensure we chdir() back after build
This commit is contained in:
parent
52bdc29528
commit
6468fa3db4
|
@ -163,9 +163,6 @@ class XilinxISEToolchain:
|
|||
|
||||
def build(self, platform, fragment, build_dir="build", build_name="top",
|
||||
ise_path=_default_ise_path(), source=_default_source(), run=True, mode="xst"):
|
||||
tools.mkdir_noerror(build_dir)
|
||||
os.chdir(build_dir)
|
||||
|
||||
if not isinstance(fragment, _Fragment):
|
||||
fragment = fragment.get_fragment()
|
||||
platform.finalize(fragment)
|
||||
|
@ -174,6 +171,10 @@ class XilinxISEToolchain:
|
|||
|
||||
vns = None
|
||||
|
||||
tools.mkdir_noerror(build_dir)
|
||||
cwd = os.getcwd()
|
||||
os.chdir(build_dir)
|
||||
try:
|
||||
if mode == "xst" or mode == "yosys":
|
||||
v_output = platform.get_verilog(fragment)
|
||||
vns = v_output.ns
|
||||
|
@ -206,8 +207,8 @@ class XilinxISEToolchain:
|
|||
_run_ise(build_name, ise_path, source, isemode,
|
||||
ngdbuild_opt, self.bitgen_opt, self.ise_commands,
|
||||
self.map_opt, self.par_opt)
|
||||
|
||||
os.chdir("..")
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
return vns
|
||||
|
||||
|
|
Loading…
Reference in New Issue