示例#1
0
def test_m2_and_m3():
    c = Canvas()

    m1 = c.addGen( Wire( nm='m1', layer='M1', direction='v',
                         clg=UncoloredCenterLineGrid( width=400, pitch=720, repeat=2),
                         spg=EnclosureGrid( pitch=720, stoppoint=360)))

    m2 = c.addGen( Wire( nm='m2', layer='M2', direction='h',
                         clg=UncoloredCenterLineGrid( width=400, pitch=720, repeat=5),
                         spg=EnclosureGrid( pitch=720, stoppoint=360)))

    m3 = c.addGen( Wire( nm='m3', layer='M3', direction='v',
                         clg=UncoloredCenterLineGrid( width=400, pitch=720, repeat=2),
                         spg=EnclosureGrid( pitch=720, stoppoint=360)))

    v1 = c.addGen( Via( nm='v1', layer='via1', h_clg=m2.clg, v_clg=m1.clg))
    v2 = c.addGen( Via( nm='v2', layer='via2', h_clg=m2.clg, v_clg=m3.clg))

    for i in [0,2,4]:
        c.addWire( m1, 'a', None, i, (0,1), (4,-1)) 

    for i in [1,3,5]:
        c.addWire( m1, 'b', None, i, (0,1), (4,-1)) 

    c.addWireAndViaSet( 'b', None, m2, v1, 3, [(0,1), (1,1), (2,1)])
    c.addWireAndViaSet( 'a', None, m2, v1, 2, [(0,0), (1,0), (2,0)])
    c.addWireAndMultiViaSet( 'b', None, m2, 1, [(v1, [(0,1), (1,1)]), (v2, [(2,1)])])

    c.addWireAndViaSet( 'b', None, m3, v2, (2,1), [1,3])


    print( c.terminals)

    c.computeBbox()

    fn = "tests/__json_via_set_m2_m3"

    data = { 'bbox' : c.bbox.toList(),
             'globalRoutes' : [],
             'globalRouteGrid' : [],
#             'terminals' : c.terminals}
             'terminals' : c.removeDuplicates()}

    with open( fn + "_cand", "wt") as fp:
        fp.write( json.dumps( data, indent=2) + '\n')

    with open( fn + "_gold", "rt") as fp:
        data2 = json.load( fp)

        assert data == data2
示例#2
0
def test_cunit():
    c = Canvas()

    for (x, y) in ((x, y) for x in range(16) for y in range(4)):
        c.cunit(x, y)

    c.computeBbox()

    with open("mydesign_dr_globalrouting.json", "wt") as fp:
        data = {
            'bbox': c.bbox.toList(),
            'globalRoutes': [],
            'globalRouteGrid': [],
            'terminals': c.terminals
        }
        fp.write(json.dumps(data, indent=2) + '\n')