def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen(Wire(nm='m2', layer='M2', direction='h', clg=None, spg=None)) m2 = p['M2'] m2['AdjacentAttacker'] = 1 assert 'Width' in m2 dy = m2['Width'] // 2 py = m2['Pitch'] c.terminals = [{ 'layer': 'M2', 'netName': 'x', 'rect': [0, 0 * py - dy, 200, 0 * py + dy] }, { 'layer': 'M2', 'netName': 'y', 'rect': [200, 1 * py - dy, 400, 1 * py + dy] }] return c
def test_canvas_three(): def _helper(c): c.addWire(c.m1, 'a', None, 1, (1, -1), (6, 1)) c.addWire(c.m3, 'a', None, 2, (1, -1), (6, 1)) c.addWire(c.m5, 'a', None, 3, (1, -1), (6, 1)) c.addWire(c.m2, 'a', None, 1, (1, -1), (3, 1)) c.addWire(c.m4, 'a', None, 2, (1, -1), (3, 1)) c.addWire(c.m6, 'a', None, 3, (1, -1), (3, 1)) c.addVia(c.v1, 'a', None, 1, 1) c.addVia(c.v2, 'a', None, 2, 1) c.addVia(c.v3, 'a', None, 2, 2) c.addVia(c.v4, 'a', None, 3, 2) c.addVia(c.v5, 'a', None, 3, 3) c.computeBbox() c1 = CanvasPDK() _helper(c1) c1.gen_data(run_drc=True) assert c1.drc.num_errors == 0 c2 = DefaultCanvas(Pdk().load(layers_json)) _helper(c2) c2.gen_data(run_drc=True) assert c2.drc.num_errors == 0 export_to_viewer("test_canvas_3_c1", c1) export_to_viewer("test_canvas_3_c2", c2) d1 = {'bbox': c1.bbox.toList(), 'globalRoutes': [], 'globalRouteGrid': [], 'terminals': c1.removeDuplicates(allow_opens=True)} d2 = {'bbox': c2.bbox.toList(), 'globalRoutes': [], 'globalRouteGrid': [], 'terminals': c2.removeDuplicates(allow_opens=True)} assert d1 == d2
def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen(Wire(nm='m1', layer='M1', direction='v', clg=None, spg=None)) c.addGen(Wire(nm='m2', layer='M2', direction='h', clg=None, spg=None)) c.addGen(Via(nm="v1", layer="V1", h_clg=None, v_clg=None)) return c
def test_m3(): p = Pdk().load(pdkfile) c = DefaultCanvas(p) m = c.generators['m3'] mt = MetalTemplate(m) print("m3 clg grid", m.clg.grid, "m3 clg legal indices", m.clg.legalIndices) print("m3 spg grid", m.spg.grid, "m3 spg legal indices", m.spg.legalIndices) assert 1 in m.spg.legalIndices assert 3 in m.spg.legalIndices ### The following assertions are modified based on the updtaed PDK assert m.spg.grid[1][0] == 36 assert m.spg.grid[3][0] == 48 assert mt.widths == [40, 40, 40] assert mt.colors == ["c1", "c2", "c1"] assert mt.spaces == [40, 40] assert mt.offset == 0 assert mt.stop_offset == 36 assert mt.stops == [12, 72]
def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen(Wire(nm='m1', layer='M1', direction='v', clg=None, spg=None)) c.addGen(Wire(nm='m2', layer='M2', direction='h', clg=None, spg=None)) c.addGen(Via(nm="v1", layer="V1", h_clg=None, v_clg=None)) m1 = p['M1'] v1 = p['V1'] m2 = p['M2'] assert 'Width' in m1 assert 'Width' in m2 assert 'VencA_L' in v1 assert 'VencA_H' in v1 assert 'VencP_L' in v1 assert 'VencP_H' in v1 assert 'WidthX' in v1 assert 'WidthY' in v1 assert 'MinL' in m1 assert 'MinL' in m2 assert m1['MinL'] <= 200 assert m2['MinL'] <= 200 def cr(x, y): assert x % 2 == 0 assert y % 2 == 0 return [-x // 2, -y // 2, x // 2, y // 2] c.terminals = [{ 'layer': 'M1', 'netName': 'x', 'rect': cr(m1['Width'], v1['WidthY'] + 2 * v1['VencA_L']), "netType": "drawing" }, { 'layer': 'M2', 'netName': 'x', 'rect': cr(v1['WidthX'] + 2 * v1['VencA_H'], m2['Width']), "netType": "drawing" }, { 'layer': 'V1', 'netName': 'x', 'rect': cr(v1['WidthX'], v1['WidthY']), "netType": "drawing" }] return c
def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen(Wire(nm='m2', layer='M2', direction='h', clg=None, spg=None)) m2 = p['M2'] assert 'Width' in m2 assert m2['Width'] % 2 == 0 dy0 = m2['Width'] // 2 dy1 = dy0 + 4 return c, dy0, dy1
def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen(Wire(nm='m2', layer='M2', direction='h', clg=None, spg=None)) c.addGen(Wire(nm='m3', layer='M3', direction='v', clg=None, spg=None)) c.addGen(Via(nm="v2", layer="V2", h_clg=None, v_clg=None)) m2 = p['M2'] v2 = p['V2'] m3 = p['M3'] assert 'Width' in m2 assert 'Width' in m3 assert 'VencA_L' in v2 assert 'VencA_H' in v2 assert 'VencP_L' in v2 assert 'VencP_H' in v2 assert 'WidthX' in v2 assert 'WidthY' in v2 assert 'MinL' in m2 assert 'MinL' in m3 assert m2['MinL'] <= 210 assert m3['MinL'] <= 210 def cr(x, y): assert x % 2 == 0 assert y % 2 == 0 return [-x // 2, -y // 2, x // 2, y // 2] c.terminals = [{ 'layer': 'M2', 'netName': 'x', 'rect': cr(v2['WidthX'] + 2 * v2['VencA_L'], m2['Width']) }, { 'layer': 'M3', 'netName': 'x', 'rect': cr(m3['Width'], v2['WidthY'] + 2 * v2['VencA_H']) }, { 'layer': 'V2', 'netName': 'x', 'rect': cr(v2['WidthX'], v2['WidthY']) }] return c
def setup(): p = Pdk().load(pdkfile) c = DefaultCanvas(p) return c
def setup(): p = Pdk().load(pdkfile) c = Canvas(p) c.addGen(Wire(nm='m2', layer='M2', direction='h', clg=None, spg=None)) return c, p
def test_one(): p = Pdk().load(pdkfile) c = DefaultCanvas(p) assert c.generate_routing_collateral(mydir / "routing_collateral_cand")
def setup(): p = Pdk() p.pdk['M2'] = { 'Direction': 'H', 'Width': 60, 'Pitch': 100, 'MinL': 10, 'EndToEnd': 10 } p.pdk['M3'] = { 'Direction': 'V', 'Width': 50, 'Pitch': 100, 'MinL': 10, 'EndToEnd': 10 } # # Adjacent via violation # ***** ***** # ^ ^ # WidthX + SpaceX > Pitch(X) # # Both okay below # p.pdk['V2'] = { 'Stack': ['M2', 'M3'], 'WidthX': 50, 'WidthY': 60, 'SpaceX': 50, 'SpaceY': 40, 'VencA_L': 0, 'VencA_H': 0, 'VencP_L': 0, 'VencP_H': 0 } c = Canvas(p) m2 = c.addGen( Wire(nm='m2', layer='M2', direction='h', clg=UncoloredCenterLineGrid(width=p['M2']['Width'], pitch=p['M2']['Pitch']), spg=EnclosureGrid(pitch=p['M3']['Pitch'], stoppoint=p['M3']['Pitch'] // 2))) m3 = c.addGen( Wire(nm='m3', layer='M3', direction='v', clg=UncoloredCenterLineGrid(width=p['M3']['Width'], pitch=p['M3']['Pitch']), spg=EnclosureGrid(pitch=p['M2']['Pitch'], stoppoint=p['M2']['Pitch'] // 2))) v2 = c.addGen(Via(nm='v2', layer='V2', h_clg=m2.clg, v_clg=m3.clg)) n = 40 gridlines = list(range(n)) for i in gridlines: c.addWire(m3, 'a', None, i, (0, 1), (n + 1, -1)) for j in gridlines: c.addWireAndViaSet('a', None, m2, v2, j + 1, gridlines) return c, n
def __init__(self): pdk = Pdk().load(my_dir / 'layers.json') # backward compatibility super().__init__(pdk) self._define_pdk() self._add_generators()