public void WriteSVInterface(EsiInterface iface, FileInfo to) { var svTypeWriter = new EsiSystemVerilogTypeWriter(C); string SimpleTypeString(EsiType type) { try { return(svTypeWriter.GetSVTypeSimple(type, useName: true)); } catch (Exception e) { C.Log.Error("Exception in getting a typestring for '{type}': {e}", type, e); return("<exception>"); } } C.Log.Information("Starting SV interface generation for {iface} to file {file}", iface, to.Name); var paramTypes = iface.Methods.SelectMany(m => m.Params.Select(p => p.Type)); var returnTypes = iface.Methods.SelectMany(m => m.Returns.Select(p => p.Type)); var usedTypes = paramTypes.Concat(returnTypes).Distinct(); var s = new ScriptObject(); s.Add("iface", iface); s.Add("usedTypes", usedTypes); s.Import("SimpleTypeString", new Func <EsiType, string>(SimpleTypeString)); SVUtils.RenderTemplate("sv/full_interface.sv.sbntxt", s, to); }
public void WriteSVTypeInterface(EsiNamedType type, FileInfo to, FileInfo headerFile) { var s = new ScriptObject(); s.Add("header", headerFile); s.Add("type", type); SVUtils.RenderTemplate("sv/type_interface.sv.sbntxt", s, to); }