def _make_grc_xml_from_block_data(self, params, iosig, blockname): """ Take the return values from the parser and call the XML generator. Also, check the makefile if the .xml file is in there. If necessary, add. """ fname_xml = '%s_%s.xml' % (self._info['modname'], blockname) # Some adaptions for the GRC for inout in ('in', 'out'): if iosig[inout]['max_ports'] == '-1': iosig[inout]['max_ports'] = '$num_%sputs' % inout params.append({'key': 'num_%sputs' % inout, 'type': 'int', 'name': 'Num %sputs' % inout, 'default': '2', 'in_constructor': False}) if os.path.isfile(os.path.join('grc', fname_xml)): if not self._info['yes']: if not ask_yes_no('Overwrite existing GRC file?', False): return else: print "Warning: Overwriting existing GRC file." grc_generator = GRCXMLGenerator( modname=self._info['modname'], blockname=blockname, params=params, iosig=iosig ) grc_generator.save(os.path.join('grc', fname_xml)) if not self._skip_subdirs['grc']: ed = CMakeFileEditor(self._file['cmgrc']) if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'): print "Adding GRC bindings to grc/CMakeLists.txt..." ed.append_value('install', fname_xml, to_ignore_end='DESTINATION[^()]+') ed.write()
def _make_grc_xml_from_block_data(self, params, iosig, blockname): """ Take the return values from the parser and call the XML generator. Also, check the makefile if the .xml file is in there. If necessary, add. """ fname_xml = '%s_%s.xml' % (self._info['modname'], blockname) # Some adaptions for the GRC for inout in ('in', 'out'): if iosig[inout]['max_ports'] == '-1': iosig[inout]['max_ports'] = '$num_%sputs' % inout params.append({ 'key': 'num_%sputs' % inout, 'type': 'int', 'name': 'Num %sputs' % inout, 'default': '2', 'in_constructor': False }) if os.path.isfile(os.path.join('grc', fname_xml)): # TODO add an option to keep print "Warning: Overwriting existing GRC file." grc_generator = GRCXMLGenerator(modname=self._info['modname'], blockname=blockname, params=params, iosig=iosig) grc_generator.save(os.path.join('grc', fname_xml)) if not self._skip_subdirs['grc']: ed = CMakeFileEditor(self._file['cmgrc']) if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'): print "Adding GRC bindings to grc/CMakeLists.txt..." ed.append_value('install', fname_xml, 'DESTINATION[^()]+') ed.write()
def _run_rfnoc(self): """ Do everything that needs doing in the subdir 'rfnoc' to add a GRC block control bindings XML file. - add .xml file - include in CMakeLists.txt - add verilog file - adds verilog name to Makefile.srcs - Calls _run_testbenches() - Runs build (test) """ fname_rfnoc = self._info['blockname'] + '.xml' fname_rfnocv = 'noc_block_' + self._info['blockname'] + '.v' self._write_tpl('rfnoc_xml', 'rfnoc/blocks', fname_rfnoc) self._write_tpl('rfnoc_v', 'rfnoc/fpga-src', fname_rfnocv) patt_v = re.escape('$(addprefix '+os.path.join(os.getcwd(),'rfnoc','fpga-src','')+', \\\n') #TODO can be replaced with a dummy, as the file is supposed to be empty append_re_line_sequence(self._file['rfnoc_mksrc'], patt_v, 'noc_block_' + self._info['blockname'] + '.v \\') ed = CMakeFileEditor(self._file['cmrfnoc'], '\n ') self._run_testbenches() self._build() if self._skip_cmakefiles or ed.check_for_glob('*.xml'): return print("Editing rfnoc/blocks/CMakeLists.txt...") ed.append_value('install', fname_rfnoc, to_ignore_end='DESTINATION[^()]+') ed.write() self.scm.mark_files_updated((self._file['cmrfnoc'],))
def _run_grc(self): """ Do everything that needs doing in the subdir 'grc' to add a GRC bindings XML file. - add .xml file - include in CMakeLists.txt """ fname_grc = self._info['fullblockname'] + '.xml' self._write_tpl('grc_xml', 'grc', fname_grc) ed = CMakeFileEditor(self._file['cmgrc'], '\n ') if self.options.skip_cmakefiles or ed.check_for_glob('*.xml'): return print "Editing grc/CMakeLists.txt..." ed.append_value('install', fname_grc, to_ignore_end='DESTINATION[^()]+') ed.write()