Beispiel #1
0
        private bool IsRegValueValid(RegBitsRange item, UInt32 val)
        {
            UInt32 mask = (UInt32)(Math.Pow((double)2, (double)(item.End - item.Start + 1)) - 1) << item.Start;
            UInt32 temp = (mask & val) >> item.Start;

            return(temp >= item.Min && temp <= item.Max);
        }
Beispiel #2
0
        /// <summary>
        /// 将比特位使为false的值置为0
        /// </summary>
        /// <param name="val">置零前的值</param>
        /// <param name="range">置零范围</param>
        /// <returns></returns>
        private UInt32 MakeInValidBits2Zero(UInt32 val, RegBitsRange range)
        {
            if (range.Max != range.Min)
            {
                return(val);
            }

            UInt32 mask = (UInt32)(Math.Pow((double)2, (double)(range.End - range.Start + 1)) - 1) << range.Start;

            return(val & ~mask);
        }
Beispiel #3
0
        private bool IsRegBitsValid(RegBitsRange item, List <RegBitModel> regBits)
        {
            UInt32 temp = 0;

            for (UInt32 i = item.Start; i < item.End + 1; i++)
            {
                if (regBits[(int)i].Bit)
                {
                    temp = (UInt32)(1 << (Int32)(i - item.Start)) | temp;
                }
            }
            return(temp >= item.Min && temp <= item.Min);
        }