build/generic_toolchain: build_dir, vns now members. Adds build_placement_constraints call. Write verilog ASAP
This commit is contained in:
parent
564c062074
commit
1f9bf1bd06
|
@ -24,6 +24,7 @@ class GenericToolchain:
|
||||||
self.false_paths = set() # FIXME: use it
|
self.false_paths = set() # FIXME: use it
|
||||||
self.named_pc = []
|
self.named_pc = []
|
||||||
self.named_sc = []
|
self.named_sc = []
|
||||||
|
self._vns = None
|
||||||
self._synth_opts = ""
|
self._synth_opts = ""
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self):
|
||||||
|
@ -56,13 +57,14 @@ class GenericToolchain:
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
|
||||||
self._build_name = build_name
|
self._build_name = build_name
|
||||||
|
self._build_dir = build_dir
|
||||||
self._synth_opts += synth_opts
|
self._synth_opts += synth_opts
|
||||||
self.platform = platform
|
self.platform = platform
|
||||||
|
|
||||||
# Create Build Directory.
|
# Create Build Directory.
|
||||||
os.makedirs(build_dir, exist_ok=True)
|
os.makedirs(self._build_dir, exist_ok=True)
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
os.chdir(build_dir)
|
os.chdir(self._build_dir)
|
||||||
|
|
||||||
# Finalize Design.
|
# Finalize Design.
|
||||||
if not isinstance(fragment, _Fragment):
|
if not isinstance(fragment, _Fragment):
|
||||||
|
@ -71,14 +73,15 @@ class GenericToolchain:
|
||||||
|
|
||||||
# Generate Verilog.
|
# Generate Verilog.
|
||||||
v_output = platform.get_verilog(fragment, name=build_name, **kwargs)
|
v_output = platform.get_verilog(fragment, name=build_name, **kwargs)
|
||||||
|
self._vns = v_output.ns
|
||||||
|
v_file = build_name + ".v"
|
||||||
|
v_output.write(v_file)
|
||||||
|
|
||||||
# Finalize toolchain (after gateware is complete)
|
# Finalize toolchain (after gateware is complete)
|
||||||
self.finalize()
|
self.finalize()
|
||||||
|
|
||||||
# Get signals and platform constraints
|
# Get signals and platform constraints
|
||||||
self.named_sc, self.named_pc = platform.resolve_signals(v_output.ns)
|
self.named_sc, self.named_pc = platform.resolve_signals(self._vns)
|
||||||
v_file = build_name + ".v"
|
|
||||||
v_output.write(v_file)
|
|
||||||
platform.add_source(v_file)
|
platform.add_source(v_file)
|
||||||
|
|
||||||
# Generate Design IO Constraints File.
|
# Generate Design IO Constraints File.
|
||||||
|
@ -87,6 +90,9 @@ class GenericToolchain:
|
||||||
# Generate Design Timing Constraints File.
|
# Generate Design Timing Constraints File.
|
||||||
tim_cst_file = self.build_timing_constraints(v_output.ns)
|
tim_cst_file = self.build_timing_constraints(v_output.ns)
|
||||||
|
|
||||||
|
# Generate Design Placement Constraints File.
|
||||||
|
place_cst_file = self.build_placement_constraints()
|
||||||
|
|
||||||
if backend not in self.supported_backend:
|
if backend not in self.supported_backend:
|
||||||
raise NotImplementedError("Backend {backend} not supported by {toolchain} toolchain".format(
|
raise NotImplementedError("Backend {backend} not supported by {toolchain} toolchain".format(
|
||||||
backend=backend,
|
backend=backend,
|
||||||
|
@ -122,6 +128,8 @@ class GenericToolchain:
|
||||||
files.append({'name':os.path.abspath(io_cst_file[0]), 'file_type':io_cst_file[1]})
|
files.append({'name':os.path.abspath(io_cst_file[0]), 'file_type':io_cst_file[1]})
|
||||||
if tim_cst_file[0] != "":
|
if tim_cst_file[0] != "":
|
||||||
files.append({'name':os.path.abspath(tim_cst_file[0]), 'file_type':tim_cst_file[1]})
|
files.append({'name':os.path.abspath(tim_cst_file[0]), 'file_type':tim_cst_file[1]})
|
||||||
|
if place_cst_file[0] != "":
|
||||||
|
files.append({'name':os.path.abspath(place_cst_file[0]), 'file_type':place_cst_file[1]})
|
||||||
|
|
||||||
edam = {
|
edam = {
|
||||||
'name' : self._build_name,
|
'name' : self._build_name,
|
||||||
|
@ -130,7 +138,7 @@ class GenericToolchain:
|
||||||
'toplevel' : self._build_name,
|
'toplevel' : self._build_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
backend = get_edatool(tool)(edam=edam, work_root=build_dir)
|
backend = get_edatool(tool)(edam=edam, work_root=self._build_dir)
|
||||||
backend.configure()
|
backend.configure()
|
||||||
if run:
|
if run:
|
||||||
backend.build()
|
backend.build()
|
||||||
|
|
Loading…
Reference in New Issue