def build(self, platform, fragment, build_dir = "build", build_name = "top", run = True, enable_xpm = False, **kwargs): self._check_properties(platform) # Create build directory os.makedirs(build_dir, exist_ok=True) cwd = os.getcwd() os.chdir(build_dir) # Finalize design if not isinstance(fragment, _Fragment): fragment = fragment.get_fragment() platform.finalize(fragment) # Symbiflow-specific fixes for instance in fragment.specials: if isinstance(instance, Instance): self._fix_instance(instance) # Generate timing constraints self._build_clock_constraints(platform) # Generate verilog v_output = platform.get_verilog(fragment, name=build_name, **kwargs) named_sc, named_pc = platform.resolve_signals(v_output.ns) v_file = build_name + ".v" v_output.write(v_file) platform.add_source(v_file) self._generate_makefile( platform = platform, build_name = build_name ) # Generate design constraints tools.write_to_file(build_name + ".xdc", _build_xdc(named_sc, False)) tools.write_to_file(build_name + ".pcf", _build_pcf(named_sc)) tools.write_to_file(build_name + ".sdc", _build_sdc(named_pc)) if run: _run_make() os.chdir(cwd) return v_output.ns
def build_io_constraints(self): # Generate design constraints tools.write_to_file(self._build_name + ".xdc", _build_xdc(self.named_sc, self.named_pc)) return (self._build_name + ".xdc", "XDC")