private void button7_Click(object sender, EventArgs e) { string filePath; string directory; string fileName; ProgramLoader pl = new ProgramLoader(); openFileDialog1.Filter = "Simple Machine Files (*.ASM)|*.ASM"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { filePath = openFileDialog1.FileName; directory = Path.GetDirectoryName(filePath); fileName = Path.GetFileNameWithoutExtension(filePath); if (File.Exists(directory + "\\" + fileName + ".obj")) { richTextBox1.Text = File.ReadAllText(filePath); pl.LoadFromFile(directory + "\\" + fileName + ".obj", machine); } else { using (Prompt dlg = new Prompt($"File Missing! \n{fileName}.obj\n Assemble the .ASM file to produce!", "Okay!")) { if (dlg.ShowDialog() == DialogResult.OK) { } } } } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); this._appSettings = new AppSettings(); this._debugLogger = new DebugManager(); this._debugLogger.Enable(); this._simLogger = new iRacingLogger(4); this._simLogger.DriverConnected += this.OnRaceLoggerConnection; this._simLogger.DriverDisconnected += this.OnRaceLoggerDisconnection; this._fuelManager = new FuelManager(this._simLogger, this._debugLogger, 1); this._simLogger.StartListening(); var vm = new ApplicationViewModel(); var mw = new MainWindow { DataContext = vm }; mw.Closing += this.WindowClosing; mw.Show(); this._programConfigurator = new ProgramLoader(this.DebugLogger); var pm = new ProgramManager(this._simLogger, this._programConfigurator); //pm.Load("default"); //pm.StartProgram(); this.MainWindow.Title = "Disconnected - Driver ID: ?"; }
public void TestCompile() { var program = ProgramLoader.Load("CompilerTest.mvm"); var machine = new Machine(); var process = machine.CreateProcess(); process.RegisterDevice("TERMINAL", new TestDevice()); process.LoadProgram(program); while (!process.Terminated) { process.Tick(1); } if (process.ExitCode == null) { Debug.WriteLine("Unexpected termination."); } else { Debug.WriteLine($"{process.ExitCode}"); } }
public void Should_parse_data_to_program() { var cpu = new CPU(); var loader = new ProgramLoader(); var data = new[] { "nop +5", "acc -4", "jmp 0" }; loader.Load(data, cpu); Assert.Equal(3, cpu.Program.Count); Assert.IsType <NoOperation>(cpu.Program[0]); Assert.Equal(5, cpu.Program[0].Arguments[0]); Assert.IsType <Accumulate>(cpu.Program[1]); Assert.Equal(-4, cpu.Program[1].Arguments[0]); Assert.IsType <Jump>(cpu.Program[2]); Assert.Equal(0, cpu.Program[2].Arguments[0]); }
static bool LoadProgram(IChip8Device device, string programPath) { using (var stream = new FileStream(programPath, FileMode.Open)) using (var loader = new ProgramLoader(device)) loader.Load(stream); return(true); }
private static void test() { /*var c = new Class1(0); * var list = new List<IInstruction> * { * new RTypeInstruction() { Function = RTypeFunction.Add, Rd = 30}, * new ITypeInstruction() { Opcode = Opcode.AddImmediate, Rt = 30}, * new RTypeInstruction() { Function = RTypeFunction.JumpRegister, Rs = 31}, * * }; * c.Parse(list, 0, 8);*/ var program = ProgramLoader.ReadProgram(ELFReader.Load <uint>("test.axf"), false); var c2 = new SubCodeReader(program.TextSectionAddress); var startAddress = 0x100004fcu; var endAddress = 0x100005e4u; var sc = c2.Parse(program.Instructions, startAddress, endAddress); var gb = new GraphBuilder(); var g = gb.Build(sc); var gv = new GraphViz(); Console.WriteLine("Plotting Graph"); //gv.CreateGraph(g).Save("graph.svg"); //gv.CreateSVGGraph(g, "graph"); var gl = new GraphLinearizer(); //var c = gl.FindCycles(g); //var pth = new HashSet<Node<IList<IInstruction>>>(); //gl.SearchRec(c.ElementAt(7).Item2, c.ElementAt(7).Item1, new HashSet<Node<IList<IInstruction>>>(), pth); Console.WriteLine("Linearizing Graph"); gl.Linearize(g); Console.WriteLine("Plotting DAG"); //gv.CreateGraph(g).Save("DAG.svg"); //gv.CreateSVGGraph(g, "DAG"); Console.WriteLine("Computing WCET"); var stateTransition = new StateTransition(); var graphHeuristic = new GraphHeuristic(); var initialState = new State(); initialState.Cache = new Cache(5); initialState.Node = g; graphHeuristic.ComputeHeuristic(g); var initialCost = stateTransition.ComputeCost(initialState); var aStar = new AStar.AStarPrime(); AStar.Node aStarResult; var goalState = new State() { Node = gl.FindNodeByInstAddress(g, endAddress) }; aStar.Search(stateTransition, initialState, goalState, Heuristic.ComputeHeuristic, out aStarResult, initialCost); var cwcet = new CachelessWCET(); var cWCET = cwcet.CalculateWCET(g); }
public fx_VXGI(ProgramLoader pLoader, string glsl_effect_path, Resolution full_resolution) : base(pLoader, glsl_effect_path, full_resolution) { // Shifts the voxel volume for cone tracing float vx_shift_scaler = 2.0f; float vx_shift_translation = -_vx_volume_dimensions / vx_shift_scaler; _vx_shift_matrix = Matrix4.CreateTranslation(new Vector3(vx_shift_translation)) * Matrix4.CreateScale(_vx_volume_scale / _vx_volume_dimensions * vx_shift_scaler); }
public RenderEffect(ProgramLoader pLoader, StaticImageLoader tLoader, string resource_folder_name, Resolution full_resolution) { _enabled = true; _pLoader = pLoader; _path_glsl_effect = resource_folder_name; _tLoader = tLoader; _path_static_textures = resource_folder_name; _resolution = full_resolution; _resolution_half = new Resolution(_resolution.W * 0.5f, _resolution.H * 0.5f); }
public void LoadRegisterFromRegisterTest() { var process = ProgramLoader.LoadAssembly("MOV_LoadRegisterFromRegister.asm"); while (!process.Exited) { process.Tick(); } Assert.AreEqual(process.Registers[(int)Register.AX], process.Registers[(int)Register.BX]); }
public void LoadMemoryFromRegister() { var process = ProgramLoader.LoadAssembly("MOV_LoadMemoryFromRegister.asm"); while (!process.Exited) { process.Tick(); } Assert.AreEqual(process.ProcessMemory[0], 12345); }
public void LoadRegisterFromMemoryTest() { var process = ProgramLoader.LoadAssembly("MOV_LoadRegisterFromMemory.asm"); process.ProcessMemory[0] = 12345; while (!process.Exited) { process.Tick(); } Assert.AreEqual(process.Registers[(int)Register.AX], 12345); }
/// <summary> /// </summary> /// <param name="assembly"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"> /// <para><paramref name="assembly"/> is <see langword="null"/>.</para> /// </exception> public static ProgramsCache FromAssembly(Assembly assembly) { if (assembly == null) { throw new ArgumentNullException("assembly"); } ProgramsCache cache = new ProgramsCache(); cache._programs = ProgramLoader.LoadProgramsFromAssembly(assembly); return(cache); }
static void Main(string[] args) { ISimLogger iracing = new iRacingLogger(4.0f); IProgramLoader loader = new ProgramLoader(); ProgramManager programManager = new ProgramManager(iracing, loader); programManager.ProgramEnd += OnProgramEnd; programManager.Load(Directory.GetCurrentDirectory(), "default.json"); iracing.StartListening(); //You have to be connected to iracing and in a session before the loaded program will start Console.WriteLine("waiting for an iracing connection.."); while (!iracing.IsLive) { } Console.WriteLine("starting program.."); }
public fx_AtmosphericScattering(ProgramLoader pLoader, string glsl_effect_path, Resolution full_resolution) : base(pLoader, glsl_effect_path, full_resolution) { _precomputed = false; }
public fx_Shadow(ProgramLoader pLoader, string glsl_effect_path, Resolution full_resolution) : base(pLoader, glsl_effect_path, full_resolution) { _resolution_shadow = (int)(_resolution.W * _texture_scale); }
public void LoadProgramsFromAssemblyTest() { IList <ProgramDescriptor> programs = ProgramLoader.LoadProgramsFromAssembly(Assembly.GetExecutingAssembly()); LoadProgramsInternalTest(programs); }
public fx_Crosshair(ProgramLoader pLoader, StaticImageLoader tLoader, string resource_folder_name, Resolution full_resolution) : base(pLoader, tLoader, resource_folder_name, full_resolution) { }
public RenderEffect(ProgramLoader pLoader, string resource_folder_name, Resolution full_resolution) : this(pLoader, null, resource_folder_name, full_resolution) { }
public void SetUp() { FileInfo file = GetFileInfoFromPath("TestProjects/Project1/no_errors.json"); target = new ProgramLoader(file); }
public void LoadProgram(string path) { var programLoader = new ProgramLoader(Cpu); programLoader.Load(path); }
static void LoadProgram(IChip8Device device, string programPath) { using (var stream = new FileStream("program", FileMode.Open)) using (var loader = new ProgramLoader(device)) loader.Load(stream); }
public fx_gBuffer(ProgramLoader pLoader, StaticImageLoader tLoader, string glsl_effect_path, Resolution full_resolution) : base(pLoader, tLoader, glsl_effect_path, full_resolution) { }
public fx_DepthOfField(ProgramLoader pLoader, StaticImageLoader tLoader, string resource_folder_name, Resolution full_resolution) : base(pLoader, tLoader, resource_folder_name, full_resolution) { _PPM = (float)Math.Sqrt((_resolution_half.W_2) + (_resolution_half.H_2)) / _sensor_width; }
public void LoadProgramFromAssemblyArgumentNullExceptionTest() { ProgramLoader.LoadProgramsFromAssembly(null); }
public fx_Lens(ProgramLoader pLoader, StaticImageLoader tLoader, string resource_folder_name, Resolution full_resolution) : base(pLoader, tLoader, resource_folder_name, full_resolution) { _previous_lens_star_mod = Matrix3.Identity; _resolution_lens = new Resolution(_resolution.W * _texture_scale, _resolution.H * _texture_scale); }
public fx_MotionBlur(ProgramLoader pLoader, string glsl_effect_path, Resolution full_resolution) : base(pLoader, glsl_effect_path, full_resolution) { }
public void TestLoadProgram() { var program = ProgramLoader.Load("CompilerTest.mvm"); Assert.IsNotNull(program); }