public static void resetSimulation(GeminiSimForm form) { if (null != memory && null != cpu) { Logger.initialize(fileName); //Start logger back up Logger.writeLine("Starting simulation with cache type " + Settings.cacheOptions[Convert.ToInt32(Settings.getValue("cachetype"))] + " and cache size " + Settings.getValue("cachesize")); memory = new Memory(Settings.getValue("cachetype"), Convert.ToInt32(Settings.getValue("cachesize")), memory.getInstructions()); cpu = new CPU(memory); Simulator.form = form; form.updateViewElements(nextInstructionPreview(), cpu, memory); } }
/* * Start a new cpuulation */ public static void startSimulation(String fileName, GeminiSimForm form) { if (IsValidFile(fileName)) { Simulator.form = form; Logger.initialize(fileName); //Start logger Logger.writeLine("Starting simulation with cache type " + Settings.cacheOptions[Convert.ToInt32(Settings.getValue("cachetype"))] + " and cache size " + Settings.getValue("cachesize")); Simulator.fileName = fileName; memory = new Memory(Settings.getValue("cachetype"), Convert.ToInt32(Settings.getValue("cachesize")), readAllLines(fileName)); cpu = new CPU(memory); form.updateViewElements(nextInstructionPreview(), cpu, memory); } else { MessageBox.Show("Assembly file should have extension " + OUTPUT_FILE_TYPE, "File Error"); } }