Exemplo n.º 1
0
 protected void SetPICModel(string picName, PICExecMode mode)
 {
     arch = new PICArchitecture("pic")
     {
         Options = new PICArchitectureOptions(picName, mode)
     };
     arch.CreatePICProcessorModel();
     PICMemoryDescriptor.ExecMode = mode;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        /// <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})";
        }
Exemplo n.º 6
0
 public PICArchitectureOptions(string picName, PICExecMode execMode, string ldrType = "raw")
     : this(PICProcessorModel.GetModel(picName), execMode, ldrType)
 {
 }
Exemplo n.º 7
0
 public PICArchitectureOptions(IPICProcessorModel processorModel, PICExecMode execMode, string ldrType)
 {
     ProcessorModel   = processorModel ?? throw new ArgumentNullException(nameof(processorModel));
     PICExecutionMode = execMode;
     LoaderType       = ldrType;
 }