Пример #1
0
 /// <summary>
 /// Extracts the fixed-point format from a SysDOM type descriptor, given that it actually describes a fixed-point number type.
 /// </summary>
 public static FixFormat GetFixFormat(this TypeDescriptor td)
 {
     if (td.CILType.Equals(typeof(Signed)) ||
         td.CILType.Equals(typeof(SFix)))
     {
         return(SFix.GetFormat(td));
     }
     else if (td.CILType.Equals(typeof(Unsigned)) ||
              td.CILType.Equals(typeof(UFix)))
     {
         return(UFix.GetFormat(td));
     }
     else
     {
         return(null);
     }
 }
Пример #2
0
        public object Deserialize(StdLogicVector slv, TypeDescriptor targetType)
        {
            var fmt = SFix.GetFormat(targetType);

            return(SFix.FromSigned(slv.SignedValue, fmt.FracWidth));
        }