def generate(self, project_name: str = None, **kwargs) -> object: """ Generates FPGA configs """ if project_name or kwargs: self.setup(project_name=project_name, **kwargs) self.configs = {'LICENSE': Loader.load_static("LICENSE")} self.configs.update( dict( zip( map(lambda x: f"{self.project_name}.{x}", ("v", "qpf", "qsf", "sdc")), (Render.v(self.project_name, assignments=self._v, **self._mips_v), Render.qpf(self.project_name, **self._qpf), Render.qsf(self.project_name, func=self._functions, mips=self._mips_qsf, **self._qsf), Render.sdc(self.project_name, mips=self._mips_type, **self._sdc))))) # NOTE additional modules are placed in separate folder 'functions' self.configs.update( dict( zip( map(lambda x: x + ".v", self._functions), # file paths map(lambda x: Render.functions(x, **self._func), self._functions)))) if self._mips_type: # Generate additional configs for SchoolMIPS program_hex = os.path.join(PATHS.MIPS, "program.hex") self.configs['program.hex'] = Loader.load_static(program_hex) mips_path = os.path.join(PATHS.MIPS, self._mips_type) files = os.listdir(mips_path) self.configs.update( dict( zip( map(lambda x: os.path.join(DESTINATIONS.MIPS, x), files), map(lambda x: Loader.load_static(x, mips_path), files)))) return self
def test_load_static(self) -> NoReturn: params = {'encoding': None} for res in (Loader.load_static(self.fullpath, **params), Loader.load_static(self.filename, self.path, **params), Loader.load_static(self.fullname, self.path, **params)): _test_static_content(res)