コード例 #1
0
        public void TryGetNetAt_WorksWell_WithProperInnput()
        {
            IBitmapAccessor accessor = new MockupBitmapAccessor(
                new string[] {
                //   012345678
                "  XXXXXXX",
                " XX     X",
                " XX XXX X",
                "",
                " XX XXX X",
                "  XX    X",
                "   XXXX",
                "",
            });
            BitmapScanner dut = new BitmapScanner(accessor);

            dut.Scan();
            dut.ComputeNetlists();
            dut.CompactNets();
            dut.MapNetlists();

            Assert.IsTrue(dut.TryGetNetAt(1, 2, out int netId));
            Assert.AreEqual(1, netId);

            Assert.IsTrue(dut.TryGetNetAt(5, 2, out netId));
            Assert.AreEqual(2, netId);

            Assert.IsTrue(dut.TryGetNetAt(5, 4, out netId));
            Assert.AreEqual(4, netId);

            Assert.IsFalse(dut.TryGetNetAt(3, 4, out netId));
        }
コード例 #2
0
        public void MapNetlists_WorksWell()
        {
            IBitmapAccessor accessor = new MockupBitmapAccessor(
                new string[] {
                //   012345678
                "X        X",
                "X  X  X  X",
                "X  X  X  X",
                "XXXX  XXXX",
                "",
            });
            BitmapScanner dut = new BitmapScanner(accessor);

            dut.Scan();
            dut.ComputeNetlists();
            dut.CompactNets();
            dut.MapNetlists();

            for (int netId = 1; netId <= dut.GetNetCount(); netId++)
            {
                Console.WriteLine($"NetId : {netId}");
                foreach (var segment in dut.GetSegmentsOfNet(netId))
                {
                    Console.WriteLine($"    {segment}");
                }
            }
        }
コード例 #3
0
        private bool IsSingleNetlist(BitmapScanner dut)
        {
            var result = true;

            dut.Scan();
            dut.ComputeNetlists();
            foreach (var segment in dut.Segments)
            {
                result &= segment.NetList == 1;
            }

            return(result);
        }