public virtual string TransformText() { this.GenerationEnvironment = null; #line 1 "" this.Write(""); #line default #line hidden #line 7 "" this.Write("#ifndef SME_"); #line default #line hidden #line 7 "" this.Write(this.ToStringHelper.ToStringWithCulture(RSP.Process.Name.ToUpper())); #line default #line hidden #line 7 "" this.Write("_HPP\n#define SME_"); #line default #line hidden #line 8 "" this.Write(this.ToStringHelper.ToStringWithCulture(RSP.Process.Name.ToUpper())); #line default #line hidden #line 8 "" this.Write("_HPP\n\n#include \"SystemTypes.hpp\"\n#include \""); #line default #line hidden #line 11 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 11 "" this.Write("\"\n#include \""); #line default #line hidden #line 12 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 12 "" this.Write("\"\n\n"); #line default #line hidden #line 14 "" var busses = RSP.Process.InputBusses.Concat(RSP.Process.OutputBusses).Concat(RSP.Process.InternalBusses).Distinct().OrderBy(x => x.Name).ToArray(); var members = RSP.Process.SharedVariables.Cast <DataElement>().Union(RSP.Process.SharedSignals).ToArray(); #line default #line hidden #line 19 "" this.Write("\nclass "); #line default #line hidden #line 20 "" this.Write(this.ToStringHelper.ToStringWithCulture(RSP.Process.Name)); #line default #line hidden #line 20 "" this.Write(" : public IProcess {\n // Insert additional private variables and methods here\n" + " // #### USER-DATA-PRIVATE-START\n // #### USER-DATA-PRIVATE-END\n\nprivate:\n" + ""); #line default #line hidden #line 26 "" if (RSP.Process.SharedVariables.Any()) { #line default #line hidden #line 27 "" this.Write(" // Shared variables\n"); #line default #line hidden #line 28 "" foreach (var v in RSP.Process.SharedVariables) { #line default #line hidden #line 29 "" this.Write(" "); #line default #line hidden #line 29 "" this.Write(this.ToStringHelper.ToStringWithCulture(Type(v))); #line default #line hidden #line 29 "" this.Write(" "); #line default #line hidden #line 29 "" this.Write(this.ToStringHelper.ToStringWithCulture(v.Name)); #line default #line hidden #line 29 "" this.Write(";\n"); #line default #line hidden #line 30 "" if (v.CecilType.IsArrayType()) { #line default #line hidden #line 31 "" this.Write(" size_t size_"); #line default #line hidden #line 31 "" this.Write(this.ToStringHelper.ToStringWithCulture(v.Name)); #line default #line hidden #line 31 "" this.Write(";\n"); #line default #line hidden #line 32 "" } #line default #line hidden #line 33 "" } #line default #line hidden #line 34 "" this.Write("\n"); #line default #line hidden #line 35 "" } #line default #line hidden #line 36 "" if (RSP.Process.SharedSignals.Any()) { #line default #line hidden #line 37 "" this.Write(" // Shared signals\n"); #line default #line hidden #line 38 "" foreach (var v in RSP.Process.SharedSignals) { #line default #line hidden #line 39 "" this.Write(" "); #line default #line hidden #line 39 "" this.Write(this.ToStringHelper.ToStringWithCulture(Type(v))); #line default #line hidden #line 39 "" this.Write(" "); #line default #line hidden #line 39 "" this.Write(this.ToStringHelper.ToStringWithCulture(v.Name)); #line default #line hidden #line 39 "" this.Write(";\n"); #line default #line hidden #line 40 "" if (v.CecilType.IsArrayType()) { #line default #line hidden #line 41 "" this.Write(" size_t size_"); #line default #line hidden #line 41 "" this.Write(this.ToStringHelper.ToStringWithCulture(v.Name)); #line default #line hidden #line 41 "" this.Write(";\n"); #line default #line hidden #line 42 "" } #line default #line hidden #line 43 "" } #line default #line hidden #line 44 "" this.Write("\n"); #line default #line hidden #line 45 "" } #line default #line hidden #line 46 "" this.Write(" // Bus pointers\n"); #line default #line hidden #line 47 "" foreach (var bus in busses) { #line default #line hidden #line 48 "" this.Write(" "); #line default #line hidden #line 48 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 48 "" this.Write("* bus_"); #line default #line hidden #line 48 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(bus, RSP.Process))); #line default #line hidden #line 48 "" this.Write(";\n"); #line default #line hidden #line 49 "" } #line default #line hidden #line 50 "" this.Write("\n"); #line default #line hidden #line 51 "" if (RSP.Process.Methods != null && RSP.Process.Methods.Any(x => !x.Ignore)) { #line default #line hidden #line 52 "" this.Write(" // Internal methods\n"); #line default #line hidden #line 53 "" foreach (var s in RSP.Process.Methods.Where(x => !x.Ignore)) { #line default #line hidden #line 54 "" var rettype = (s.ReturnVariable == null || s.ReturnVariable.CecilType.IsSameTypeReference(typeof(void))) ? "void" : Type(s.ReturnVariable); #line default #line hidden #line 57 "" this.Write(" "); #line default #line hidden #line 57 "" this.Write(this.ToStringHelper.ToStringWithCulture(rettype)); #line default #line hidden #line 57 "" this.Write(" "); #line default #line hidden #line 57 "" this.Write(this.ToStringHelper.ToStringWithCulture(s.Name)); #line default #line hidden #line 57 "" this.Write("("); #line default #line hidden #line 57 "" this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(", ", s.Parameters.Select(x => $"{Type(x)} {x.Name}")))); #line default #line hidden #line 57 "" this.Write(");\n"); #line default #line hidden #line 58 "" } #line default #line hidden #line 59 "" } #line default #line hidden #line 60 "" this.Write("\npublic:\n "); #line default #line hidden #line 62 "" this.Write(this.ToStringHelper.ToStringWithCulture(RSP.Process.Name)); #line default #line hidden #line 62 "" this.Write("(\n"); #line default #line hidden #line 63 "" foreach (var bus in busses) { #line default #line hidden #line 64 "" this.Write(" "); #line default #line hidden #line 64 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 64 "" this.Write("* p"); #line default #line hidden #line 64 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(bus, RSP.Process))); #line default #line hidden #line 64 "" this.Write(this.ToStringHelper.ToStringWithCulture((bus == busses.Last() && members.Length == 0) ? "" : ",")); #line default #line hidden #line 64 "" this.Write("\n"); #line default #line hidden #line 65 "" } #line default #line hidden #line 66 "" foreach (var v in members) { var rt = RS.TypeScope.GetType(v); if (rt.IsArray) { #line default #line hidden #line 69 "" this.Write(" size_t init_size_"); #line default #line hidden #line 69 "" this.Write(this.ToStringHelper.ToStringWithCulture(v.Name)); #line default #line hidden #line 69 "" this.Write(",\n"); #line default #line hidden #line 70 "" } #line default #line hidden #line 71 "" this.Write(" const "); #line default #line hidden #line 71 "" this.Write(this.ToStringHelper.ToStringWithCulture(Type(v))); #line default #line hidden #line 71 "" this.Write(" init_"); #line default #line hidden #line 71 "" this.Write(this.ToStringHelper.ToStringWithCulture(v.Name)); #line default #line hidden #line 71 "" this.Write(this.ToStringHelper.ToStringWithCulture(v == members.Last() ? "" : ",")); #line default #line hidden #line 71 "" this.Write("\n"); #line default #line hidden #line 72 "" } #line default #line hidden #line 73 "" this.Write(" );\n\n void onTick();\n};\n\n#endif /* SME_"); #line default #line hidden #line 78 "" this.Write(this.ToStringHelper.ToStringWithCulture(RSP.Process.Name.ToUpper())); #line default #line hidden #line 78 "" this.Write("_HPP */\n"); #line default #line hidden return(this.GenerationEnvironment.ToString()); }
public virtual string TransformText() { this.GenerationEnvironment = null; #line 1 "" this.Write(""); #line default #line hidden #line 6 "" this.Write("all: build\n\nGPP = g++\nCPPFLAGS = \n\nbuild: "); #line default #line hidden #line 11 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network))); #line default #line hidden #line 11 "" this.Write("\n\n"); #line default #line hidden #line 13 "" var cust_tag = CustomFiles == null || CustomFiles.Count() == 0 ? "" : " custom_files"; #line default #line hidden #line 16 "" this.Write("\n"); #line default #line hidden #line 17 "" if (!string.IsNullOrEmpty(cust_tag)) { #line default #line hidden #line 18 "" this.Write("custom_files: "); #line default #line hidden #line 18 "" foreach (var file in CustomFiles) { #line default #line hidden #line 19 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 19 "" this.Write(".o "); #line default #line hidden #line 19 "" } #line default #line hidden #line 20 "" this.Write("\n"); #line default #line hidden #line 21 "" } #line default #line hidden #line 22 "" this.Write("\n"); #line default #line hidden #line 23 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusImplementationsFileName(Network))); #line default #line hidden #line 23 "" this.Write(".o: SystemTypes.hpp "); #line default #line hidden #line 23 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 23 "" this.Write(" "); #line default #line hidden #line 23 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 23 "" this.Write(" "); #line default #line hidden #line 23 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusImplementationsFileName(Network))); #line default #line hidden #line 23 "" this.Write(".cpp\n\t${GPP} ${CPPFLAGS} -c "); #line default #line hidden #line 24 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusImplementationsFileName(Network))); #line default #line hidden #line 24 "" this.Write(".cpp\n\n"); #line default #line hidden #line 26 "" foreach (var file in Filenames) { #line default #line hidden #line 27 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 27 "" this.Write(".o: "); #line default #line hidden #line 27 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 27 "" this.Write(".cpp "); #line default #line hidden #line 27 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 27 "" this.Write(".hpp SystemTypes.hpp "); #line default #line hidden #line 27 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 27 "" this.Write(" "); #line default #line hidden #line 27 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 27 "" this.Write(this.ToStringHelper.ToStringWithCulture(cust_tag)); #line default #line hidden #line 27 "" this.Write("\n\t${GPP} ${CPPFLAGS} -c "); #line default #line hidden #line 28 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 28 "" this.Write(".cpp\n"); #line default #line hidden #line 29 "" } #line default #line hidden #line 30 "" this.Write("\n"); #line default #line hidden #line 31 "" if (!string.IsNullOrEmpty(cust_tag)) { #line default #line hidden #line 32 "" foreach (var file in CustomFiles) { #line default #line hidden #line 33 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 33 "" this.Write(".o: "); #line default #line hidden #line 33 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 33 "" this.Write(".cpp SystemTypes.hpp "); #line default #line hidden #line 33 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 33 "" this.Write(" "); #line default #line hidden #line 33 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 33 "" this.Write("\n\t${GPP} ${CPPFLAGS} -c "); #line default #line hidden #line 34 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 34 "" this.Write(".cpp\n"); #line default #line hidden #line 35 "" } #line default #line hidden #line 36 "" } #line default #line hidden #line 37 "" this.Write("\n"); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 38 "" this.Write(".o: "); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 38 "" this.Write(".cpp "); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 38 "" this.Write(".hpp SystemTypes.hpp "); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 38 "" this.Write(" "); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 38 "" this.Write(" "); #line default #line hidden #line 38 "" foreach (var file in Filenames) { #line default #line hidden #line 39 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 39 "" this.Write(".o "); #line default #line hidden #line 39 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 39 "" this.Write(".hpp "); #line default #line hidden #line 39 "" } #line default #line hidden #line 40 "" this.Write(this.ToStringHelper.ToStringWithCulture(cust_tag)); #line default #line hidden #line 40 "" this.Write("\n\t${GPP} ${CPPFLAGS} -c "); #line default #line hidden #line 41 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 41 "" this.Write(".cpp\n\n"); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network))); #line default #line hidden #line 43 "" this.Write(": "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network))); #line default #line hidden #line 43 "" this.Write(".cpp SystemTypes.hpp "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 43 "" this.Write(" "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 43 "" this.Write(" "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusImplementationsFileName(Network))); #line default #line hidden #line 43 "" this.Write(".o "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 43 "" this.Write(".o "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 43 "" this.Write(".hpp "); #line default #line hidden #line 43 "" foreach (var file in Filenames) { #line default #line hidden #line 44 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 44 "" this.Write(".o "); #line default #line hidden #line 44 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 44 "" this.Write(".hpp "); #line default #line hidden #line 44 "" } #line default #line hidden #line 45 "" this.Write(this.ToStringHelper.ToStringWithCulture(cust_tag)); #line default #line hidden #line 45 "" this.Write("\n\t${GPP} "); #line default #line hidden #line 46 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network))); #line default #line hidden #line 46 "" this.Write(".cpp "); #line default #line hidden #line 46 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusImplementationsFileName(Network))); #line default #line hidden #line 46 "" this.Write(".o "); #line default #line hidden #line 46 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network))); #line default #line hidden #line 46 "" this.Write(".o "); #line default #line hidden #line 46 "" foreach (var file in Filenames) { #line default #line hidden #line 47 "" this.Write(this.ToStringHelper.ToStringWithCulture(file)); #line default #line hidden #line 47 "" this.Write(".o "); #line default #line hidden #line 47 "" } #line default #line hidden #line 48 "" this.Write(" -o "); #line default #line hidden #line 48 "" this.Write(this.ToStringHelper.ToStringWithCulture(Network.Name)); #line default #line hidden #line 48 "" this.Write("\n\nclean:\n\trm -rf *.o "); #line default #line hidden #line 51 "" this.Write(this.ToStringHelper.ToStringWithCulture(Network.Name)); #line default #line hidden #line 51 "" this.Write("\n\n\n.PHONY: all clean "); #line default #line hidden #line 54 "" this.Write(this.ToStringHelper.ToStringWithCulture(cust_tag)); #line default #line hidden #line 54 "" this.Write("\n"); #line default #line hidden return(this.GenerationEnvironment.ToString()); }
public virtual string TransformText() { this.GenerationEnvironment = null; #line 1 "" this.Write(""); #line default #line hidden #line 6 "" this.Write("#include <iostream>\n#include <fstream>\n#include <sstream>\n#include \"SystemTypes.h" + "pp\"\n#include \""); #line default #line hidden #line 10 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 10 "" this.Write("\"\n#include \""); #line default #line hidden #line 11 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SharedDefinitionsFileName(Network))); #line default #line hidden #line 11 "" this.Write("\"\n\n"); #line default #line hidden #line 13 "" foreach (var process in Network.Processes) { #line default #line hidden #line 14 "" this.Write("#include \""); #line default #line hidden #line 14 "" this.Write(this.ToStringHelper.ToStringWithCulture(process.Name)); #line default #line hidden #line 14 "" this.Write(".hpp\"\n"); #line default #line hidden #line 15 "" } #line default #line hidden #line 16 "" this.Write("\n// Insert additional includes and classes here\n// #### USER-DATA-INCLUDE-START\n/" + "/ #### USER-DATA-INCLUDE-END\n\nclass "); #line default #line hidden #line 21 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network))); #line default #line hidden #line 21 "" this.Write(" {\n\n// Insert additional variables and methods here\n// #### USER-VARIABLE-INCLUDE" + "-START\n// #### USER-VARIABLE-INCLUDE-END\n\nprivate:\n\n // Internal Busses\n"); #line default #line hidden #line 30 "" foreach (var bus in Network.Busses.Where(x => !(x.IsTopLevelInput || x.IsTopLevelOutput))) { #line default #line hidden #line 31 "" this.Write(" "); #line default #line hidden #line 31 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 31 "" this.Write(" bus_"); #line default #line hidden #line 31 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(bus))); #line default #line hidden #line 31 "" this.Write(";\n"); #line default #line hidden #line 32 "" } #line default #line hidden #line 33 "" this.Write("\n // Processes\n"); #line default #line hidden #line 35 "" foreach (var process in Network.Processes) { #line default #line hidden #line 36 "" this.Write(" "); #line default #line hidden #line 36 "" this.Write(this.ToStringHelper.ToStringWithCulture(process.Name)); #line default #line hidden #line 36 "" this.Write(" proc_"); #line default #line hidden #line 36 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToValidName(process))); #line default #line hidden #line 36 "" this.Write(";\n"); #line default #line hidden #line 37 "" } #line default #line hidden #line 38 "" this.Write("\n // The trace input file, if any\n std::ifstream* trace_input;\n\n // The " + "current trace input line\n std::string input_line;\n\n // The currently simul" + "ated cycle\n size_t cycle;\n\npublic:\n // Top level input/output busses\n"); #line default #line hidden #line 50 "" foreach (var bus in Network.Busses.Where(x => (x.IsTopLevelInput || x.IsTopLevelOutput))) { #line default #line hidden #line 51 "" this.Write(" "); #line default #line hidden #line 51 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 51 "" this.Write(" bus_"); #line default #line hidden #line 51 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(bus))); #line default #line hidden #line 51 "" this.Write(";\n"); #line default #line hidden #line 52 "" } #line default #line hidden #line 53 "" this.Write("\n // Default constructor\n "); #line default #line hidden #line 55 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network))); #line default #line hidden #line 55 "" this.Write(@"(); // Helper method for running a complete simulation from a // trace file size_t RunSimulation(const char* inputfile); // Opens the file and prepares the input for driving signals // and post simulation verification void LoadTraceInput(const char* inputfile); // Drives the input signals with the values found in the // tracefile passed to the constructor bool DriveFromTraceInput(); // Prepares the simulation for the next tick void FinishCycle(); // Performs a single iteration of the program void OnTick(); // Performs post-tick verification of all signals void VerifyTrace(); // Shuts down the simulation, closing all open files void Stop(); // Gets the current cycle size_t Cycle() { return cycle; } };"); #line default #line hidden return(this.GenerationEnvironment.ToString()); }
public virtual string TransformText() { this.GenerationEnvironment = null; #line 1 "" this.Write(""); #line default #line hidden #line 6 "" this.Write("#include <iostream>\n#include <cstring>\n#include \""); #line default #line hidden #line 8 "" this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusDefinitionsFileName(Network))); #line default #line hidden #line 8 "" this.Write("\"\n\n// Insert additional includes here\n// #### USER-DATA-INCLUDE-START\n// #### USE" + "R-DATA-INCLUDE-END\n\n"); #line default #line hidden #line 14 "" var known = new HashSet <Type>(); foreach (var bus in Network.Busses) { if (known.Contains(bus.SourceType)) { continue; } known.Add(bus.SourceType); #line default #line hidden #line 21 "" this.Write("\n"); #line default #line hidden #line 22 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 22 "" this.Write("::"); #line default #line hidden #line 22 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 22 "" this.Write(" () {\n"); #line default #line hidden #line 23 "" foreach (var signal in bus.Signals) { var cpptype = RS.TypeScope.GetType(signal); if (cpptype.IsArray) { var eltype = cpptype.ElementName; string arraylen = string.Empty; if (signal.DefaultValue is SME.AST.ArrayCreateExpression) { arraylen = (signal.DefaultValue as SME.AST.ArrayCreateExpression).ElementExpressions.Length.ToString(); } else if (signal.DefaultValue is SME.AST.EmptyArrayCreateExpression) { arraylen = RS.Renderer.RenderExpression((signal.DefaultValue as SME.AST.EmptyArrayCreateExpression).SizeExpression); } else { arraylen = RS.GetArrayLength(signal).DefaultValue.ToString(); } #line default #line hidden #line 37 "" this.Write(" \n size_"); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 38 "" this.Write(" = "); #line default #line hidden #line 38 "" this.Write(this.ToStringHelper.ToStringWithCulture(arraylen)); #line default #line hidden #line 38 "" this.Write(";\n valid_"); #line default #line hidden #line 39 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 39 "" this.Write(" = new bool[size_"); #line default #line hidden #line 39 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 39 "" this.Write("];\n written_"); #line default #line hidden #line 40 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 40 "" this.Write(" = new bool[size_"); #line default #line hidden #line 40 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 40 "" this.Write("];\n staged_"); #line default #line hidden #line 41 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 41 "" this.Write(" = new bool[size_"); #line default #line hidden #line 41 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 41 "" this.Write("];\n\n write_"); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 43 "" this.Write(" = new "); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 43 "" this.Write("[size_"); #line default #line hidden #line 43 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 43 "" this.Write("];\n read_"); #line default #line hidden #line 44 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 44 "" this.Write(" = new "); #line default #line hidden #line 44 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 44 "" this.Write("[size_"); #line default #line hidden #line 44 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 44 "" this.Write("];\n\n std::memset(written_"); #line default #line hidden #line 46 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 46 "" this.Write(", 0, size_"); #line default #line hidden #line 46 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 46 "" this.Write(" * sizeof(bool));\n std::memset(staged_"); #line default #line hidden #line 47 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 47 "" this.Write(", 0, size_"); #line default #line hidden #line 47 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 47 "" this.Write(" * sizeof(bool));\n"); #line default #line hidden #line 48 "" if (signal.DefaultValue == null) { #line default #line hidden #line 49 "" this.Write(" std::memset(valid_"); #line default #line hidden #line 49 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 49 "" this.Write(", 0, size_"); #line default #line hidden #line 49 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 49 "" this.Write(" * sizeof(bool));\n"); #line default #line hidden #line 50 "" } else { #line default #line hidden #line 51 "" this.Write(" std::memset(valid_"); #line default #line hidden #line 51 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 51 "" this.Write(", 1, size_"); #line default #line hidden #line 51 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 51 "" this.Write(" * sizeof(bool));\n"); #line default #line hidden #line 52 "" if ((signal.DefaultValue is SME.AST.ArrayCreateExpression) || signal.DefaultValue is Array) { #line default #line hidden #line 53 "" this.Write(" "); #line default #line hidden #line 53 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 53 "" this.Write(" orig_"); #line default #line hidden #line 53 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 53 "" this.Write("[] = "); #line default #line hidden #line 53 "" this.Write(this.ToStringHelper.ToStringWithCulture(RS.Renderer.GetInitializer(signal))); #line default #line hidden #line 53 "" this.Write(";\n std::memcpy(read_"); #line default #line hidden #line 54 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 54 "" this.Write(", orig_"); #line default #line hidden #line 54 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 54 "" this.Write(", "); #line default #line hidden #line 54 "" this.Write(this.ToStringHelper.ToStringWithCulture(arraylen)); #line default #line hidden #line 54 "" this.Write(" * sizeof("); #line default #line hidden #line 54 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 54 "" this.Write("));\n std::memcpy(write_"); #line default #line hidden #line 55 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 55 "" this.Write(", orig_"); #line default #line hidden #line 55 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 55 "" this.Write(", "); #line default #line hidden #line 55 "" this.Write(this.ToStringHelper.ToStringWithCulture(arraylen)); #line default #line hidden #line 55 "" this.Write(" * sizeof("); #line default #line hidden #line 55 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 55 "" this.Write("));\n"); #line default #line hidden #line 56 "" } #line default #line hidden #line 57 "" } #line default #line hidden #line 58 "" } else { #line default #line hidden #line 59 "" this.Write(" written_"); #line default #line hidden #line 59 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 59 "" this.Write(" = false;\n"); #line default #line hidden #line 60 "" if (signal.DefaultValue == null) { #line default #line hidden #line 61 "" this.Write(" valid_"); #line default #line hidden #line 61 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 61 "" this.Write(" = false;\n"); #line default #line hidden #line 62 "" } #line default #line hidden #line 63 "" } #line default #line hidden #line 64 "" } #line default #line hidden #line 65 "" this.Write("\n"); #line default #line hidden #line 66 "" foreach (var signal in bus.Signals.Where(x => x.DefaultValue != null)) { var cpptype = RS.TypeScope.GetType(signal); var ini = RS.Renderer.GetInitializer(signal); if (!cpptype.IsArray) { #line default #line hidden #line 71 "" this.Write(" valid_"); #line default #line hidden #line 71 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 71 "" this.Write(" = true;\n"); #line default #line hidden #line 72 "" } #line default #line hidden #line 73 "" if (!string.IsNullOrWhiteSpace(ini)) { #line default #line hidden #line 74 "" this.Write(" read_"); #line default #line hidden #line 74 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 74 "" this.Write(" = write_"); #line default #line hidden #line 74 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 74 "" this.Write(" = "); #line default #line hidden #line 74 "" this.Write(this.ToStringHelper.ToStringWithCulture(RS.Renderer.GetInitializer(signal))); #line default #line hidden #line 74 "" this.Write(";\n"); #line default #line hidden #line 75 "" } #line default #line hidden #line 76 "" } #line default #line hidden #line 77 "" this.Write("}\n\n"); #line default #line hidden #line 79 "" foreach (var signal in bus.Signals) { var cpptype = RS.TypeScope.GetType(signal); if (cpptype.IsArray) { var eltype = cpptype.ElementName; #line default #line hidden #line 85 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 85 "" this.Write(" "); #line default #line hidden #line 85 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 85 "" this.Write("::"); #line default #line hidden #line 85 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 85 "" this.Write("(size_t index) const {\n if (index >= size_"); #line default #line hidden #line 86 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 86 "" this.Write(")\n throw IndexOutOfBoundsException(\"Invalid index: "); #line default #line hidden #line 87 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 87 "" this.Write("."); #line default #line hidden #line 87 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 87 "" this.Write("\");\n if (!valid_"); #line default #line hidden #line 88 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 88 "" this.Write("[index])\n throw InvalidReadException(\"Invalid read: "); #line default #line hidden #line 89 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 89 "" this.Write("."); #line default #line hidden #line 89 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 89 "" this.Write("\");\n\n return read_"); #line default #line hidden #line 91 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 91 "" this.Write("[index];\n}\n\n"); #line default #line hidden #line 94 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 94 "" this.Write(" "); #line default #line hidden #line 94 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 94 "" this.Write("::"); #line default #line hidden #line 94 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 94 "" this.Write("(size_t index, "); #line default #line hidden #line 94 "" this.Write(this.ToStringHelper.ToStringWithCulture(eltype)); #line default #line hidden #line 94 "" this.Write(" value) {\n if (index >= size_"); #line default #line hidden #line 95 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 95 "" this.Write(")\n throw IndexOutOfBoundsException(\"Invalid index: "); #line default #line hidden #line 96 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 96 "" this.Write("."); #line default #line hidden #line 96 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 96 "" this.Write("\");\n if (written_"); #line default #line hidden #line 97 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 97 "" this.Write("[index])\n throw InvalidDoubleWriteException(\"Invalid write: "); #line default #line hidden #line 98 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 98 "" this.Write("."); #line default #line hidden #line 98 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 98 "" this.Write("\");\n\n staged_"); #line default #line hidden #line 100 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 100 "" this.Write("[index] = true;\n return write_"); #line default #line hidden #line 101 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 101 "" this.Write("[index] = value;\n}\n"); #line default #line hidden #line 103 "" } else { #line default #line hidden #line 104 "" this.Write(this.ToStringHelper.ToStringWithCulture(Type(signal))); #line default #line hidden #line 104 "" this.Write(" "); #line default #line hidden #line 104 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 104 "" this.Write("::"); #line default #line hidden #line 104 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 104 "" this.Write("() const {\n if (!valid_"); #line default #line hidden #line 105 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 105 "" this.Write(")\n throw InvalidReadException(\"Invalid read: "); #line default #line hidden #line 106 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 106 "" this.Write("."); #line default #line hidden #line 106 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 106 "" this.Write("\");\n\n return read_"); #line default #line hidden #line 108 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 108 "" this.Write(";\n}\n\n"); #line default #line hidden #line 111 "" this.Write(this.ToStringHelper.ToStringWithCulture(Type(signal))); #line default #line hidden #line 111 "" this.Write(" "); #line default #line hidden #line 111 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 111 "" this.Write("::"); #line default #line hidden #line 111 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 111 "" this.Write("("); #line default #line hidden #line 111 "" this.Write(this.ToStringHelper.ToStringWithCulture(Type(signal))); #line default #line hidden #line 111 "" this.Write(" value) {\n if (written_"); #line default #line hidden #line 112 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 112 "" this.Write(")\n throw InvalidDoubleWriteException(\"Invalid write: "); #line default #line hidden #line 113 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 113 "" this.Write("."); #line default #line hidden #line 113 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 113 "" this.Write("\");\n\n staged_"); #line default #line hidden #line 115 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 115 "" this.Write(" = true;\n return write_"); #line default #line hidden #line 116 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 116 "" this.Write(" = value;\n}\n"); #line default #line hidden #line 118 "" } #line default #line hidden #line 119 "" } #line default #line hidden #line 120 "" this.Write("\nvoid "); #line default #line hidden #line 121 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 121 "" this.Write("::forward_signals() {\n size_t i;\n\n"); #line default #line hidden #line 124 "" foreach (var signal in bus.Signals) { var cpptype = RS.TypeScope.GetType(signal); if (cpptype.IsArray) { var eltype = cpptype.ElementName; #line default #line hidden #line 129 "" this.Write(" for(i = 0; i < size_"); #line default #line hidden #line 129 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 129 "" this.Write("; i++) {\n if (staged_"); #line default #line hidden #line 130 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 130 "" this.Write("[i]) {\n written_"); #line default #line hidden #line 131 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 131 "" this.Write("[i] = true;\n staged_"); #line default #line hidden #line 132 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 132 "" this.Write("[i] = false;\n valid_"); #line default #line hidden #line 133 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 133 "" this.Write("[i] = true;\n read_"); #line default #line hidden #line 134 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 134 "" this.Write("[i] = write_"); #line default #line hidden #line 134 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 134 "" this.Write("[i];\n }\n }\n"); #line default #line hidden #line 137 "" } else { #line default #line hidden #line 138 "" this.Write(" if (staged_"); #line default #line hidden #line 138 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 138 "" this.Write(") {\n written_"); #line default #line hidden #line 139 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 139 "" this.Write(" = true;\n staged_"); #line default #line hidden #line 140 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 140 "" this.Write(" = false;\n valid_"); #line default #line hidden #line 141 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 141 "" this.Write(" = true;\n read_"); #line default #line hidden #line 142 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 142 "" this.Write(" = write_"); #line default #line hidden #line 142 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 142 "" this.Write(";\n }\n"); #line default #line hidden #line 144 "" } #line default #line hidden #line 145 "" } #line default #line hidden #line 146 "" this.Write("}\n\nvoid "); #line default #line hidden #line 148 "" this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name)); #line default #line hidden #line 148 "" this.Write("::propagate_signals() {\n size_t i;\n\n"); #line default #line hidden #line 151 "" foreach (var signal in bus.Signals) { var cpptype = RS.TypeScope.GetType(signal); if (cpptype.IsArray) { var eltype = cpptype.ElementName; #line default #line hidden #line 155 "" this.Write(" for (i = 0; i < size_"); #line default #line hidden #line 155 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 155 "" this.Write("; i++) {\n if (written_"); #line default #line hidden #line 156 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 156 "" this.Write("[i]) {\n written_"); #line default #line hidden #line 157 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 157 "" this.Write("[i] = false;\n }\n }\n"); #line default #line hidden #line 160 "" } else { #line default #line hidden #line 161 "" this.Write(" if (written_"); #line default #line hidden #line 161 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 161 "" this.Write(") {\n written_"); #line default #line hidden #line 162 "" this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name)); #line default #line hidden #line 162 "" this.Write(" = false;\n }\n"); #line default #line hidden #line 164 "" } #line default #line hidden #line 165 "" } #line default #line hidden #line 166 "" this.Write("}\n\n"); #line default #line hidden #line 168 "" } #line default #line hidden #line 169 "" this.Write("\n// Insert additional code and classes here\n// #### USER-DATA-EXTRA-START\n// ####" + " USER-DATA-EXTRA-END\n"); #line default #line hidden return(this.GenerationEnvironment.ToString()); }