/// <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); } }
public object Deserialize(StdLogicVector slv, TypeDescriptor targetType) { var fmt = UFix.GetFormat(targetType); return(UFix.FromUnsigned(slv.UnsignedValue, fmt.FracWidth)); }