Exemple #1
0
        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 \"");

            #line default
            #line hidden

            #line 9 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network)));

            #line default
            #line hidden

            #line 9 ""
            this.Write(".hpp\"\n\n// Insert additional includes and methods here\n// #### USER-DATA-INCLUDE-START\n// #### USER-DATA-INCLUDE-END\n\nint main()\n{\n\n// Insert additional startup code here\n// #### USER-DATA-STARTUP-CODE-START\n// #### USER-DATA-STARTUP-CODE-END\n\n    try\n    {\n        ");

            #line default
            #line hidden

            #line 24 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 24 ""
            this.Write(" simulator;\n        size_t cycles = simulator.RunSimulation(\"");

            #line default
            #line hidden

            #line 25 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(RS.CSVTracename));

            #line default
            #line hidden

            #line 25 ""
            this.Write("\");\n        std::cout << \"Completed simulation in \" << cycles << \" cycles\" << std::endl;\n\n    } catch (SignalException s) {\n        std::cout << s.message << std::endl;\n        throw s;\n    }\n    return 0;\n}\n");

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }
Exemple #2
0
        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());
        }
Exemple #3
0
        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());
        }
Exemple #4
0
        public virtual string TransformText()
        {
            this.GenerationEnvironment = null;

            #line 6 ""
            this.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Project Version=\"7\" Minor=\"35\" Path=\"./");

            #line default
            #line hidden

            #line 7 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Network.Name));

            #line default
            #line hidden

            #line 7 ""
            this.Write(".xpr\">\n  <DefaultLaunch Dir=\"$PRUNDIR\"/>\n  <Configuration>\n    <Option Name=\"Id\" " +
                       "Val=\"da04b7443593460ab7943c9e399803cf\"/>\n    <Option Name=\"Part\" Val=\"xc7z020clg" +
                       "484-1\"/>\n    <Option Name=\"CompiledLibDir\" Val=\"$PCACHEDIR/compile_simlib\"/>\n   " +
                       " <Option Name=\"CompiledLibDirXSim\" Val=\"\"/>\n    <Option Name=\"CompiledLibDirMode" +
                       "lSim\" Val=\"$PCACHEDIR/compile_simlib/modelsim\"/>\n    <Option Name=\"CompiledLibDi" +
                       "rQuesta\" Val=\"$PCACHEDIR/compile_simlib/questa\"/>\n    <Option Name=\"CompiledLibD" +
                       "irIES\" Val=\"$PCACHEDIR/compile_simlib/ies\"/>\n    <Option Name=\"CompiledLibDirXce" +
                       "lium\" Val=\"$PCACHEDIR/compile_simlib/xcelium\"/>\n    <Option Name=\"CompiledLibDir" +
                       "VCS\" Val=\"$PCACHEDIR/compile_simlib/vcs\"/>\n    <Option Name=\"CompiledLibDirRivie" +
                       "ra\" Val=\"$PCACHEDIR/compile_simlib/riviera\"/>\n    <Option Name=\"CompiledLibDirAc" +
                       "tivehdl\" Val=\"$PCACHEDIR/compile_simlib/activehdl\"/>\n    <Option Name=\"TargetLan" +
                       "guage\" Val=\"VHDL\"/>\n    <Option Name=\"SimulatorLanguage\" Val=\"VHDL\"/>\n    <Optio" +
                       "n Name=\"BoardPart\" Val=\"em.avnet.com:zed:part0:1.3\"/>\n    <Option Name=\"ActiveSi" +
                       "mSet\" Val=\"sim_1\"/>\n    <Option Name=\"DefaultLib\" Val=\"xil_defaultlib\"/>\n    <Op" +
                       "tion Name=\"ProjectType\" Val=\"Default\"/>\n    <Option Name=\"IPOutputRepo\" Val=\"$PC" +
                       "ACHEDIR/ip\"/>\n    <Option Name=\"IPCachePermission\" Val=\"read\"/>\n    <Option Name" +
                       "=\"IPCachePermission\" Val=\"write\"/>\n    <Option Name=\"EnableCoreContainer\" Val=\"F" +
                       "ALSE\"/>\n    <Option Name=\"CreateRefXciForCoreContainers\" Val=\"FALSE\"/>\n    <Opti" +
                       "on Name=\"IPUserFilesDir\" Val=\"$PIPUSERFILESDIR\"/>\n    <Option Name=\"IPStaticSour" +
                       "ceDir\" Val=\"$PIPUSERFILESDIR/ipstatic\"/>\n    <Option Name=\"EnableBDX\" Val=\"FALSE" +
                       "\"/>\n    <Option Name=\"DSAVendor\" Val=\"xilinx\"/>\n    <Option Name=\"DSABoardId\" Va" +
                       "l=\"zed\"/>\n    <Option Name=\"DSANumComputeUnits\" Val=\"16\"/>\n    <Option Name=\"WTX" +
                       "SimLaunchSim\" Val=\"84\"/>\n    <Option Name=\"WTModelSimLaunchSim\" Val=\"0\"/>\n    <O" +
                       "ption Name=\"WTQuestaLaunchSim\" Val=\"0\"/>\n    <Option Name=\"WTIesLaunchSim\" Val=\"" +
                       "0\"/>\n    <Option Name=\"WTVcsLaunchSim\" Val=\"0\"/>\n    <Option Name=\"WTRivieraLaun" +
                       "chSim\" Val=\"0\"/>\n    <Option Name=\"WTActivehdlLaunchSim\" Val=\"0\"/>\n    <Option N" +
                       "ame=\"WTXSimExportSim\" Val=\"0\"/>\n    <Option Name=\"WTModelSimExportSim\" Val=\"0\"/>" +
                       "\n    <Option Name=\"WTQuestaExportSim\" Val=\"0\"/>\n    <Option Name=\"WTIesExportSim" +
                       "\" Val=\"0\"/>\n    <Option Name=\"WTVcsExportSim\" Val=\"0\"/>\n    <Option Name=\"WTRivi" +
                       "eraExportSim\" Val=\"0\"/>\n    <Option Name=\"WTActivehdlExportSim\" Val=\"0\"/>\n    <O" +
                       "ption Name=\"GenerateIPUpgradeLog\" Val=\"TRUE\"/>\n    <Option Name=\"XSimRadix\" Val=" +
                       "\"hex\"/>\n    <Option Name=\"XSimTimeUnit\" Val=\"ns\"/>\n    <Option Name=\"XSimArrayDi" +
                       "splayLimit\" Val=\"1024\"/>\n    <Option Name=\"XSimTraceLimit\" Val=\"65536\"/>\n    <Op" +
                       "tion Name=\"SimTypes\" Val=\"rtl\"/>\n  </Configuration>\n  <FileSets Version=\"1\" Mino" +
                       "r=\"31\">\n    <FileSet Name=\"sources_1\" Type=\"DesignSrcs\" RelSrcDir=\"$PSRCDIR/sour" +
                       "ces_1\">\n      <Filter Type=\"Srcs\"/>\n      <File Path=\"$PPRDIR/system_types.vhdl\"" +
                       ">\n        <FileInfo>\n          <Attr Name=\"Library\" Val=\"xil_defaultlib\"/>\n     " +
                       "     <Attr Name=\"IsGlobalInclude\" Val=\"1\"/>\n          <Attr Name=\"UsedIn\" Val=\"s" +
                       "ynthesis\"/>\n          <Attr Name=\"UsedIn\" Val=\"simulation\"/>\n        </FileInfo>" +
                       "\n      </File>\n      <File Path=\"$PPRDIR/Types_");

            #line default
            #line hidden

            #line 70 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Simulation)));

            #line default
            #line hidden

            #line 70 ""
            this.Write(@""">
        <FileInfo>
          <Attr Name=""Library"" Val=""xil_defaultlib""/>
          <Attr Name=""IsGlobalInclude"" Val=""1""/>
          <Attr Name=""UsedIn"" Val=""synthesis""/>
          <Attr Name=""UsedIn"" Val=""simulation""/>
        </FileInfo>
      </File>
");

            #line default
            #line hidden

            #line 78 ""
            foreach (var p in Processes)
            {
            #line default
            #line hidden

            #line 79 ""
                this.Write("      <File Path=\"$PPRDIR/");

            #line default
            #line hidden

            #line 79 ""
                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToFileName(p.SourceInstance.Instance)));

            #line default
            #line hidden

            #line 79 ""
                this.Write("\">\n        <FileInfo>\n          <Attr Name=\"Library\" Val=\"xil_defaultlib\"/>\n     " +
                           "     <Attr Name=\"UsedIn\" Val=\"synthesis\"/>\n          <Attr Name=\"UsedIn\" Val=\"si" +
                           "mulation\"/>\n        </FileInfo>\n      </File>\n");

            #line default
            #line hidden

            #line 86 ""
            }

            #line default
            #line hidden

            #line 87 ""
            this.Write("      <File Path=\"$PPRDIR/");

            #line default
            #line hidden

            #line 87 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Simulation)));

            #line default
            #line hidden

            #line 87 ""
            this.Write(@""">
        <FileInfo>
          <Attr Name=""Library"" Val=""xil_defaultlib""/>
          <Attr Name=""UsedIn"" Val=""synthesis""/>
          <Attr Name=""UsedIn"" Val=""simulation""/>
        </FileInfo>
      </File>
      <Config>
        <Option Name=""DesignMode"" Val=""RTL""/>
        <Option Name=""TopModule"" Val=""");

            #line default
            #line hidden

            #line 96 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Network.Name));

            #line default
            #line hidden

            #line 96 ""
            this.Write(@"""/>
        <Option Name=""TopAutoSet"" Val=""TRUE""/>
      </Config>
    </FileSet>
    <FileSet Name=""constrs_1"" Type=""Constrs"" RelSrcDir=""$PSRCDIR/constrs_1"">
      <Filter Type=""Constrs""/>
      <Config>
        <Option Name=""ConstrsType"" Val=""XDC""/>
      </Config>
    </FileSet>
    <FileSet Name=""sim_1"" Type=""SimulationSrcs"" RelSrcDir=""$PSRCDIR/sim_1"">
      <Filter Type=""Srcs""/>
      <File Path=""$PPRDIR/csv_util.vhdl"">
        <FileInfo>
          <Attr Name=""Library"" Val=""xil_defaultlib""/>
          <Attr Name=""UsedIn"" Val=""synthesis""/>
          <Attr Name=""UsedIn"" Val=""simulation""/>
        </FileInfo>
      </File>
      <File Path=""$PPRDIR/TestBench_");

            #line default
            #line hidden

            #line 115 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Simulation)));

            #line default
            #line hidden

            #line 115 ""
            this.Write("\">\n        <FileInfo>\n          <Attr Name=\"Library\" Val=\"xil_defaultlib\"/>\n     " +
                       "     <Attr Name=\"UsedIn\" Val=\"synthesis\"/>\n          <Attr Name=\"UsedIn\" Val=\"si" +
                       "mulation\"/>\n        </FileInfo>\n      </File>\n      <File Path=\"$PPRDIR/");

            #line default
            #line hidden

            #line 122 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(RS.CSVTracename));

            #line default
            #line hidden

            #line 122 ""
            this.Write("\">\n          <Attr Name=\"UsedIn\" Val=\"simulation\"/>\n      </File>\n      <Config>\n" +
                       "        <Option Name=\"DesignMode\" Val=\"RTL\"/>\n        <Option Name=\"TopModule\" V" +
                       "al=\"");

            #line default
            #line hidden

            #line 127 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Network.Name));

            #line default
            #line hidden

            #line 127 ""
            this.Write(@"_tb""/>
        <Option Name=""TopLib"" Val=""xil_defaultlib""/>
        <Option Name=""TransportPathDelay"" Val=""0""/>
        <Option Name=""TransportIntDelay"" Val=""0""/>
        <Option Name=""SrcSet"" Val=""sources_1""/>
        <Option Name=""xsim.simulate.runtime"" Val=""");

            #line default
            #line hidden

            #line 132 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Runtime));

            #line default
            #line hidden

            #line 132 ""
            this.Write("\"/>\n      </Config>\n    </FileSet>\n  </FileSets>\n  <Simulators>\n    <Simulator Na" +
                       "me=\"XSim\">\n      <Option Name=\"Description\" Val=\"Vivado Simulator\"/>\n      <Opti" +
                       "on Name=\"CompiledLib\" Val=\"0\"/>\n    </Simulator>\n    <Simulator Name=\"ModelSim\">" +
                       "\n      <Option Name=\"Description\" Val=\"ModelSim Simulator\"/>\n    </Simulator>\n  " +
                       "  <Simulator Name=\"Questa\">\n      <Option Name=\"Description\" Val=\"Questa Advance" +
                       "d Simulator\"/>\n    </Simulator>\n    <Simulator Name=\"Riviera\">\n      <Option Nam" +
                       "e=\"Description\" Val=\"Riviera-PRO Simulator\"/>\n    </Simulator>\n    <Simulator Na" +
                       "me=\"ActiveHDL\">\n      <Option Name=\"Description\" Val=\"Active-HDL Simulator\"/>\n  " +
                       "  </Simulator>\n  </Simulators>\n  <Runs Version=\"1\" Minor=\"10\">\n    <Run Id=\"synt" +
                       "h_1\" Type=\"Ft3:Synth\" SrcSet=\"sources_1\" Part=\"xc7z020clg484-1\" ConstrsSet=\"cons" +
                       "trs_1\" Description=\"Vivado Synthesis Defaults\" WriteIncrSynthDcp=\"false\" State=\"" +
                       "current\" IncludeInArchive=\"true\">\n      <Strategy Version=\"1\" Minor=\"2\">\n       " +
                       " <StratHandle Name=\"Vivado Synthesis Defaults\" Flow=\"Vivado Synthesis 2017\"/>\n  " +
                       "      <Step Id=\"synth_design\"/>\n      </Strategy>\n      <ReportStrategy Name=\"Vi" +
                       "vado Synthesis Default Reports\" Flow=\"Vivado Synthesis 2017\"/>\n      <Report Nam" +
                       "e=\"ROUTE_DESIGN.REPORT_METHODOLOGY\" Enabled=\"1\"/>\n    </Run>\n    <Run Id=\"impl_1" +
                       "\" Type=\"Ft2:EntireDesign\" Part=\"xc7z020clg484-1\" ConstrsSet=\"constrs_1\" Descript" +
                       "ion=\"Default settings for Implementation.\" WriteIncrSynthDcp=\"false\" State=\"curr" +
                       "ent\" SynthRun=\"synth_1\" IncludeInArchive=\"true\">\n      <Strategy Version=\"1\" Min" +
                       "or=\"2\">\n        <StratHandle Name=\"Vivado Implementation Defaults\" Flow=\"Vivado " +
                       "Implementation 2017\"/>\n        <Step Id=\"init_design\"/>\n        <Step Id=\"opt_de" +
                       "sign\"/>\n        <Step Id=\"power_opt_design\"/>\n        <Step Id=\"place_design\"/>\n" +
                       "        <Step Id=\"post_place_power_opt_design\"/>\n        <Step Id=\"phys_opt_desi" +
                       "gn\"/>\n        <Step Id=\"route_design\"/>\n        <Step Id=\"post_route_phys_opt_de" +
                       "sign\"/>\n        <Step Id=\"write_bitstream\"/>\n      </Strategy>\n      <ReportStra" +
                       "tegy Name=\"Vivado Implementation Default Reports\" Flow=\"Vivado Implementation 20" +
                       "17\"/>\n      <Report Name=\"ROUTE_DESIGN.REPORT_METHODOLOGY\" Enabled=\"1\"/>\n    </R" +
                       "un>\n  </Runs>\n  <Board>\n    <Jumpers/>\n  </Board>\n</Project>");

            #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 \"");

            #line default
            #line hidden

            #line 6 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.SimulatorFileName(Network)));

            #line default
            #line hidden

            #line 6 ""
            this.Write(".hpp\"\n\n// The names of all signals\nstd::string ");

            #line default
            #line hidden

            #line 9 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 9 ""
            this.Write("_SIGNAL_NAMES[] = {\n");

            #line default
            #line hidden

            #line 10 ""
            foreach (var signal in RS.DriverSignals.Concat(RS.VerifySignals))
            {
                var cpptype = RS.TypeScope.GetType(signal);
                if (cpptype.IsArray)
                {
                    var eltype = cpptype.ElementName;
                    var length = (int)RS.GetArrayLength(signal).DefaultValue;
                    for (var i = 0; i < length; i++)
                    {
            #line default
            #line hidden

            #line 17 ""
                        this.Write("    \"");

            #line default
            #line hidden

            #line 17 ""
                        this.Write(this.ToStringHelper.ToStringWithCulture(RS.TestBenchSignalName(signal)));

            #line default
            #line hidden

            #line 17 ""
                        this.Write("(");

            #line default
            #line hidden

            #line 17 ""
                        this.Write(this.ToStringHelper.ToStringWithCulture(i));

            #line default
            #line hidden

            #line 17 ""
                        this.Write(")\",\n");

            #line default
            #line hidden

            #line 18 ""
                    }

            #line default
            #line hidden

            #line 19 ""
                }
                else
                {
            #line default
            #line hidden

            #line 20 ""
                    this.Write("    \"");

            #line default
            #line hidden

            #line 20 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(RS.TestBenchSignalName(signal)));

            #line default
            #line hidden

            #line 20 ""
                    this.Write("\",\n");

            #line default
            #line hidden

            #line 21 ""
                }

            #line default
            #line hidden

            #line 22 ""
            }

            #line default
            #line hidden

            #line 23 ""
            this.Write("};\n\n");

            #line default
            #line hidden

            #line 25 ""
            foreach (var process in Network.Processes)
            {
                var members = process
                              .SharedVariables.Cast <AST.DataElement>()
                              .Union(process.SharedSignals)
                              //.Where(x => RS.TypeScope.GetType(x).IsArray)
                              .Where(x => (x.DefaultValue is SME.AST.ArrayCreateExpression) || (x.DefaultValue is Array));
                foreach (var v in members)
                {
                    var rt       = RS.TypeScope.GetType(v);
                    var eltype   = rt.ElementName;
                    var arraylen = RS.GetArrayLength(v).DefaultValue;


            #line default
            #line hidden

            #line 36 ""
                    this.Write("const ");

            #line default
            #line hidden

            #line 36 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(eltype));

            #line default
            #line hidden

            #line 36 ""
                    this.Write(" init_");

            #line default
            #line hidden

            #line 36 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToValidName(process)));

            #line default
            #line hidden

            #line 36 ""
                    this.Write("_");

            #line default
            #line hidden

            #line 36 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ToValidName(v.Name)));

            #line default
            #line hidden

            #line 36 ""
                    this.Write("[");

            #line default
            #line hidden

            #line 36 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(arraylen));

            #line default
            #line hidden

            #line 36 ""
                    this.Write("] = ");

            #line default
            #line hidden

            #line 36 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(RS.Renderer.GetInitializer(v)));

            #line default
            #line hidden

            #line 36 ""
                    this.Write(";\n");

            #line default
            #line hidden

            #line 37 ""
                }

            #line default
            #line hidden

            #line 38 ""
            }

            #line default
            #line hidden

            #line 39 ""
            this.Write("\n\n");

            #line default
            #line hidden

            #line 41 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 41 ""
            this.Write("::");

            #line default
            #line hidden

            #line 41 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 41 ""
            this.Write("() \n    :\n");

            #line default
            #line hidden

            #line 43 ""
            foreach (var bus in Network.Busses)
            {
            #line default
            #line hidden

            #line 44 ""
                this.Write("        bus_");

            #line default
            #line hidden

            #line 44 ""
                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(bus)));

            #line default
            #line hidden

            #line 44 ""
                this.Write("(),\n");

            #line default
            #line hidden

            #line 45 ""
            }

            #line default
            #line hidden

            #line 46 ""
            foreach (var process in Network.Processes)
            {
                var busses  = process.InputBusses.Concat(process.OutputBusses).Concat(process.InternalBusses).Distinct().OrderBy(x => x.Name).ToArray();
                var members = process.SharedVariables.Cast <AST.DataElement>().Union(process.SharedSignals).ToArray();


            #line default
            #line hidden

            #line 51 ""
                this.Write("        proc_");

            #line default
            #line hidden

            #line 51 ""
                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToValidName(process)));

            #line default
            #line hidden

            #line 51 ""
                this.Write("(\n");

            #line default
            #line hidden

            #line 52 ""
                foreach (var bus in busses)
                {
            #line default
            #line hidden

            #line 53 ""
                    this.Write("            &bus_");

            #line default
            #line hidden

            #line 53 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(bus)));

            #line default
            #line hidden

            #line 53 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture((bus == busses.Last() & members.Length == 0) ? "" : ", "));

            #line default
            #line hidden

            #line 53 ""
                    this.Write("\n");

            #line default
            #line hidden

            #line 54 ""
                }

            #line default
            #line hidden

            #line 55 ""
                foreach (var v in members)
                {
                    var initializer = RS.Renderer.GetInitializer(v);
                    if (!string.IsNullOrWhiteSpace(initializer))
                    {
                        var rt = RS.TypeScope.GetType(v);
                        if (rt.IsArray)
                        {
                            var eltype   = rt.ElementName;
                            var arraylen = RS.GetArrayLength(v).DefaultValue;



            #line default
            #line hidden

            #line 64 ""
                            this.Write("            ");

            #line default
            #line hidden

            #line 64 ""
                            this.Write(this.ToStringHelper.ToStringWithCulture(arraylen));

            #line default
            #line hidden

            #line 64 ""
                            this.Write(",\n");

            #line default
            #line hidden

            #line 65 ""


                            if ((v.DefaultValue is SME.AST.ArrayCreateExpression) || v.DefaultValue is Array)
                            {
            #line default
            #line hidden

            #line 68 ""
                                this.Write("            init_");

            #line default
            #line hidden

            #line 68 ""
                                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToValidName(process)));

            #line default
            #line hidden

            #line 68 ""
                                this.Write("_");

            #line default
            #line hidden

            #line 68 ""
                                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ToValidName(v.Name)));

            #line default
            #line hidden

            #line 68 ""
                                this.Write(this.ToStringHelper.ToStringWithCulture(v == members.Last() ? "" : ","));

            #line default
            #line hidden

            #line 68 ""
                                this.Write("\n");

            #line default
            #line hidden

            #line 69 ""
                            }
                            else
                            {
            #line default
            #line hidden

            #line 70 ""
                                this.Write("            new ");

            #line default
            #line hidden

            #line 70 ""
                                this.Write(this.ToStringHelper.ToStringWithCulture(eltype));

            #line default
            #line hidden

            #line 70 ""
                                this.Write("[");

            #line default
            #line hidden

            #line 70 ""
                                this.Write(this.ToStringHelper.ToStringWithCulture(arraylen));

            #line default
            #line hidden

            #line 70 ""
                                this.Write("]()");

            #line default
            #line hidden

            #line 70 ""
                                this.Write(this.ToStringHelper.ToStringWithCulture(v == members.Last() ? "" : ","));

            #line default
            #line hidden

            #line 70 ""
                                this.Write("\n");

            #line default
            #line hidden

            #line 71 ""
                            }

            #line default
            #line hidden

            #line 72 ""
                        }
                        else
                        {
            #line default
            #line hidden

            #line 73 ""
                            this.Write("            ");

            #line default
            #line hidden

            #line 73 ""
                            this.Write(this.ToStringHelper.ToStringWithCulture(initializer));

            #line default
            #line hidden

            #line 73 ""
                            this.Write(this.ToStringHelper.ToStringWithCulture(v == members.Last() ? "" : ","));

            #line default
            #line hidden

            #line 73 ""
                            this.Write("\n");

            #line default
            #line hidden

            #line 74 ""
                        }

            #line default
            #line hidden

            #line 75 ""
                    }

            #line default
            #line hidden

            #line 76 ""
                }

            #line default
            #line hidden

            #line 77 ""
                this.Write("        ),\n");

            #line default
            #line hidden

            #line 78 ""
            }

            #line default
            #line hidden

            #line 79 ""
            this.Write("        trace_input(NULL),\n        input_line(),\n        cycle(0)\n{\n\n}\n\nsize_t ");

            #line default
            #line hidden

            #line 86 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 86 ""
            this.Write(@"::RunSimulation(const char* inputfile)
{
    LoadTraceInput(inputfile);

    // Ignore the reset cycle
    DriveFromTraceInput();

    while(true) {
        if (!DriveFromTraceInput()) {
            size_t res = cycle;
            Stop();
            return res;
        }
        OnTick();
        VerifyTrace();
        FinishCycle();
    }
}

void ");

            #line default
            #line hidden

            #line 105 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 105 ""
            this.Write(@"::LoadTraceInput(const char* inputfile)
{
    if (trace_input != NULL)
       throw MessageException(""Already have an input trace file open"");

    // Open the trace file and validate the headers
    trace_input = new std::ifstream(inputfile);
    if (trace_input->bad()) {
        trace_input->close();
        throw MessageException(""Trace input file not found, or not able to open"");
    }

    if (!std::getline(*trace_input, input_line)) {
        throw MessageException(""Trace input file was empty"");
    }

    if (cycle != 0) {
        throw MessageException(""Cannot load input file after the simulation has started"");
    }

    std::string token;
    std::istringstream headerlinestream(input_line);
    size_t field = 0;
    while(std::getline(headerlinestream, token, ',')) {
        if (token.compare(");

            #line default
            #line hidden

            #line 129 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 129 ""
            this.Write("_SIGNAL_NAMES[field]) != 0) {\n\n            std::stringstream sstm;\n            ss" +
                       "tm << \"Field #\" << field << \" should be named \" << ");

            #line default
            #line hidden

            #line 132 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 132 ""
            this.Write("_SIGNAL_NAMES[field] << \" but is named \" << token << \", the trace file cannot be " +
                       "used\";\n            throw MessageException(sstm.str());\n        }\n        field++" +
                       ";\n    }\n\n    cycle = 0;\n}\n\n");

            #line default
            #line hidden

            #line 141 ""
            var driver_signal_count = 0;

            #line default
            #line hidden

            #line 142 ""
            this.Write("\nbool ");

            #line default
            #line hidden

            #line 143 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 143 ""
            this.Write(@"::DriveFromTraceInput()
{
    if (trace_input == NULL) {
        throw MessageException(""Trace input file is not loaded"");
    }

    if (!std::getline(*trace_input, input_line)) {
        return false;
    }

    size_t i;
    std::string token;
    std::istringstream valuestream(input_line);
    size_t field = 0;

");

            #line default
            #line hidden

            #line 158 ""
            foreach (var signal in RS.DriverSignals)
            {
                var cpptype = RS.TypeScope.GetType(signal);
                if (cpptype.IsArray)
                {
                    var eltype = cpptype.ElementName;
                    var length = (int)RS.GetArrayLength(signal).DefaultValue;
                    driver_signal_count += length;


            #line default
            #line hidden

            #line 165 ""
                    this.Write("    for (i = 0; i < ");

            #line default
            #line hidden

            #line 165 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(length));

            #line default
            #line hidden

            #line 165 ""
                    this.Write("; i++) {\n        if (!std::getline(valuestream, token, \',\')) {\n            std::s" +
                               "tringstream sstm;\n            sstm << \"Unexpected end-of-line in cycle \" << cycl" +
                               "e << \", field \" << field << \", ");

            #line default
            #line hidden

            #line 168 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 168 ""
                    this.Write("[\" << i << \"]\" << std::endl;\n            throw MessageException(sstm.str());\n    " +
                               "    }\n        if (token.compare(\"U\") != 0)\n            bus_");

            #line default
            #line hidden

            #line 172 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 172 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 172 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 172 ""
                    this.Write("(i, parse_");

            #line default
            #line hidden

            #line 172 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(eltype));

            #line default
            #line hidden

            #line 172 ""
                    this.Write("(token));            \n        field++;\n    }\n");

            #line default
            #line hidden

            #line 175 ""
                }
                else
                {
                    driver_signal_count++;


            #line default
            #line hidden

            #line 179 ""
                    this.Write("    if (!std::getline(valuestream, token, \',\')) {\n        std::stringstream sstm;" +
                               "\n        sstm << \"Unexpected end-of-line in cycle \" << cycle << \", field \" << fi" +
                               "eld << \", ");

            #line default
            #line hidden

            #line 181 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 181 ""
                    this.Write("[\" << i << \"]\" << std::endl;\n        throw MessageException(sstm.str());\n    }\n  " +
                               "  if (token.compare(\"U\") != 0)\n        bus_");

            #line default
            #line hidden

            #line 185 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 185 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 185 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 185 ""
                    this.Write("(parse_");

            #line default
            #line hidden

            #line 185 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(RS.TypeScope.GetType(signal).Name));

            #line default
            #line hidden

            #line 185 ""
                    this.Write("(token));\n    field++;\n");

            #line default
            #line hidden

            #line 187 ""
                }

            #line default
            #line hidden

            #line 188 ""
                this.Write("\n");

            #line default
            #line hidden

            #line 189 ""
            }

            #line default
            #line hidden

            #line 190 ""
            this.Write("\n    return true;\n}\n\nvoid ");

            #line default
            #line hidden

            #line 194 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 194 ""
            this.Write("::FinishCycle() \n{\n    cycle++;\n");

            #line default
            #line hidden

            #line 197 ""
            if (Network.Busses.Any(x => x.IsClocked))
            {
            #line default
            #line hidden

            #line 198 ""
                this.Write("        // Propagate clocked busses\n");

            #line default
            #line hidden

            #line 199 ""
                foreach (var bus in Network.Busses.Where(x => x.IsClocked))
                {
            #line default
            #line hidden

            #line 200 ""
                    this.Write("        bus_");

            #line default
            #line hidden

            #line 200 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(bus.Name));

            #line default
            #line hidden

            #line 200 ""
                    this.Write(".Propagate();\n");

            #line default
            #line hidden

            #line 201 ""
                }

            #line default
            #line hidden

            #line 202 ""
            }

            #line default
            #line hidden

            #line 203 ""
            this.Write("}\n\nvoid ");

            #line default
            #line hidden

            #line 205 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 205 ""
            this.Write("::OnTick()\n{\n\n");

            #line default
            #line hidden

            #line 208 ""
            foreach (var p in Network.Processes.Where(x => x.IsClocked).Distinct())
            {
            #line default
            #line hidden

            #line 209 ""
                this.Write("    proc_");

            #line default
            #line hidden

            #line 209 ""
                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToValidName(p)));

            #line default
            #line hidden

            #line 209 ""
                this.Write(".onTick();\n");

            #line default
            #line hidden

            #line 210 ""
            }

            #line default
            #line hidden

            #line 211 ""
            foreach (var b in Network.Busses.Where(x => x.IsClocked).Distinct())
            {
            #line default
            #line hidden

            #line 212 ""
                this.Write("    bus_");

            #line default
            #line hidden

            #line 212 ""
                this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(b)));

            #line default
            #line hidden

            #line 212 ""
                this.Write(".propagate_signals();\n");

            #line default
            #line hidden

            #line 213 ""
            }

            #line default
            #line hidden

            #line 214 ""
            this.Write("\n\n");

            #line default
            #line hidden

            #line 216 ""
            foreach (var n in Graph.ExecutionPlan)
            {
                var pn = GetProcess(n.Item);
                if (pn != null && !pn.IsClocked)
                {
            #line default
            #line hidden

            #line 220 ""
                    this.Write("    proc_");

            #line default
            #line hidden

            #line 220 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.ProcessNameToValidName(pn)));

            #line default
            #line hidden

            #line 220 ""
                    this.Write(".onTick();\n");

            #line default
            #line hidden

            #line 221 ""
                }

            #line default
            #line hidden

            #line 222 ""
                foreach (var b in n.Item.OutputBusses.Distinct())
                {
            #line default
            #line hidden

            #line 223 ""
                    this.Write("    bus_");

            #line default
            #line hidden

            #line 223 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(GetBus(b))));

            #line default
            #line hidden

            #line 223 ""
                    this.Write(".forward_signals();\n");

            #line default
            #line hidden

            #line 224 ""
                }

            #line default
            #line hidden

            #line 225 ""
                foreach (var b in n.PropagateAfter)
                {
            #line default
            #line hidden

            #line 226 ""
                    this.Write("    bus_");

            #line default
            #line hidden

            #line 226 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(GetBus(b))));

            #line default
            #line hidden

            #line 226 ""
                    this.Write(".propagate_signals();\n");

            #line default
            #line hidden

            #line 227 ""
                }

            #line default
            #line hidden

            #line 228 ""
                foreach (var b in n.Item.InternalBusses)
                {
            #line default
            #line hidden

            #line 229 ""
                    this.Write("    bus_");

            #line default
            #line hidden

            #line 229 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(GetBus(b))));

            #line default
            #line hidden

            #line 229 ""
                    this.Write(".forward_signals();\n    bus_");

            #line default
            #line hidden

            #line 230 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(GetBus(b))));

            #line default
            #line hidden

            #line 230 ""
                    this.Write(".propagate_signals();\n");

            #line default
            #line hidden

            #line 231 ""
                }

            #line default
            #line hidden

            #line 232 ""
            }

            #line default
            #line hidden

            #line 233 ""
            this.Write("}\n\nvoid ");

            #line default
            #line hidden

            #line 235 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 235 ""
            this.Write("::VerifyTrace()\n{\n    if (trace_input == NULL) {\n        throw MessageException(\"" +
                       "Trace input file is not loaded\");\n    }\n\n    size_t i;\n    size_t field = 0;\n   " +
                       " std::string token;\n    std::istringstream valuestream(input_line);\n\n    // Forw" +
                       "ard past the ");

            #line default
            #line hidden

            #line 246 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(driver_signal_count));

            #line default
            #line hidden

            #line 246 ""
            this.Write(" signals\n    for(i = 0; i < ");

            #line default
            #line hidden

            #line 247 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(driver_signal_count));

            #line default
            #line hidden

            #line 247 ""
            this.Write("; i++) {\n        if (!std::getline(valuestream, token, \',\')) {\n            throw " +
                       "MessageException(\"Unexpected end-of-stream\");\n        }\n        field++;\n    }\n\n" +
                       "    bool source_is_undef;\n\n");

            #line default
            #line hidden

            #line 256 ""
            foreach (var signal in RS.VerifySignals)
            {
                var cpptype  = RS.TypeScope.GetType(signal);
                var typecast = cpptype.Name == "system_uint8" ? "(int)" : "";
                if (cpptype.IsArray)
                {
                    typecast = cpptype.ElementName == "system_uint8" ? "(int)" : "";
                    var eltype = cpptype.ElementName;
                    var length = (int)RS.GetArrayLength(signal).DefaultValue;


            #line default
            #line hidden

            #line 264 ""
                    this.Write("    for (i = 0; i < ");

            #line default
            #line hidden

            #line 264 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(length));

            #line default
            #line hidden

            #line 264 ""
                    this.Write(@"; i++) {
        if (!std::getline(valuestream, token, ',')) {
            std::stringstream sstm;
            sstm << ""Unexpected end-of-line in cycle "" << cycle << "", field "" << field << std::endl;
            throw MessageException(sstm.str());
        }

        source_is_undef = false;
        try {
            ");

            #line default
            #line hidden

            #line 273 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(eltype));

            #line default
            #line hidden

            #line 273 ""
                    this.Write(" tmpval = bus_");

            #line default
            #line hidden

            #line 273 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 273 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 273 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 273 ""
                    this.Write("(i);\n        } catch (InvalidReadException e) {\n            source_is_undef = tru" +
                               "e;\n        }\n\n        if (token.compare(\"U\") == 0 && source_is_undef) {\n        " +
                               " // Don\'t care\n        } else if (token.compare(\"U\") != 0 && bus_");

            #line default
            #line hidden

            #line 280 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 280 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 280 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 280 ""
                    this.Write("(i) != parse_");

            #line default
            #line hidden

            #line 280 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(eltype));

            #line default
            #line hidden

            #line 280 ""
                    this.Write("(token)) {\n            std::stringstream sstm;\n            sstm << \"Error in cycl" +
                               "e \" << cycle << std::endl;\n            sstm << \"Expected value \" << ");

            #line default
            #line hidden

            #line 283 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(typecast));

            #line default
            #line hidden

            #line 283 ""
                    this.Write("parse_");

            #line default
            #line hidden

            #line 283 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(eltype));

            #line default
            #line hidden

            #line 283 ""
                    this.Write("(token) << \", but got \" << ");

            #line default
            #line hidden

            #line 283 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(typecast));

            #line default
            #line hidden

            #line 283 ""
                    this.Write("bus_");

            #line default
            #line hidden

            #line 283 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 283 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 283 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 283 ""
                    this.Write("(i) << \" for field \" << ");

            #line default
            #line hidden

            #line 283 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 283 ""
                    this.Write("_SIGNAL_NAMES[field] << \" (raw: \" << token << \")\" << std::endl;\n            throw" +
                               " MessageException(sstm.str());\n        }\n        field++;\n    }\n\n");

            #line default
            #line hidden

            #line 289 ""
                }
                else
                {
            #line default
            #line hidden

            #line 290 ""
                    this.Write(@"    if (!std::getline(valuestream, token, ',')) {
        std::stringstream sstm;
        sstm << ""Unexpected end-of-line in cycle "" << cycle << "", field "" << field << std::endl;
        throw MessageException(sstm.str());
    }

    source_is_undef = false;
    try {
        ");

            #line default
            #line hidden

            #line 298 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(RS.TypeScope.GetType(signal).Name));

            #line default
            #line hidden

            #line 298 ""
                    this.Write(" tmpval = bus_");

            #line default
            #line hidden

            #line 298 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 298 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 298 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 298 ""
                    this.Write("();\n    } catch (InvalidReadException e) {\n        source_is_undef = true;\n    }\n" +
                               "\n    if (token.compare(\"U\") == 0 && source_is_undef) {\n        // Don\'t care\n   " +
                               " } else if (token.compare(\"U\") != 0 && bus_");

            #line default
            #line hidden

            #line 305 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 305 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 305 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 305 ""
                    this.Write("() != parse_");

            #line default
            #line hidden

            #line 305 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(RS.TypeScope.GetType(signal).Name));

            #line default
            #line hidden

            #line 305 ""
                    this.Write("(token)) {\n        std::stringstream sstm;\n        sstm << \"Error in cycle \" << c" +
                               "ycle << std::endl;\n        sstm << \"Expected value \" << ");

            #line default
            #line hidden

            #line 308 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(typecast));

            #line default
            #line hidden

            #line 308 ""
                    this.Write("parse_");

            #line default
            #line hidden

            #line 308 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(RS.TypeScope.GetType(signal).Name));

            #line default
            #line hidden

            #line 308 ""
                    this.Write("(token) << \", but got \" << ");

            #line default
            #line hidden

            #line 308 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(typecast));

            #line default
            #line hidden

            #line 308 ""
                    this.Write("bus_");

            #line default
            #line hidden

            #line 308 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.BusNameToValidName(signal.Parent as AST.Bus)));

            #line default
            #line hidden

            #line 308 ""
                    this.Write(".");

            #line default
            #line hidden

            #line 308 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(signal.Name));

            #line default
            #line hidden

            #line 308 ""
                    this.Write("() << \" for field \" << ");

            #line default
            #line hidden

            #line 308 ""
                    this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 308 ""
                    this.Write("_SIGNAL_NAMES[field] << \" (raw: \" << token << \")\" << std::endl;\n        throw Mes" +
                               "sageException(sstm.str());\n    }\n    field++;\n");

            #line default
            #line hidden

            #line 312 ""
                }

            #line default
            #line hidden

            #line 313 ""
            }

            #line default
            #line hidden

            #line 314 ""
            this.Write("}\n\nvoid ");

            #line default
            #line hidden

            #line 316 ""
            this.Write(this.ToStringHelper.ToStringWithCulture(Naming.AssemblyNameToFileName(Network)));

            #line default
            #line hidden

            #line 316 ""
            this.Write("::Stop()\n{\n    if (trace_input != NULL) {\n        trace_input->close();\n        d" +
                       "elete trace_input;\n    }\n}\n");

            #line default
            #line hidden
            return(this.GenerationEnvironment.ToString());
        }