def __init__(self, filename=None): XmlFileBase.__init__(self, PROJECTS_NODES, PROJECTS_ATTRIBS, filename, None) if filename: self._filename = filename # Convert default string value into integer for clock in self.clocks.iteritems(): clock.frequency = int(clock.frequency)
def __init__(self, filename=None): # Open ZipFile in RAM, so we can modify the archive without loosing previous data. self.zfp = ZipString(filename) xml_data = "" # Scan Zipfile to find XML descriptor for name in self.zfp.namelist(): if name.lower().endswith('.xml'): xml_data = self.zfp.read(name) self.__xml_name = name break XmlFileBase.__init__(self, COMPONENTS_NODES, COMPONENTS_ATTRIBS, None, xml_data) if not filename is None: self.filename = path.basename(filename) # HDL files attributes clean-up for hdl_file in self.hdl_files.iteritems(): hdl_file.order = int(hdl_file.order) hdl_file.istop = to_boolean(hdl_file.istop) # Interfaces attributes clean-up for iface in self.interfaces.iteritems(): iface.type = str(iface.type).upper() iface.name = str(iface.name).lower() # Signals attributes clean-up for port in self.ports.iteritems(): port.name = str(port.name).lower() # Generics attributes clean-up for generic in self.generics.iteritems(): generic.name = str(generic.name).lower() # Perform component valid check self.check()