Esempio n. 1
0
        /// <summary>
        /// Restore m_location2TileKey, m_tiles and m_matrices
        /// </summary>
        public void DoPostSerializationTasks()
        {
            m_location2TileKey.Clear();
            m_tiles.Clear();
            m_maxTileKeyX = 0;
            MaxX          = 0;
            MaxY          = 0;

            while (m_rawTiles.Count > 0)
            {
                RawTile rawTile = m_rawTiles.Dequeue();
                Tile    tile    = new Tile(rawTile);

                foreach (RawSlice rawSlice in rawTile.RawSlices)
                {
                    Slice slice = Slice.GetSliceFromRawSlice(tile, rawSlice);
                    tile.Slices.Add(slice);
                }

                Add(tile);
            }

            m_matrices.Clear();
            while (m_rawMatrices.Count > 0)
            {
                RawSwitchMatrix rawSM = m_rawMatrices.Dequeue();
                SwitchMatrix    sm    = new SwitchMatrix(rawSM);
                Add(sm.HashCode, sm);
            }

            m_rawTiles.Clear();
            m_rawMatrices.Clear();

            // Time Model
            if (TimeModelAttributes != null)
            {
                Tile.TimeModelAttributeIndices = new Dictionary <Tile.TimeAttributes, int>();
                int c = 0;
                for (int i = 0; i < 4; i++)
                {
                    if (TimeModelAttributes[i])
                    {
                        Tile.TimeModelAttributeIndices.Add((Tile.TimeAttributes)i, c);
                        c++;
                    }
                }
            }

            Commands.Debug.PrintGoAheadInternals.ObjectsToPrint.Add(this);
        }
Esempio n. 2
0
        public void DoPreSerializationTasks()
        {
            // no clear as this field might be NULL after deserialization
            m_rawTiles = new Queue <RawTile>();
            foreach (Tile t in GetAllTiles())
            {
                AddWLDtoFPGA(t);
                RawTile rawTile = new RawTile(t);
                m_rawTiles.Enqueue(rawTile);
            }
            //this.m_wires.Clear();
            m_tiles.Clear();
            m_location2TileKey.Clear();

            // no clear as this field might be NULL after deserialization
            m_rawMatrices = new Queue <RawSwitchMatrix>();
            foreach (SwitchMatrix sm in m_matrices.Values)
            {
                RawSwitchMatrix rawSm = new RawSwitchMatrix(sm);
                m_rawMatrices.Enqueue(rawSm);
            }
            m_matrices.Clear();
        }
Esempio n. 3
0
        private bool AddTimeData(RawTile rawTile)
        {
            // To parse in valid serialized data, all of the following lists must be non-null
            if (rawTile.TimingData_Pairs_1 == null ||
                rawTile.TimingData_Pairs_2 == null ||
                rawTile.TimingData_Times_1 == null ||
                rawTile.TimingData_Times_2 == null ||
                rawTile.TimingData_Times_3 == null ||
                rawTile.TimingData_Times_4 == null)
            {
                return(false);
            }

            // Check for consistency, both pair lists must be of same length and
            // if any time list has elements it must also be the same length
            int size = rawTile.TimingData_Pairs_1.Count;

            if (rawTile.TimingData_Pairs_2.Count != size)
            {
                return(false);
            }

            bool att1 = false;

            if (rawTile.TimingData_Times_1.Count != 0)
            {
                if (rawTile.TimingData_Times_1.Count != size)
                {
                    return(false);
                }
                att1 = true;
            }
            bool att2 = false;

            if (rawTile.TimingData_Times_2.Count != 0)
            {
                if (rawTile.TimingData_Times_2.Count != size)
                {
                    return(false);
                }
                att2 = true;
            }
            bool att3 = false;

            if (rawTile.TimingData_Times_3.Count != 0)
            {
                if (rawTile.TimingData_Times_3.Count != size)
                {
                    return(false);
                }
                att3 = true;
            }
            bool att4 = false;

            if (rawTile.TimingData_Times_4.Count != 0)
            {
                if (rawTile.TimingData_Times_4.Count != size)
                {
                    return(false);
                }
                att4 = true;
            }

            // The serialized data is valid, we can now read it in
            for (int i = 0; i < size; i++)
            {
                List <float> attVals = new List <float>();
                if (att1)
                {
                    attVals.Add(rawTile.TimingData_Times_1[i]);
                }
                if (att2)
                {
                    attVals.Add(rawTile.TimingData_Times_2[i]);
                }
                if (att3)
                {
                    attVals.Add(rawTile.TimingData_Times_3[i]);
                }
                if (att4)
                {
                    attVals.Add(rawTile.TimingData_Times_4[i]);
                }
                AddTimeData(rawTile.TimingData_Pairs_1[i], rawTile.TimingData_Pairs_2[i], attVals.ToArray());
            }

            return(true);
        }
Esempio n. 4
0
        public Tile(RawTile rawTile)
        {
            m_key                    = new TileKey(rawTile.TileKeyX, rawTile.TileKeyY);
            m_location               = rawTile.TileLocationString;
            SwitchMatrixHashCode     = rawTile.SwitchMatrixHashCode;
            WireListHashCode         = rawTile.WireListHashCode;
            IncomingWireListHashCode = rawTile.IncomingWireListHashCode;
            // vivado
            m_clockRegion = rawTile.ClockRegion != null ? rawTile.ClockRegion : "unknown";
            // location in of form LEFTPART_X\d+Y\d+
            // and left part may contain X. extract x and y digits from tight part
            if (m_tileMatch.IsMatch(m_location))
            {
                string[] atoms = m_location.Split('X', 'Y');
                m_locationX = int.Parse(atoms[atoms.Length - 2]);
                m_locationY = int.Parse(atoms[atoms.Length - 1]);
            }
            else if (m_tileMatchS3.IsMatch(m_location)) // Spartan 3
            {
                string[] atoms = m_location.Split('R', 'C');
                m_locationX = int.Parse(atoms[atoms.Length - 1]); // reverse!
                m_locationY = int.Parse(atoms[atoms.Length - 2]);
            }

            foreach (string portName in rawTile.PortsToExcludeFromBlocking)
            {
                // restore s6 bugfix
                BlockPort(portName, BlockReason.ExcludedFromBlocking);
            }
            if (rawTile.PortsOnArcsWithStopovers != null)
            {
                foreach (string portName in rawTile.PortsOnArcsWithStopovers)
                {
                    BlockPort(portName, BlockReason.Stopover);
                }
            }

            if (!AddTimeData(rawTile))
            {
                //Console.WriteLine("Adding time data failed for tile: " + m_location);
            }

            if (rawTile.WiresTrajectoriesData_keys != null && rawTile.WiresTrajectoriesData_vals != null)
            {
                if (rawTile.WiresTrajectoriesData_keys.Count == rawTile.WiresTrajectoriesData_vals.Count)
                {
                    for (int i = 0; i < rawTile.WiresTrajectoriesData_keys.Count; i++)
                    {
                        uint     pip  = rawTile.WiresTrajectoriesData_keys[i];
                        string[] vals = rawTile.WiresTrajectoriesData_vals[i].Split(' ');

                        foreach (var val in vals)
                        {
                            if (uint.TryParse(val, out uint tile))
                            {
                                AddWireTrajectoryData(pip, tile);
                            }
                            else
                            {
                                Console.WriteLine("Failed parsing " + val + " into uint");
                            }
                        }
                    }
                }
            }
        }