コード例 #1
0
 /// <summary>
 /// Constructor of a named joined PIC register.
 /// </summary>
 /// <param name="jsfr">The joined SFR definition.</param>
 /// <param name="number">The Reko index number of this register.</param>
 /// <param name="subregs">The sub-registers of the joint.</param>
 public PICRegisterStorage(IJoinedRegister jsfr, int number, IList <PICRegisterStorage> subregs)
     : base(jsfr.Name, number, 0, PrimitiveType.CreateWord(jsfr.BitWidth))
 {
     Traits       = new PICRegisterTraits(jsfr, subregs);
     AttachedRegs = subregs.ToList();
     AttachedRegs.ForEach(r => r.ParentRegister = this);
     ParentRegister = null;
     BitFields      = new SortedList <PICRegisterBitFieldSortKey, PICRegisterBitFieldStorage>();
 }
コード例 #2
0
ファイル: PICRegisterTraits.cs プロジェクト: xxtxiaofeng/reko
        /// <summary>
        /// Construct the PIC register's traits based on the given <see cref="IJoinedRegister"/> descriptor
        /// and its children PIC registers' traits.
        /// </summary>
        /// <remarks>
        /// The construction of the joined register's traits assumes that the enumeration of attached registers/traits
        /// is enuerable in increasing registers' order (LSB, MSB, little-endian).
        /// </remarks>
        /// <param name="joinedSFR">The joined PIC register descriptor.</param>
        /// <param name="attachedRegsTraits">The joined registers' traits.</param>
        /// <exception cref="ArgumentNullException">Thrown when one or more required arguments are null.</exception>
        public PICRegisterTraits(IJoinedRegister joinedSFR, IEnumerable <PICRegisterTraits> attachedRegsTraits)
        {
            if (joinedSFR is null)
            {
                throw new ArgumentNullException(nameof(joinedSFR));
            }
            if (attachedRegsTraits is null)
            {
                throw new ArgumentNullException(nameof(attachedRegsTraits));
            }
            Name       = joinedSFR.Name;
            Desc       = joinedSFR.Description;
            RegAddress = new PICRegisterSizedUniqueAddress(PICDataAddress.Ptr(joinedSFR.Addr), (int)joinedSFR.BitWidth);
            var rev = attachedRegsTraits.Reverse();

            Access     = AdjustString(String.Join("", rev.Select(e => e.Access)), '-');
            MCLR       = AdjustString(String.Join("", rev.Select(e => e.MCLR)), 'u');
            POR        = AdjustString(String.Join("", rev.Select(e => e.POR)), '0');
            Impl       = rev.Aggregate(0UL, (total, reg) => total = (total << 8) + reg.Impl);
            IsVolatile = attachedRegsTraits.Any(e => e.IsVolatile == true);
            IsIndirect = attachedRegsTraits.Any(e => e.IsIndirect == true);
        }
コード例 #3
0
ファイル: PICRegisterTraits.cs プロジェクト: xxtxiaofeng/reko
 /// <summary>
 /// Construct the PIC register's traits based on the given <see cref="IJoinedRegister"/> descriptor
 /// and its children PIC registers.
 /// </summary>
 /// <param name="joinedSFR">The joined PIC register descriptor.</param>
 /// <param name="attachedRegs">The attached (children) PIC registers.</param>
 /// <exception cref="ArgumentNullException">Thrown if one of the arguments is null.</exception>
 public PICRegisterTraits(IJoinedRegister joinedSFR, IEnumerable <PICRegisterStorage> attachedRegs)
     : this(joinedSFR, attachedRegs?.Select(e => e.Traits).ToList())
 {
 }