protected void SetPICModel(string picName, PICExecMode mode) { arch = new PICArchitecture("pic") { Options = new PICArchitectureOptions(picName, mode) }; arch.CreatePICProcessorModel(); PICMemoryDescriptor.ExecMode = mode; }
protected void SetPICModel(string picName, PICExecMode mode = PICExecMode.Traditional) { arch = new PICArchitecture(new ServiceContainer(), "pic") { Options = new PICArchitectureOptions(picName, mode) }; picModel = arch.ProcessorModel; arch.CreatePICProcessorModel(); PICMemoryDescriptor.ExecMode = mode; }
private PICArchitecture GetArch(string picName, PICExecMode mode = PICExecMode.Traditional) { var arch = new PICArchitecture("pic") { Options = new PICArchitectureOptions(picName, mode) }; Assert.NotNull(arch); arch.CreatePICProcessorModel(); return(arch); }
private PICArchitecture GetArch(string picName, PICExecMode mode = PICExecMode.Traditional) { var arch = new PICArchitecture(new ServiceContainer(), "pic", new Dictionary <string, object>()) { Options = new PICArchitectureOptions(picName, mode) }; Assert.NotNull(arch); arch.CreatePICProcessorModel(); return(arch); }
/// <summary> /// Sets the PIC execution mode per the XINST device configuration bit value (if present in the memory image). /// If no XINST bit can be found in the image or for this processor, the PIC execution mode is left to the user's choice. /// </summary> private void SetPICExecMode() { PICExecMode pexec = architecture.Options.PICExecutionMode; var dcf = PICMemoryDescriptor.GetDCRField("XINST"); if (dcf != null) { var dcr = PICMemoryDescriptor.GetDCR(dcf.RegAddress); if (dcr != null && program.SegmentMap.TryFindSegment(dcr.Address, out ImageSegment xinstsegt)) { var mem = (ByteMemoryArea)xinstsegt.MemoryArea; uint xinstval; if (dcr.BitWidth <= 8) { xinstval = mem.ReadByte(dcf.RegAddress); } else if (dcr.BitWidth <= 16) { xinstval = mem.ReadLeUInt16(dcf.RegAddress); } else { xinstval = mem.ReadLeUInt32(dcf.RegAddress); } pexec = (dcr.CheckIf("XINST", "ON", xinstval) ? PICExecMode.Extended : PICExecMode.Traditional); } } else { pexec = PICExecMode.Traditional; } PICMemoryDescriptor.ExecMode = pexec; architecture.Options.PICExecutionMode = pexec; architecture.Description = architecture.Options.ProcessorModel.PICName + $" ({pexec})"; }
public PICArchitectureOptions(string picName, PICExecMode execMode, string ldrType = "raw") : this(PICProcessorModel.GetModel(picName), execMode, ldrType) { }
public PICArchitectureOptions(IPICProcessorModel processorModel, PICExecMode execMode, string ldrType) { ProcessorModel = processorModel ?? throw new ArgumentNullException(nameof(processorModel)); PICExecutionMode = execMode; LoaderType = ldrType; }