Пример #1
0
        private void AddRegister(UInt16 addr, string desc = "")
        {
            var reg = new Register(addr, _sensor.ReadReg(addr).ToString("X"), desc);

            reg.PropertyChanged += Reg_PropertyChanged;
            Registers.Add(reg);
        }
Пример #2
0
        public Register AddRegister(string name)
        {
            var register = new Register(this, name);

            Registers.Add(register);
            return(register);
        }
Пример #3
0
 public Assembunny()
 {
     Registers.Add("a", 0);
     Registers.Add("b", 0);
     Registers.Add("c", 0);
     Registers.Add("d", 0);
 }
Пример #4
0
 public ModbusRTUProtocol()
 {
     for (ushort i = 0; i < NumberOfPoints; i++)
     {
         Registers.Add(new Register()
         {
             Address = (ushort)(startAddress + i)
         });
     }
 }
Пример #5
0
 private void SaveToRegister(long address, long value)
 {
     if (Registers.ContainsKey(address))
     {
         Registers[address] = value;
     }
     else
     {
         Registers.Add(address, value);
     }
 }
Пример #6
0
 public Memory()
 {
     MemStack = new Stack <int>();
     Registers.Add("RA", default);
     Registers.Add("RB", default);
     Registers.Add("RC", default);
     Registers.Add("RD", default);
     Registers.Add("RE", default);
     Registers.Add("RF", default);
     Variables = new Dictionary <string, object>();
 }
Пример #7
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public MethodBody(MethodDefinition method, int registersSize)
 {
     Owner        = method;
     registers    = new List <Register>();
     instructions = new List <Instruction>();
     exceptions   = new List <ExceptionHandler>();
     for (var i = 0; i < registersSize; i++)
     {
         Registers.Add(new Register(i));
     }
 }
Пример #8
0
 public PCIeCapability(PCIeBasePeripheral parent) : base(parent, 0x10, 0x3C)
 {
     Registers.Add(new DoubleWordRegister(parent)
                   .WithValueField(0, 8, FieldMode.Read, valueProviderCallback: _ => Id, name: "PCI Express Cap ID")
                   .WithValueField(8, 8, FieldMode.Read, valueProviderCallback: _ => NextCapability, name: "Next Cap Pointer")
                   .WithValueField(16, 4, FieldMode.Read, valueProviderCallback: _ => 0x2 /* current specification */, name: "Capability Version")
                   .WithEnumField(20, 4, FieldMode.Read, valueProviderCallback: (DeviceType _) => parent.HeaderType.HasFlag(HeaderType.Bridge) ? DeviceType.RootComplexIntegratedEndpoint : DeviceType.PCIExpressEndpoint, name: "Device/Port Type") // this is a guess and an approximation to the two types of devices we have
                   .WithFlag(24, FieldMode.Read, valueProviderCallback: _ => false, name: "Slot Implemented")
                   .WithTag("Interrupt Message Number", 25, 5)
                   .WithReservedBits(30, 2)
                   );
 }
Пример #9
0
 public void ResetRegisters()
 {
     Registers.Clear();
     Registers.Add("a", 0);
     Registers.Add("b", 0);
     Registers.Add("c", 0);
     Registers.Add("d", 0);
     Registers.Add("e", 0);
     Registers.Add("f", 0);
     Registers.Add("g", 0);
     Registers.Add("h", 0);
 }
Пример #10
0
        public Register GetRegister(byte index)
        {
            if (Registers.TryGetValue(index, out Register register))
            {
                return(register);
            }

            register = new Register($"R_{index:X2}");
            Registers.Add(index, register);

            return(register);
        }
Пример #11
0
        private void RunInstructions()
        {
            foreach (var instruction in Instructions)
            {
                var parts        = instruction.Split(" ");
                var register     = parts[0];
                var add          = parts[1].Equals("inc");
                var value        = int.Parse(parts[2]);
                var condRegister = parts[4];
                var condition    = parts[5];

                var condValue = int.Parse(parts[6]);

                //Init Registers if missing
                if (!Registers.ContainsKey(register))
                {
                    Registers.Add(register, 0);
                }

                if (!Registers.ContainsKey(condRegister))
                {
                    Registers.Add(condRegister, 0);
                }

                //check condition
                var conditionMet = condition switch
                {
                    (">") => Registers[condRegister] > condValue,
                    (">=") => Registers[condRegister] >= condValue,
                    ("<") => Registers[condRegister] < condValue,
                    ("<=") => Registers[condRegister] <= condValue,
                    ("==") => Registers[condRegister] == condValue,
                    ("!=") => Registers[condRegister] != condValue,
                    _ => throw new ArgumentOutOfRangeException()
                };

                if (!conditionMet)
                {
                    continue;
                }
                if (add)
                {
                    Registers[register] += value;
                }
                else
                {
                    Registers[register] -= value;
                }

                MaxValueInRegister = Math.Max(MaxValueInRegister, Registers[register]);
            }
        }
 private void LoadRegistrations()
 {
     try
     {
         var items = ctx.Registers.ToList().Where(r => r.CourseID == _selectedCourseID);
         Registers.Clear();
         foreach (var item in items)
         {
             Registers.Add(item);
         }
     }
     catch (SystemException ex)
     {
         Log.WriteLine(ex.Message);
     }
 }
Пример #13
0
        public void ParseDuet(IEnumerable <string> rows)
        {
            Instructions.Clear();

            foreach (var row in rows)
            {
                var ins = Instruction.CreateCmd(row);
                if (!string.IsNullOrEmpty(ins.RegA) && !Registers.ContainsKey(ins.RegA))
                {
                    Registers.Add(ins.RegA, 0);
                }
                if (!string.IsNullOrEmpty(ins.RegB) && !Registers.ContainsKey(ins.RegA))
                {
                    Registers.Add(ins.RegB, 0);
                }
                Instructions.Add(ins);
            }
        }
Пример #14
0
        private async void GetRegisters()
        {
            Registers r = new Registers();

            r.ID           = 0;
            r.RegisterName = "All Registers";
            using (HttpClient client = new HttpClient())
            {
                HttpResponseMessage response = await client.GetAsync("http://localhost:65079/api/register");

                if (response.IsSuccessStatusCode)
                {
                    string json = await response.Content.ReadAsStringAsync();

                    Registers = JsonConvert.DeserializeObject <ObservableCollection <Registers> >(json);
                    Registers.Add(r);
                }
            }
        }
Пример #15
0
        private void addRegisters <TRegister>(string regType, string idPreFix, string line, int lineNumber)
            where TRegister : RegisterBase, new()
        {
            if (!Regex.IsMatch(line, $@"^{regType}(\s+{registerNamePattern}\s+\d+)+$", RegexOptions.IgnoreCase))
            {
                throw new ParsingError(regType, line, lineNumber, 0, "Incorrect Format");
            }

            int bits, index = 0;

            foreach (var item in Regex.Matches(line.Substring(regType.Length), $@"{registerNamePattern}\s+\d+", RegexOptions.IgnoreCase)
                     .Cast <Match>()
                     .Select(match => new
            {
                Match = match,
                MatchStr = match.ToString()
            })
                     .Select(match => new
            {
                Match = match,
                MatchSplit = Regex.Replace(match.MatchStr, @"\s+", "\t").Split('\t')
            })
                     .Select(match => new
            {
                Match = match,
                Register = new TRegister
                {
                    Id = $"{idPreFix}{index++:000}",
                    Name = match.MatchSplit[0],
                    Bits = int.TryParse(match.MatchSplit[1], out bits) ? bits : -1
                }
            }))
            {
                if (item.Register.Bits < 1)
                {
                    var lineIndex = regType.Length + item.Match.Match.Match.Index + item.Register.Name.Length;
                    lineIndex += line.Skip(lineIndex).TakeWhile(char.IsWhiteSpace).Count();

                    throw new ParsingError(regType, line, lineNumber, lineIndex, "The number of bits is less then one.");
                }
                Registers.Add(item.Register.Name, item.Register);
            }
        }
Пример #16
0
        public ScopeFpgaRom(ISmartScopeInterface hwInterface, byte I2cAddress) : base(hwInterface, I2cAddress, 0, true)
        {
            foreach (ROM reg in Enum.GetValues(typeof(ROM)))
            {
                Registers.Add((uint)reg, new ByteRegister(this, (uint)reg, reg.ToString()));
            }

            int lastStrobe = 0;

            foreach (STR s in Enum.GetValues(typeof(STR)))
            {
                if ((int)s > lastStrobe)
                {
                    lastStrobe = (int)s;
                }
            }

            for (uint i = (uint)ROM.STROBES + 1; i < (uint)ROM.STROBES + lastStrobe / 8 + 1; i++)
            {
                Registers.Add(i, new ByteRegister(this, i, "STROBES " + (i - (int)ROM.STROBES)));
            }
        }
Пример #17
0
 public void Init(IEnumerable <int> input, IEnumerable <int> expected, string inputText)
 {
     Stack.Clear();
     Registers.Clear();
     for (int i = 0; i < 4; i++)
     {
         Registers.Add(0);
     }
     Input.Clear();
     Expected.Clear();
     Output.Clear();
     foreach (int i in input)
     {
         Input.Add(i);
     }
     foreach (int i in expected)
     {
         Expected.Add(i);
     }
     Status = Status.Running;
     Build(inputText);
 }
Пример #18
0
 public void Report()
 {
     registers.Add(tileValue);
 }
 public void AddRow()
 {
     Registers.Add(new TableModel());
     NotifyOfPropertyChange(() => Registers);
     NotifyOfPropertyChange(() => CanRemoveRow);
 }
Пример #20
0
        public Registers GetRegisters()
        {
            Registers registers = new Registers ();
            ManualResetEvent evt = new ManualResetEvent (false);

            MaintPrintRawRegistersCmd printRegistersCmd = new MaintPrintRawRegistersCmd (this,
            delegate(string name, uint num, uint size)
            {
                registers.Add (new Register (num, name, size));
            });

            printRegistersCmd.CommandFinishedEvent += delegate(GDBCommand obj) {
                evt.Set ();
            };

            QueueCommand (printRegistersCmd);

            evt.WaitOne ();
            return registers;
        }
Пример #21
0
 public void AddRegister(DataRegister register)
 {
     Registers.Add(register);
 }
Пример #22
0
 public void Handle(Application.Boundaries.Register.Output output)
 {
     Registers.Add(output);
 }
Пример #23
0
        public RegisterCollection(Cpu aCpu)
        {
            Cpu = aCpu;

            const RegisterAccess rw =
                RegisterAccess.R | RegisterAccess.W;

            const RegisterAccess r = RegisterAccess.R;

            const RegisterAccess pw = RegisterAccess.PW;

            const RegisterAccess rpw = r | pw;

            const RegisterAccess prpw =
                RegisterAccess.PR | pw;

            #region Register Decelerations

            // --------------- Data Registers ---------------
            var regR1 =
                new Register(aCpu, rw, Core.Register.Registers.R1);
            var regR2 =
                new Register(aCpu, rw, Core.Register.Registers.R2);
            var regR3 =
                new Register(aCpu, rw, Core.Register.Registers.R3);
            var regR4 =
                new Register(aCpu, rw, Core.Register.Registers.R4);
            var regR5 =
                new Register(aCpu, rw, Core.Register.Registers.R5);
            var regR6 =
                new Register(aCpu, rw, Core.Register.Registers.R6);
            var regR7 =
                new Register(aCpu, rw, Core.Register.Registers.R7);
            var regR8 =
                new Register(aCpu, rw, Core.Register.Registers.R8);

            // --------------- Special Registers ---------------
            var regAc =
                new Register(aCpu, rw, Core.Register.Registers.AC);
            var regIp =
                new Register(aCpu, rw, Core.Register.Registers.IP);
            var regSp =
                new Register(aCpu, prpw, Core.Register.Registers.SP);
            var regFp =
                new Register(aCpu, rpw, Core.Register.Registers.FP);
            var regFl =
                new Register(aCpu,
                             rw,
                             Core.Register.Registers.FL,
                             typeof(CpuFlags));
            var regPc =
                new Register(aCpu, rpw, Core.Register.Registers.PC);

            #endregion // Register Decelerations

            #region Register Binding

            Registers.Add(Core.Register.Registers.R1, regR1);
            Registers.Add(Core.Register.Registers.R2, regR2);
            Registers.Add(Core.Register.Registers.R3, regR3);
            Registers.Add(Core.Register.Registers.R4, regR4);
            Registers.Add(Core.Register.Registers.R5, regR5);
            Registers.Add(Core.Register.Registers.R6, regR6);
            Registers.Add(Core.Register.Registers.R7, regR7);
            Registers.Add(Core.Register.Registers.R8, regR8);
            Registers.Add(Core.Register.Registers.AC, regAc);
            Registers.Add(Core.Register.Registers.IP, regIp);
            Registers.Add(Core.Register.Registers.SP, regSp);
            Registers.Add(Core.Register.Registers.FP, regFp);
            Registers.Add(Core.Register.Registers.FL, regFl);
            Registers.Add(Core.Register.Registers.PC, regPc);

            #endregion // Register Binding
        }
Пример #24
0
 public void Standard(RegisterOutput output)
 {
     Registers.Add(output);
 }
 public void Standard(Application.Boundaries.Register.RegisterOutput output)
 {
     Registers.Add(output);
 }
Пример #26
0
 /// <summary>
 /// 注册配置
 /// </summary>
 /// <param name="register"></param>
 public void Regist(IMqTransRegister register)
 {
     Registers.Add(register);
 }