build/gowin: Add copy of bitstream to from impl to gateware directory.

This commit is contained in:
Florent Kermarrec 2022-03-17 09:35:34 +01:00
parent 148324862a
commit 2ec0ebe40f
1 changed files with 8 additions and 2 deletions

View File

@ -9,7 +9,7 @@ import os
import sys import sys
import math import math
import subprocess import subprocess
from shutil import which from shutil import which, copyfile
from migen.fhdl.structure import _Fragment from migen.fhdl.structure import _Fragment
@ -126,8 +126,8 @@ class GowinToolchain:
cwd = os.getcwd() cwd = os.getcwd()
os.makedirs(build_dir, exist_ok=True) os.makedirs(build_dir, exist_ok=True)
os.chdir(build_dir) os.chdir(build_dir)
# Finalize design
# Finalize design
if not isinstance(fragment, _Fragment): if not isinstance(fragment, _Fragment):
fragment = fragment.get_fragment() fragment = fragment.get_fragment()
platform.finalize(fragment) platform.finalize(fragment)
@ -180,6 +180,12 @@ class GowinToolchain:
if subprocess.call([gw_sh, "run.tcl"]) != 0: if subprocess.call([gw_sh, "run.tcl"]) != 0:
raise OSError("Error occured during Gowin's script execution.") raise OSError("Error occured during Gowin's script execution.")
# Copy Bitstream to from impl to gateware directory.
copyfile(
os.path.join(build_dir, "impl", "pnr", "project.fs"),
os.path.join(build_dir, build_name + ".fs")
)
os.chdir(cwd) os.chdir(cwd)
return v_output.ns return v_output.ns