Ejemplo n.º 1
0
        private static IPCoreVariant LookupVariant(IPCore coreData, string deviceName, string speedGrade, string iseVersion,
                                                   IEnumerable <IPCoreVariantParam> paramSet)
        {
            var coreVar = coreData.variants.Where(
                v => v.deviceName == deviceName &&
                v.iseVersion == iseVersion &&
                v.speedGrade == speedGrade &&
                v.parameters.Join(paramSet, x => x.name, y => y.name, (x, y) => (x.value == y.value))
                .All(r => r))
                          .FirstOrDefault();

            return(coreVar);
        }
Ejemplo n.º 2
0
        public static void UpdateCache(Component core, PerformanceRecord prec)
        {
            string className = GetClassName(core);
            var    coreData  = LoadIPCoreData(className);

            if (coreData == null)
            {
                coreData = new IPCore()
                {
                    className = className,
                    generator = "",
                    variants  = new IPCoreVariant[0]
                };
            }
            var paramSet = ExtractPerformanceParameters(core);
            var coreVar  = LookupVariant(coreData,
                                         prec.Device.ToString(),
                                         prec.SpeedGrade.ToString(),
                                         prec.ISEVersion.ToString(),
                                         paramSet);
            var rlist = new List <IPCoreVariantResource>();

            rlist.Add(new IPCoreVariantResource()
            {
                name   = PropEnum.ToString(EDeviceResource.SliceRegisters, EPropAssoc.PARReport),
                amount = prec.SliceRegisters
            });
            rlist.Add(new IPCoreVariantResource()
            {
                name   = PropEnum.ToString(EDeviceResource.SliceLUTs, EPropAssoc.PARReport),
                amount = prec.SliceLUTs
            });
            rlist.Add(new IPCoreVariantResource()
            {
                name   = PropEnum.ToString(EDeviceResource.OccupiedSlices, EPropAssoc.PARReport),
                amount = prec.OccupiedSlices
            });
            rlist.Add(new IPCoreVariantResource()
            {
                name   = PropEnum.ToString(EDeviceResource.RAMB18s, EPropAssoc.PARReport),
                amount = prec.RAMB18s
            });
            rlist.Add(new IPCoreVariantResource()
            {
                name   = PropEnum.ToString(EDeviceResource.RAMB36s, EPropAssoc.PARReport),
                amount = prec.RAMB36s
            });
            rlist.Add(new IPCoreVariantResource()
            {
                name   = PropEnum.ToString(EDeviceResource.DSP48E1s, EPropAssoc.PARReport),
                amount = prec.DSP48E1s
            });
            if (coreVar == null)
            {
                coreVar = new IPCoreVariant()
                {
                    deviceName = prec.Device.ToString(),
                    iseVersion = prec.ISEVersion.ToString(),
                    package    = "",
                    speedGrade = prec.SpeedGrade.ToString(),
                    timestamp  = DateTime.Now,
                    minPeriod  = prec.MinPeriod.ScaleTo(ETimeUnit.ns),
                    parameters = paramSet.ToArray()
                };
                coreData.variants = coreData.variants.Concat(new IPCoreVariant[] { coreVar }).ToArray();
            }
            coreVar.consumedResources = rlist.ToArray();
            string path = GetIPCoreDataPath(className);

            using (var wr = new StreamWriter(path))
            {
                IPCoreDataSerializer.Serialize(wr, coreData);
                wr.Close();
            }
        }
Ejemplo n.º 3
0
 public static void UpdateCache(Component core, PerformanceRecord prec)
 {
     string className = GetClassName(core);
     var coreData = LoadIPCoreData(className);
     if (coreData == null)
     {
         coreData = new IPCore()
         {
             className = className,
             generator = "",
             variants = new IPCoreVariant[0]
         };
     }
     var paramSet = ExtractPerformanceParameters(core);
     var coreVar = LookupVariant(coreData,
         prec.Device.ToString(),
         prec.SpeedGrade.ToString(),
         prec.ISEVersion.ToString(),
         paramSet);
     var rlist = new List<IPCoreVariantResource>();
     rlist.Add(new IPCoreVariantResource()
     {
         name = PropEnum.ToString(EDeviceResource.SliceRegisters, EPropAssoc.PARReport),
         amount = prec.SliceRegisters
     });
     rlist.Add(new IPCoreVariantResource()
     {
         name = PropEnum.ToString(EDeviceResource.SliceLUTs, EPropAssoc.PARReport),
         amount = prec.SliceLUTs
     });
     rlist.Add(new IPCoreVariantResource()
     {
         name = PropEnum.ToString(EDeviceResource.OccupiedSlices, EPropAssoc.PARReport),
         amount = prec.OccupiedSlices
     });
     rlist.Add(new IPCoreVariantResource()
     {
         name = PropEnum.ToString(EDeviceResource.RAMB18s, EPropAssoc.PARReport),
         amount = prec.RAMB18s
     });
     rlist.Add(new IPCoreVariantResource()
     {
         name = PropEnum.ToString(EDeviceResource.RAMB36s, EPropAssoc.PARReport),
         amount = prec.RAMB36s
     });
     rlist.Add(new IPCoreVariantResource()
     {
         name = PropEnum.ToString(EDeviceResource.DSP48E1s, EPropAssoc.PARReport),
         amount = prec.DSP48E1s
     });
     if (coreVar == null)
     {
         coreVar = new IPCoreVariant()
         {
             deviceName = prec.Device.ToString(),
             iseVersion = prec.ISEVersion.ToString(),
             package = "",
             speedGrade = prec.SpeedGrade.ToString(),
             timestamp = DateTime.Now,
             minPeriod = prec.MinPeriod.ScaleTo(ETimeUnit.ns),
             parameters = paramSet.ToArray()
         };
         coreData.variants = coreData.variants.Concat(new IPCoreVariant[] { coreVar }).ToArray();
     }
     coreVar.consumedResources = rlist.ToArray();
     string path = GetIPCoreDataPath(className);
     using (var wr = new StreamWriter(path))
     {
         IPCoreDataSerializer.Serialize(wr, coreData);
         wr.Close();
     }
 }
Ejemplo n.º 4
0
 private static IPCoreVariant LookupVariant(IPCore coreData, string deviceName, string speedGrade, string iseVersion,
     IEnumerable<IPCoreVariantParam> paramSet)
 {
     var coreVar = coreData.variants.Where(
         v => v.deviceName == deviceName &&
             v.iseVersion == iseVersion &&
             v.speedGrade == speedGrade &&
             v.parameters.Join(paramSet, x => x.name, y => y.name, (x, y) => (x.value == y.value))
                         .All(r => r))
         .FirstOrDefault();
     return coreVar;
 }