Пример #1
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();
            }
        }
Пример #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();
     }
 }