Example #1
0
 public PICArchitectureOptionsPicker(PICArchitectureOptions opts)
 {
     if (opts == null)
     {
         throw new ArgumentNullException(nameof(opts));
     }
     PICName       = opts.ProcessorModel.PICName;
     AllowExtended = opts.PICExecutionMode == PICExecMode.Extended;
     LoaderType    = opts.LoaderType;
 }
Example #2
0
        public override void LoadUserOptions(Dictionary <string, object> options)
        {
            //TODO: throw exception instead of tinkering the options, when dcproject loading will be effective.
            if (options == null)
            {
                options = new Dictionary <string, object>()
                {
                    { opt_model, PICProcessorModel.DefaultPICName },
                    { opt_execmode, PICExecMode.Traditional },
                    { opt_loadertype, "raw" }
                };
            }

            if (options.TryGetValue(opt_model, out var model))
            {
                switch (model)
                {
                case string spicname:
                    PeekOption(options, opt_execmode, out PICExecMode eExecMode, PICExecMode.Traditional);
                    PeekOption(options, opt_loadertype, out string loaderType, "raw");
                    Options = new PICArchitectureOptions(spicname, eExecMode, loaderType);
                    break;

                case PICArchitectureOptionsPicker picker:
                    Options = new PICArchitectureOptions(picker);
                    break;

                default:
                    throw new InvalidOperationException($"Invalid PIC model user options.");
                }
                CreatePICProcessorModel();
            }
            else
            {
                throw new InvalidOperationException($"Missing PIC model user options.");
            }
        }