Пример #1
0
        private static List <Register> BNE()
        {
            string imm    = tx.Params.Immediate;
            string offset = imm.Substring(0, 1) + imm.Substring(11, 1) + imm.Substring(1, 10);
            int    num;

            if (offset.Substring(0, 1) == "1")
            {
                offset = DataCleaner.PadHexOpValue(32, offset, '1');
                num    = Int32.Parse(Convert.ToString(Convert.ToInt32(offset, 2), 10));
            }
            else
            {
                num = Int32.Parse(Converter.ConvertBinToDec(offset));
            }
            int ioffSet  = (num * 2) + Int32.Parse(Converter.ConvertHexToDec(tx.Address.Replace("0x", "")));
            int paramOne = GetRegisterValue(rxSG, GetRegisterIndex(rxSG, tx.Params.RSourceOne));
            int paramTwo = GetRegisterValue(rxSG, GetRegisterIndex(rxSG, tx.Params.RDestination));

            if (paramOne != paramTwo)
            {
                NextAddr = "0x" + DataCleaner.PadHexValue(8, Converter.ConvertDecToHex(ioffSet.ToString()));
            }
            return(rxSG);
        }
Пример #2
0
        private static string GetRowValue(string addr, int limit)
        {
            int    i      = -1;
            int    oLimit = limit;
            string value  = string.Empty;

            foreach (DataRow row in dxDT.Rows)
            {
                if (oLimit != limit)
                {
                    value = (string)row["Value"] + value.Replace("0x", "");
                    limit--;
                }

                if ((string)row["Address"] == addr)
                {
                    value = (string)row["Value"] + value;
                    limit--;
                }


                if (limit == 0)
                {
                    break;
                }

                i++;
            }

            if (!string.IsNullOrEmpty(value))
            {
                value = value.Replace("0x", "");
                int bigE = Int32.Parse(Converter.ConvertHexToDec(value.Substring(0, 1)));

                if (bigE < 8)
                {
                    value = DataCleaner.PadHexOpValue(8, value, '0');
                }
                else
                {
                    value = DataCleaner.PadHexOpValue(8, value, 'F');
                }
            }

            return(value);
        }
Пример #3
0
        // IMMEDIATE
        private static List <Register> ADDI()
        {
            // ADDI x1, x2, x3
            int    rsOne    = GetRegisterValue(rxSG, GetRegisterIndex(rxSG, tx.Params.RSourceOne));
            string immRsTwo = tx.Params.Immediate + tx.Params.RSourceTwo;

            if (immRsTwo.Substring(0, 1) == "1")
            {
                immRsTwo = DataCleaner.PadHexOpValue(64, immRsTwo, '1');
            }
            int    rsTwo  = Int32.Parse(Converter.ConvertBinToDec(immRsTwo));
            string rsDest = "0x" + DataCleaner.PadHexValue(8, Converter.ConvertDecToHex((rsOne + rsTwo).ToString()));
            int    index  = GetRegisterIndex(rxSG, tx.Params.RDestination);

            rxSG[index].Value = rsDest;
            return(rxSG);
        }