📄 romgenerator.java
字号:
appos3 = getCStylePortPosition(ap3, apport3); makeCStyleArcInst(m2arc, 4*lambda, ap1, apport1, appos1[0], appos1[1], ap2, apport2, appos2[0], appos2[1]); makeCStyleArcInst(m2arc, 4*lambda, ap3, apport3, appos3[0], appos3[1], ap2, apport2, appos2[0], appos2[1]); //////// connect mux decoder to inverter vdd ap1 = invpln; apport1 = invvddc; appos1 = getCStylePortPosition(ap1, apport1); ap2 = ininvbot2; apport2 = ivbvdd; appos2 = getCStylePortPosition(ap2, apport2); makeCStyleArcInst(m2arc, 4*lambda, ap1, apport1, appos1[0], appos1[1], ap2, apport2, appos2[0], appos2[1]); } // end (folds > 1) // begin (folds == 1) if (folds == 1) { for (int i=0; i<romarray.length; i++) { ap1 = invpln; apport1 = invin[i]; appos1 = getCStylePortPosition(ap1, apport1); ap2 = rompln; apport2 = rompout[i]; appos2 = getCStylePortPosition(ap2, apport2); makeCStyleArcInst(m1arc, 4*lambda, ap1, apport1, appos1[0], appos1[1], ap2, apport2, appos2[0], appos2[1]); } // connect vdd of decoderpmos to vdd of inverterplane NodeProto m1m2c = tech.findNodeProto("Metal-1-Metal-2-Con"); PortProto m1m2cport = m1m2c.getPort(0); double[] m1m2cbox = {-5*lambda/2, 5*lambda/2, -5*lambda/2, 5*lambda/2}; double vddoffsetx = offset - 4*lambda; double vddoffsety = invpoffsety - 26*lambda; NodeInst vddbot = makeCStyleNodeInst(m1m2c, m1m2cbox[0]+vddoffsetx, m1m2cbox[1]+vddoffsetx, m1m2cbox[2]+vddoffsety, m1m2cbox[3]+vddoffsety, 0, 0, rom); ap1 = invpln; apport1 = invvddc; appos1 = getCStylePortPosition(ap1, apport1); ap2 = vddbot; apport2 = m1m2cport; appos2 = getCStylePortPosition(ap2, apport2); ap3 = pplane; apport3 = decpvddb; appos3 = getCStylePortPosition(ap3, apport3); makeCStyleArcInst(m2arc, 4*lambda, ap1, apport1, appos1[0], appos1[1], ap2, apport2, appos2[0], appos2[1]); makeCStyleArcInst(m1arc, 4*lambda, ap2, apport2, appos2[0], appos2[1], ap3, apport3, appos3[0], appos3[1]); } // return the top-level return rom; } /** */ private static void romplane(Library destLib, double lambda, int romarray[][], String rp) { int i, m; double x, y; NodeInst ap1, ap2, ap3, ap4, gnd1, gnd2, intgnd; PortProto apport1, apport2, apport3, apport4, gndport1, gndport2, intgndport; double[] appos1, appos2, appos3, appos4, gndpos1, gndpos2, intgndpos; int inputs = romarray[0].length; int wordlines = romarray.length; NodeInst[][] andtrans = new NodeInst[wordlines+2][inputs+2]; NodeInst[] pulluptrans = new NodeInst[wordlines+2]; NodeInst[] nwellc = new NodeInst[(wordlines+2)/2]; NodeInst[][] minpins = new NodeInst[wordlines+2][inputs+2]; NodeInst[][] diffpins = new NodeInst[wordlines+2][inputs+2]; NodeInst[][] gndpins = new NodeInst[wordlines/2][inputs+2]; NodeInst[] gnd_2pins = new NodeInst[wordlines/2]; NodeInst[] m1polypins = new NodeInst[inputs+2]; NodeInst[] m1m2pins = new NodeInst[inputs+2]; NodeInst[] m1m2_2pins = new NodeInst[wordlines+2]; NodeInst[] m1m2_3pins = new NodeInst[wordlines+2]; NodeInst[] m1m2_4pins = new NodeInst[wordlines+2]; NodeInst[] mpac_1pins = new NodeInst[wordlines+2]; NodeInst[] mpac_2pins = new NodeInst[wordlines+2]; NodeInst gndpex[] = new NodeInst[1]; NodeInst gndm1ex[] = new NodeInst[1]; NodeInst gnd1pin = null; NodeInst vdd2pin = null; PortProto[] nwellcports = new PortProto[(wordlines+2)/2]; PortProto[][] minports = new PortProto[wordlines+2][inputs+2]; PortProto[][] gndports = new PortProto[wordlines/2][inputs+2]; PortProto[] gnd_2ports = new PortProto[wordlines/2]; PortProto[] m1m2_2ports = new PortProto[wordlines+2]; PortProto[] m1m2_3ports = new PortProto[wordlines+2]; PortProto[] m1m2_4ports = new PortProto[wordlines+2]; PortProto[] mpac_1ports = new PortProto[wordlines+2]; PortProto[] mpac_2ports = new PortProto[wordlines+2]; PortProto gndpexport[] = new PortProto[1]; PortProto gndm1export[] = new PortProto[1]; PortProto gnd1port = null; PortProto vdd2port = null; // get pointers to primitives NodeProto nmos = tech.findNodeProto("N-Transistor"); PortProto nmosg1port = nmos.findPortProto("n-trans-poly-right"); PortProto nmosg2port = nmos.findPortProto("n-trans-poly-left"); PortProto nmosd1port = nmos.findPortProto("n-trans-diff-top"); PortProto nmosd2port = nmos.findPortProto("n-trans-diff-bottom"); double[] nmosbox = {-nmos.getDefWidth()/2-lambda/2, nmos.getDefWidth()/2+lambda/2, -nmos.getDefHeight()/2, nmos.getDefHeight()/2}; NodeProto pmos = tech.findNodeProto("P-Transistor"); PortProto pmosg1port = pmos.findPortProto("p-trans-poly-right"); PortProto pmosg2port = pmos.findPortProto("p-trans-poly-left"); PortProto pmosd1port = pmos.findPortProto("p-trans-diff-top"); PortProto pmosd2port = pmos.findPortProto("p-trans-diff-bottom"); double bbb = 15; double ccc = 23; double[] pmosbox = {-bbb*lambda/2, bbb*lambda/2, -ccc*lambda/2, ccc*lambda/2}; NodeProto ppin = tech.findNodeProto("Polysilicon-1-Pin"); PortProto ppinport = ppin.getPort(0); double[] ppinbox = {-ppin.getDefWidth()/2, ppin.getDefWidth()/2, -ppin.getDefHeight()/2, ppin.getDefHeight()/2}; NodeProto m1pin = tech.findNodeProto("Metal-1-Pin"); PortProto m1pinport = m1pin.getPort(0); double[] m1pinbox = {-m1pin.getDefWidth()/2-lambda/2, m1pin.getDefWidth()/2+lambda/2, -m1pin.getDefHeight()/2-lambda/2, m1pin.getDefHeight()/2+lambda/2}; NodeProto m2pin = tech.findNodeProto("Metal-2-Pin"); PortProto m2pinport = m2pin.getPort(0); double[] m2pinbox = {-m2pin.getDefWidth()/2-lambda/2, m2pin.getDefWidth()/2+lambda/2, -m2pin.getDefHeight()/2-lambda/2, m2pin.getDefHeight()/2+lambda/2}; NodeProto diffpin = tech.findNodeProto("Active-Pin"); PortProto diffpinport = diffpin.getPort(0); double[] diffpinbox = {-diffpin.getDefWidth()/2-lambda/2, diffpin.getDefWidth()/2+lambda/2, -diffpin.getDefHeight()/2-lambda/2, diffpin.getDefHeight()/2+lambda/2}; NodeProto nwnode = tech.findNodeProto("N-Well-Node"); NodeProto pwnode = tech.findNodeProto("P-Well-Node"); NodeProto psnode = tech.findNodeProto("P-Select-Node"); NodeProto mnac = tech.findNodeProto("Metal-1-N-Active-Con"); PortProto mnacport = mnac.getPort(0); double aaa = 17; double[] mnacbox = {-aaa*lambda/2, aaa*lambda/2, -aaa*lambda/2, aaa*lambda/2}; NodeProto mpac = tech.findNodeProto("Metal-1-P-Active-Con"); PortProto mpacport = mpac.getPort(0); double[] mpacbox = {-aaa*lambda/2, aaa*lambda/2, -aaa*lambda/2, aaa*lambda/2}; NodeProto mpwc = tech.findNodeProto("Metal-1-P-Well-Con"); PortProto mpwcport = mpwc.getPort(0); double[] mpwcbox = {-17*lambda/2, 17*lambda/2, -17*lambda/2, 17*lambda/2}; NodeProto mnwc = tech.findNodeProto("Metal-1-N-Well-Con"); PortProto mnwcport = mnwc.getPort(0); double nwellx = 29; double nwelly = 17; double[] mnwcbox ={-nwellx*lambda/2,nwellx*lambda/2,-nwelly*lambda/2,nwelly*lambda/2}; NodeProto mpc = tech.findNodeProto("Metal-1-Polysilicon-1-Con"); PortProto mpcport = mpc.getPort(0); double mx = 5; double[] mpcbox = {-mx*lambda/2, mx*lambda/2, -mx*lambda/2, mx*lambda/2}; NodeProto m1m2c = tech.findNodeProto("Metal-1-Metal-2-Con"); PortProto m1m2cport = m1m2c.getPort(0); double[] m1m2cbox = {-mx*lambda/2, mx*lambda/2, -mx*lambda/2, mx*lambda/2}; NodeProto nsnode = tech.findNodeProto("N-Select-Node"); ArcProto parc = tech.findArcProto("Polysilicon-1"); ArcProto m1arc = tech.findArcProto("Metal-1"); ArcProto m2arc = tech.findArcProto("Metal-2"); ArcProto ndiffarc = tech.findArcProto("N-Active"); ArcProto pdiffarc = tech.findArcProto("P-Active"); // create a cell called "romplane{lay}" in the destination library Cell romplane = Cell.newInstance(destLib, rp+"{lay}"); makeCStyleNodeInst(pwnode,-4*lambda,(8*lambda*(inputs+2)), -4*lambda,3*8*lambda*(wordlines)/2,0,0,romplane); double ptranssize = 20; makeCStyleNodeInst(psnode,-28*lambda,(ptranssize-28)*lambda,4*lambda, (4+3*8*wordlines/2)*lambda,0,0,romplane); makeCStyleNodeInst(nsnode,0*lambda,(8*lambda*inputs),4*lambda, (4+3*8*wordlines/2)*lambda,0,0,romplane); makeCStyleNodeInst(nwnode,-38*lambda,(ptranssize-38)*lambda,20*lambda, (4+3*8*wordlines/2)*lambda,0,0,romplane); // Create instances of objects on rom plane x = 0; for (i=0; i<inputs+1; i++) { x += 8*lambda; y = 0; if (i < inputs) { andtrans[0][i] = makeCStyleNodeInst(ppin, ppinbox[0]+x, ppinbox[1]+x, ppinbox[2], ppinbox[3], 0, 0, romplane); m1polypins[i] = makeCStyleNodeInst(mpc, mpcbox[0]+x, mpcbox[1]+x, mpcbox[2], mpcbox[3], 0, 0, romplane); m1m2pins[i] = makeCStyleNodeInst(m1m2c, m1m2cbox[0]+x, m1m2cbox[1]+x, m1m2cbox[2], m1m2cbox[3], 0, 0, romplane); ap1 = m1m2pins[i]; apport1 = m1m2cport; makeCStyleExport(romplane, ap1, apport1, "wordline_"+(inputs-i-1), PortCharacteristic.IN); } for (m=0; m<wordlines; m++) { y += 8*lambda; if (m%2 == 1) { if (i%2 == 1) { gndpins[m/2][i] = makeCStyleNodeInst(mnac, mnacbox[0]+x-4*lambda, mnacbox[1]+x-4*lambda, mnacbox[2]+y, mnacbox[3]+y, 0, 0, romplane); gndports[m/2][i] = mnacport; } else { if (i == inputs) { gndpins[m/2][i] = makeCStyleNodeInst(mpwc, mpwcbox[0]+x-4*lambda, mpwcbox[1]+x-4*lambda, mpwcbox[2]+y, mpwcbox[3]+y, 0, 0, romplane); gndports[m/2][i] = mpwcport; } else { gndpins[m/2][i] = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-4*lambda, m1pinbox[1]+x-4*lambda, m1pinbox[2]+y, m1pinbox[3]+y, 0, 0, romplane); gndports[m/2][i] = m1pinport; } } if (i == 0) { gnd_2pins[m/2] = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-12*lambda, m1pinbox[1]+x-12*lambda, m1pinbox[2]+y, m1pinbox[3]+y, 0, 0, romplane); gnd_2ports[m/2] = m1pinport; if (m == 1) { gndm1ex[m/2] = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-12*lambda, m1pinbox[1]+x-12*lambda, m1pinbox[2]+y-16*lambda, m1pinbox[3]+y-16*lambda, 0, 0, romplane); gndm1export[m/2] = m1pinport; gnd1pin = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-8*lambda, m1pinbox[1]+x-8*lambda, m1pinbox[2]+y-16*lambda, m1pinbox[3]+y-16*lambda, 0, 0, romplane); gnd1port = m1pinport; vdd2pin = makeCStyleNodeInst(m2pin, m2pinbox[0]+x-32*lambda, m2pinbox[1]+x-32*lambda, m2pinbox[2]+y-16*lambda, m2pinbox[3]+y-16*lambda, 0, 0, romplane); vdd2port = m2pinport; } } y+= 8*lambda; } if (i < inputs) { if (romarray[m][i] == 1) { // create a transistor andtrans[m+1][i] = makeCStyleNodeInst(nmos, nmosbox[0]+x, nmosbox[1]+x, nmosbox[2]+y, nmosbox[3]+y,1,0,romplane); } else { andtrans[m+1][i] = makeCStyleNodeInst(ppin, ppinbox[0]+x, ppinbox[1]+x, ppinbox[2]+y,ppinbox[3]+y,0,0,romplane); } } boolean transcont = false; if (i < inputs) transcont = (romarray[m][i] == 1); if (i > 1) transcont |= (romarray[m][i-1] == 1); if (i%2 == 0 && transcont) { minpins[m][i] = makeCStyleNodeInst(mnac, mnacbox[0]+x-4*lambda, mnacbox[1]+x-4*lambda, mnacbox[2]+y, mnacbox[3]+y, 0, 0, romplane); diffpins[m][i] = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-4*lambda, m1pinbox[1]+x-4*lambda, m1pinbox[2]+y, m1pinbox[3]+y, 0, 0, romplane); minports[m][i] = mnacport; } else { minpins[m][i] = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-4*lambda, m1pinbox[1]+x-4*lambda, m1pinbox[2]+y, m1pinbox[3]+y, 0, 0, romplane); if ((transcont) || ((i==1) && (romarray[m][0] == 1))) { diffpins[m][i] = makeCStyleNodeInst(diffpin, diffpinbox[0]+x-4*lambda, diffpinbox[1]+x-4*lambda, diffpinbox[2]+y, diffpinbox[3]+y, 0, 0, romplane); } else { diffpins[m][i] = makeCStyleNodeInst(m1pin, m1pinbox[0]+x-4*lambda, m1pinbox[1]+x-4*lambda,m1pinbox[2]+y,m1pinbox[3]+y, 0, 0, romplane); } minports[m][i] = m1pinport; } if (i == inputs) { ap1 = minpins[m][i]; apport1 = minports[m][i]; makeCStyleExport(romplane, ap1, apport1, "out_"+m, PortCharacteristic.OUT); } if (i == 0) { if (m%2 == 1) { nwellc[m/2] = makeCStyleNodeInst(mnwc, m1m2cbox[0]+x-46*lambda, mnwcbox[1]+x-46*lambda, mnwcbox[2]+y, mnwcbox[3]+y, 0, 0, romplane); nwellcports[m/2] = mnwcport; } m1m2_2pins[m] = makeCStyleNodeInst(m1m2c, m1m2cbox[0]+x-4*lambda, m1m2cbox[1]+x-4*lambda, m1m2cbox[2]+y, m1m2cbox[3]+y, 0, 0, romplane); m1m2_2ports[m] = m1m2cport; m1m2_3pins[m] = makeCStyleNodeInst(m1m2c, m1m2cbox[0]+x-20*lambda, m1m2cbox[1]+x-20*lambda, m1m2cbox[2]+y, m1m2cbox[3]+y, 0, 0, romplane); m1m2_3ports[m] = m1m2cport; mpac_1pins[m] = makeCStyleNodeInst(mpac, mpacbox[0]+x-20*lambda, mpacbox[1]+x-20*lambda, mpacbox[2]+y, mpacbox[3]+y, 0, 0, romplane); mpac_1ports[m] = mpacport; pulluptrans[m] = makeCStyleNodeInst(pmos, pmosbox[0]+x-26*lambda, pmosbox[1]+x-26*lambda, pmosbox[2]+y, pmosbox[3]+y, 1, 0, romplane); mpac_2pins[m] = makeCStyleNodeInst(mpac, mpacbox[0]+x-32*lambda, mpacbox[1]+x-32*lambda, mpacbox[2]+y, mpacbox[3]+y, 0, 0, romplane); mpac_2ports[m] = mpacport; m1m2_4pins[m] = makeCStyleNodeInst(m1m2c, m1m2cbox[0]+x-32*lambda, m1m2cbox[1]+x-32*lambda, m1m2cbox[2]+y, m1m2cbox[3]+y, 0, 0, romplane); m1m2_4ports[m] = m1m2cport; if (m == 0) { gndpex[m] = makeCStyleNodeInst(mpc, mpcbox[0]+x-26*lambda, mpcbox[1]+x-26*lambda, mpcbox[2]+y-8*lambda,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -