def getPortsList(self): """ Parse HDL file and return a list of ports""" if not self.isTop(): raise Error("Only top HDL file can be parsed") if self.parser == None: Et = EntityParser() self.parser = Et.factory(self.getFilePath()) parsedportlist = self.parser.parsePort() portlist = [] for parsedport in parsedportlist: port = Port(self,name=parsedport["name"]) port.setDir(parsedport["direction"]) port.setSize(str(parsedport["size"])) port.setDescription(parsedport["description"]) portlist.append(port) return portlist
def getGenericsList(self): """ Parse HDL file and return a list of generic """ if not self.isTop(): raise Error("Only top HDL file can be parsed") if self.parser == None: Et = EntityParser() self.parser = Et.factory(self.getFilePath()) parsed_generic_list = self.parser.parseGeneric() generic_list = [] for parsed_generic in parsed_generic_list: generic = Generic(self,name=parsed_generic["name"]) generic.setType(parsed_generic["type"]) generic.setValue(parsed_generic["defautvalue"]) generic.setDescription(parsed_generic["description"]) generic_list.append(generic) return generic_list
def getEntityName(self): if self.parser == None: Et = EntityParser() self.parser = Et.factory(self.getFilePath()) return self.parser.getEntityName()