def _GenericConstants(self, f: FileWriter) -> FileWriter: gConst = DutInfo.FilterForTag(self.dutInfo.generics, Tags.CONSTANT) gExp = DutInfo.FilterForTag(self.dutInfo.generics, Tags.EXPORT, "true") VhdlTitle("Fixed Generics", f, 2) for g in gConst: f.WriteLn("constant {} : {} := {};".format( g.name, g.type, DutInfo.GetTag(g, Tags.CONSTANT))) f.WriteLn() VhdlTitle("Not Assigned Generics (default values)", f, 2) for g in self.dutInfo.generics: if (g.default is not None) and (g not in gConst) and (g not in gExp): f.WriteLn("constant {} : {} := {};".format( g.name, g.type, g.default)) if self.tbInfo.isMultiCaseTb: f.WriteLn() VhdlTitle("Exported Generics", f, 2) f.WriteLn("constant Generics_c : Generics_t := (").IncIndent() for g in gExp: f.WriteLn("{} => {},".format(g.name, g.name)) if len(gExp) is 0: f.WriteLn("Dummy => true,") f.RemoveFromLastLine(1, keepNewline=True, append=");") f.DecIndent() return f
def _DutInstantiation(self, f: FileWriter) -> FileWriter: VhdlTitle("DUT Instantiation", f) f.WriteLn("i_dut : entity {}.{}".format( self.dutInfo.dutLibrary, self.dutInfo.name)).IncIndent() generics = self.dutInfo.generics eg = (DutInfo.FilterForTag(generics, Tags.EXPORT, "true") + DutInfo.FilterForTag(generics, Tags.CONSTANT)) if len(eg) > 0: f.WriteLn("generic map (").IncIndent() for g in eg: f.WriteLn("{} => {},".format(g.name, g.name)) f.RemoveFromLastLine(1) f.DecIndent().WriteLn(")") f.WriteLn("port map (").IncIndent() for p in self.dutInfo.ports: f.WriteLn("{} => {},".format(p.name, p.name)) f.RemoveFromLastLine(1) f.DecIndent().WriteLn(");").DecIndent() return f
def _EntityDeclaration(self, f: FileWriter) -> FileWriter: VhdlTitle("Entity Declaration", f) f.WriteLn("entity {} is".format(self.tbInfo.tbName)) f.IncIndent() eg = DutInfo.FilterForTag(self.dutInfo.generics, Tags.EXPORT, "true") if len(eg) > 0: f.WriteLn("generic (") f.IncIndent() for g in eg: line = "{} : {}".format(g.name, g.type) if g.default is not None: line += " := {};".format(g.default) else: line += ";" f.WriteLn(line) f.RemoveFromLastLine(1) f.DecIndent().WriteLn(");") f.DecIndent() f.WriteLn("end entity;").WriteLn() return f