def test_full(self):

        ###
        # slice the self.files list to reduce test time!!!
        ###
        for fn in self.files[:7]:
            print "-> full run - fn: {}".format(fn)
            field = self.construct_field()
            blocks = self.parse_blocks(os.path.join(self.test_data_dir, fn))
            f = self.construct_force_algo_obj(self.field, self.blocks, self.pins)
            cid = fn.split("op")[1].split(".")[0]


            f.step_build(DEBUG)
            f1 = f.get_debug_field()
            fn = draw_field(f1, "schematic_build_{}.pdf".format(cid))

            f.step_initial(DEBUG)
            f2 = f.get_debug_field()
            fn = draw_field(f2, "schematic_init_{}.pdf".format(cid))

            f.step_main(DEBUG)
            f3 = f.get_debug_field()
            fn = draw_field(f3, "schematic_main_{}.pdf".format(cid))

            f.step_last(DEBUG)
            f4 = f.get_debug_field()
            fn = draw_field(f4, "schematic_final_{}.pdf".format(cid))

            # CHECK IF OVERLAPPING BLOCKS WERE FOUND
            overlap = f4.has_overlapping_blocks()
            if overlap:
                print "-"*80
                print "#### FAILED ..... FAILED ..... circ_id: {}".format(cid)
                #f4.show_blocks(sortkey="pos")
                #f4.show_blocks(sortkey="name")
                f4.show_blocks(sortkey=("groups", "pos"))
            else:
                print "-"*80
                print "#### {} ####".format(cid)
                f = f4.to_field()
                f.optimize_size()
                f.optimize_block_dirs()
                #f.expand_field(4)
                r = Routing(f)
                ret = r.route(4)
                fn = draw_field(f, "schematic_real_{}.pdf".format(cid))
示例#2
0
    def test_draw_with_grid(self):
        self.test_field_finalization()

        fn = draw_field(self.field, self.get_tempfile(3), grid=(10, 10, 0, 0, 1))

        self.assertTrue( os.path.isfile(fn) )
        self.assertTrue( os.path.exists(fn) )
        self.assertTrue( len(file(fn).read()) > 10 )
示例#3
0
    def test_draw_without_routing(self):
        self.test_field_finalization()

        fn = draw_field(self.field, self.get_tempfile(2))

        self.assertTrue( os.path.isfile(fn) )
        self.assertTrue( os.path.exists(fn) )
        self.assertTrue( len(file(fn).read()) > 10 )
示例#4
0
    def test_draw_pdf(self):
        self.test_routing()

        fn = draw_field(self.field, self.get_tempfile(1))

        self.assertTrue( os.path.isfile(fn) )
        self.assertTrue( os.path.exists(fn) )
        self.assertTrue( len(file(fn).read()) > 10 )
示例#5
0
    def test_draw_without_routing(self):
        self.test_field_finalization()

        fn = draw_field(self.field, self.get_tempfile(2))

        self.assertTrue(os.path.isfile(fn))
        self.assertTrue(os.path.exists(fn))
        self.assertTrue(len(file(fn).read()) > 10)
示例#6
0
    def test_draw_pdf(self):
        self.test_routing()

        fn = draw_field(self.field, self.get_tempfile(1))

        self.assertTrue(os.path.isfile(fn))
        self.assertTrue(os.path.exists(fn))
        self.assertTrue(len(file(fn).read()) > 10)
示例#7
0
    def test_expansion(self):
        self.test_field_finalization()

        nx, ny = self.field.nx, self.field.ny 
        self.field.expand_field(4)

        fn = draw_field(self.field, self.get_tempfile(4))
        
        self.assertTrue(nx < self.field.nx)
        self.assertTrue(ny < self.field.ny)
示例#8
0
    def test_draw_with_grid(self):
        self.test_field_finalization()

        fn = draw_field(self.field,
                        self.get_tempfile(3),
                        grid=(10, 10, 0, 0, 1))

        self.assertTrue(os.path.isfile(fn))
        self.assertTrue(os.path.exists(fn))
        self.assertTrue(len(file(fn).read()) > 10)
示例#9
0
    def test_expansion(self):
        self.test_field_finalization()

        nx, ny = self.field.nx, self.field.ny
        self.field.expand_field(4)

        fn = draw_field(self.field, self.get_tempfile(4))

        self.assertTrue(nx < self.field.nx)
        self.assertTrue(ny < self.field.ny)
示例#10
0
    def _full_simple(self, fn, nocheck=False):
        field = self.construct_field()
        blocks = self.parse_blocks(os.path.join(self.test_data_dir, fn))
        f = self.construct_force_algo_obj(self.field, self.blocks, self.pins)
        cid = fn.split("op")[1].split(".")[0]

        f.step_build(DEBUG)
        f1 = f.get_debug_field()
        if DEBUG:
            fn = draw_field(f1, "schematic_build_{}.pdf".format(cid))

        f.step_initial(DEBUG)
        f2 = f.get_debug_field()
        if DEBUG:
            fn = draw_field(f2, "schematic_init_{}.pdf".format(cid))

        f.step_main(DEBUG)
        f3 = f.get_debug_field()
        if DEBUG:
            fn = draw_field(f3, "schematic_main_{}.pdf".format(cid))

        f.step_last(DEBUG)
        f4 = f.get_debug_field()
        if DEBUG:
            f4.trim_size()
            fn = draw_field(f4, "schematic_final_{}.pdf".format(cid))

        # CHECK IF OVERLAPPING BLOCKS WERE FOUND
        overlap = f4.has_overlapping_blocks()
        if overlap:
            f4.show_blocks(sortkey=("groups", "pos"))
            f4.trim_size()
            draw_field(f4, "schematic_final_{}.pdf".format(cid))
        else:
            try:
                f = f4.to_field()
                f.optimize_size()
                f.optimize_block_dirs()
                r = Routing(f)
                ret = r.route(4)
                fn = draw_field(f, "schematic_real_{}.pdf".format(cid))
            except RoutingException as e:
                if not nocheck:
                    print "failed with circuit {}".format(cid)
                    print "continuing due to 'nocheck' == True"
                else:
                    raise e


        if not nocheck:
            self.assertFalse(overlap, "Found overlapping blocks!")
示例#11
0
    def _full_simple(self, fn, nocheck=False):
        field = self.construct_field()
        blocks = self.parse_blocks(os.path.join(self.test_data_dir, fn))
        f = self.construct_force_algo_obj(self.field, self.blocks, self.pins)
        cid = fn.split("op")[1].split(".")[0]

        f.step_build(DEBUG)
        f1 = f.get_debug_field()
        if DEBUG:
            fn = draw_field(f1, "schematic_build_{}.pdf".format(cid))

        f.step_initial(DEBUG)
        f2 = f.get_debug_field()
        if DEBUG:
            fn = draw_field(f2, "schematic_init_{}.pdf".format(cid))

        f.step_main(DEBUG)
        f3 = f.get_debug_field()
        if DEBUG:
            fn = draw_field(f3, "schematic_main_{}.pdf".format(cid))

        f.step_last(DEBUG)
        f4 = f.get_debug_field()
        if DEBUG:
            f4.trim_size()
            fn = draw_field(f4, "schematic_final_{}.pdf".format(cid))

        # CHECK IF OVERLAPPING BLOCKS WERE FOUND
        overlap = f4.has_overlapping_blocks()
        if overlap:
            f4.show_blocks(sortkey=("groups", "pos"))
            f4.trim_size()
            draw_field(f4, "schematic_final_{}.pdf".format(cid))
        else:
            try:
                f = f4.to_field()
                f.optimize_size()
                f.optimize_block_dirs()
                r = Routing(f)
                ret = r.route(4)
                fn = draw_field(f, "schematic_real_{}.pdf".format(cid))
            except RoutingException as e:
                if not nocheck:
                    print "failed with circuit {}".format(cid)
                    print "continuing due to 'nocheck' == True"
                else:
                    raise e

        if not nocheck:
            self.assertFalse(overlap, "Found overlapping blocks!")