示例#1
0
        private Fragmentation GetFragmentation(SelectionInfo selInfo, int height, ResourceRequirements resourceRequirements)
        {
            Dictionary <IdentifierManager.RegexTypes, int> resources = GetResourceInArea(selInfo.ResourceString, height);

            Fragmentation result = new Fragmentation();

            foreach (IdentifierManager.RegexTypes resourceType in m_resStringInfo.GetResourceTypes())
            {
                result.ResourceTypeFragmentation[resourceType] = resources[resourceType] - resourceRequirements.GetResourceRequirement(resourceType);
            }

            return(result);
        }
示例#2
0
        public void InitResourceStrings(int sweepLineY)
        {
            // get BRAM / DSP heighs
            BRAMDSPSetting dspSetting  = BRAMDSPSettingsManager.Instance.GetDSPSetting();
            BRAMDSPSetting bramSetting = BRAMDSPSettingsManager.Instance.GetBRAMSetting();

            if (dspSetting.Heigth != bramSetting.Heigth)
            {
                throw new ArgumentException("Expecting DSP and BRAM to be same height");
            }

            m_dspBRAMHeight = dspSetting.Heigth;

            string      resourceString = "";
            List <Tile> tiles          = new List <Tile>();

            for (int x = 0; x < FPGA.FPGA.Instance.MaxX; x++)
            {
                Tile t       = FPGA.FPGA.Instance.GetTile(x, sweepLineY);
                bool addTile = false;
                foreach (IdentifierManager.RegexTypes resType in GetResourceTypes())
                {
                    if (IdentifierManager.Instance.IsMatch(t.Location, resType))
                    {
                        resourceString += GetCharForResourceType(resType);
                        addTile         = true;
                    }
                }
                if (addTile)
                {
                    tiles.Add(t);
                }
            }

            for (int start = 0; start < resourceString.Length; start++)
            {
                for (int length = 1; start + length < resourceString.Length; length++)
                {
                    string subString = resourceString.Substring(start, length);

                    if (!m_evaluatedResourceStrings.ContainsKey(subString))
                    {
                        Dictionary <IdentifierManager.RegexTypes, int> resourcesInSelection = new Dictionary <IdentifierManager.RegexTypes, int>();

                        foreach (IdentifierManager.RegexTypes resType in GetResourceTypes())
                        {
                            char resTypeChar = GetCharForResourceType(resType);
                            resourcesInSelection[resType] = subString.Count(c => c == resTypeChar);
                        }
                        // we think in fll BRAM / DSP
                        resourcesInSelection[IdentifierManager.RegexTypes.CLB] *= m_dspBRAMHeight;

                        SelectionInfo selInfo = new SelectionInfo();
                        selInfo.Left           = tiles[start];
                        selInfo.Right          = tiles[start + (length - 1)];
                        selInfo.ResourceString = subString;
                        selInfo.Resources      = resourcesInSelection;
                        m_evaluatedResourceStrings.Add(subString, selInfo);
                    }
                }
            }
        }