def build(self, platform, fragment, build_dir="build", build_name="top", run=True, nowidelut=False, abc9=False, timingstrict=False, ignoreloops=False, seed=1, es_device=False, **kwargs): # 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) # Generate verilog v_output = platform.get_verilog(fragment, name=build_name, **kwargs) named_sc, named_pc = platform.resolve_signals(v_output.ns) top_file = build_name + ".v" v_output.write(top_file) platform.add_source(top_file) # Generate design constraints file (.pdc) _build_pdc(named_sc, named_pc, self.clocks, v_output.ns, build_name) # Generate Yosys script _build_yosys(self.yosys_template, platform, nowidelut, abc9, build_name) # N.B. Radiant does not allow a choice between ES1/production, this is determined # solely by the installed Radiant version. nextpnr/oxide supports both, so we # must choose what we are dealing with device = platform.device if es_device: device += "ES" # Generate build script script = _build_script(False, self.build_template, build_name, device, timingstrict, ignoreloops, seed) # Run if run: _run_script(script) os.chdir(cwd) return v_output.ns
def build_io_constraints(self): _build_pdc(self.named_sc, self.named_pc, self.clocks, self._vns, self._build_name) return (self._build_name + ".pdc", "PDC")