public List<ContactSimple> ReturnAllWaveProcess(List<ContactSimple> inStart, NodePointProcess pntProcess) { string currentName = layoutMap[inStart[0].x][inStart[0].y][inStart[0].layer].name; List<ContactSimple> nextPoints = new List<ContactSimple>();//inStart.GetArroundPoints(wide); nextPoints.AddRange(inStart); List<ContactSimple> arround = new List<ContactSimple>(); List<ContactSimple> passedPoints = new List<ContactSimple>(); if (diffusionException.FindIndex(el => el == currentName) >= 0) { List<ContactSimple> thisWave = SetOneWave(nextPoints, passedPoints, pntProcess, currentName); SetOneWave(thisWave, passedPoints, pntProcess, currentName); nextPoints.AddRange(thisWave); passedPoints.AddRange(thisWave); } passedPoints.AddRange(inStart); do { arround.Clear(); foreach (ContactSimple cntOneLay in nextPoints) { foreach (int layer in Params.allLayersRange[cntOneLay.layer])//GetOppositeLayers(cntOneLay.layer)) { ContactSimple cnt = new ContactSimple(cntOneLay, layer); if ( IsPointsConnected(cnt, cntOneLay.layer, layer, currentName) )//GetPoint(cnt).name == currentName) { foreach (ContactSimple cntNebor in cnt.GetArroundPoints(wide)) { if ( (GetPoint(cntNebor).name == currentName) && (passedPoints.FindIndex(el => el == cntNebor) < 0) && (arround.FindIndex(el => el == cntNebor) < 0) ) { NodePoint pn1 = GetPoint(cntNebor); NodePoint pn2 = GetPoint(cntOneLay); if ( pn1.numberNode != pn2.numberNode) pn1 = GetPoint(cntNebor); arround.Add(cntNebor); } /*{ if ((cntNebor.layer != cntOneLay.layer) && (cntNebor.layer == Layers.siliconTrace || cntOneLay.layer == Layers.siliconTrace) && (GetPoint(cntNebor, Layers.contactTrace).name == Material.diffusionName) ) ; else { NodePoint pn1 = GetPoint(cntNebor); NodePoint pn2 = GetPoint(cntOneLay); if ( pn1.numberNode != pn2.numberNode) pn1 = GetPoint(cntNebor); if ( cntNebor.x == 31 && (cntNebor.y == 21 || cntNebor.y == 22) && cntNebor.layer == 1) pn1 = GetPoint(cntNebor); arround.Add(cntNebor); } }*/ } if (GetPoint(cnt).isSource) { NodePoint np2 = GetPoint(cnt); if (cnt.x == 19 && cnt.y == 33 && cnt.layer == 1) np2 = GetPoint(cnt); foreach (ContactSimple cntNebor in GetSourceContacts(cnt, currentName)) { NodePoint np1 = GetPoint(cntNebor); if (cnt.x == 19 && cnt.y == 33 && cnt.layer == 1) np1 = GetPoint(cntNebor); if ( GetPoint(cntNebor).isSource && (GetPoint(cntNebor).name == currentName) && (passedPoints.FindIndex(el => el == cntNebor) < 0) && (arround.FindIndex(el => el == cntNebor) < 0) )//&& FindSource(cnt) && FindSource(cntNebor) ) { NodePoint pn1 = GetPoint(cntNebor); NodePoint pn2 = GetPoint(cntOneLay); if ( pn1.numberNode != pn2.numberNode) pn1 = GetPoint(cntNebor); arround.Add(cntNebor); } } } } } } nextPoints.Clear(); nextPoints.AddRange(arround); passedPoints.AddRange(arround); pntProcess.IncrementNumber(); bool continueMark = false; do { List<ContactSimple> wave = SetOneWave(arround, passedPoints, pntProcess, currentName); nextPoints.AddRange(wave); passedPoints.AddRange(wave); arround = wave; continueMark = false; if (wave.Count > 0) continueMark = true; } while (continueMark); //passedPoints.AddRange(nextPoints); /*if (cntUnit.x == 14 && cntUnit.y == 5 && cntUnit.layer == Layers.siliconTrace) b = true;*/ } while (nextPoints.Count > 0); NodePoint np3 = GetPoint(inStart[0]); foreach(ContactSimple cnt in passedPoints) { if (cnt.x == 35 && cnt.y == 37 && cnt.layer == 1) np3 = GetPoint(cnt); } return passedPoints; }
private void SetNextCont_old(PairInt inChanged, int layerChanged, NodePoint inSample) { bool b = false; if (inChanged.x == 33 && (inChanged.y == 16 || inChanged.y == 18) && layerChanged == Layers.metal1Trace && inSample.name != "N6859613") b = false; if (inSample.name == Material.blankName) return; layoutMap[inChanged.x][inChanged.y][layerChanged].isReplace = false; layoutMap[inChanged.x][inChanged.y][layerChanged].name = inSample.name; layoutMap[inChanged.x][inChanged.y][layerChanged].numberNode = inSample.numberNode; layoutMap[inChanged.x][inChanged.y][layerChanged].priority = inSample.priority; layoutMap[inChanged.x][inChanged.y][layerChanged].number = inSample.number; string curName = inSample.name; ContactSimple curPoint = new ContactSimple(inChanged, layerChanged); List<ContactSimple> cntArround = curPoint.GetArroundPoints(wide); List<PairInt> cntArea = inChanged.GetBigArround(wide); cntArea.Add(inChanged); foreach (ContactSimple cntUnit in cntArround) { string unitName = GetPoint(cntUnit).name; if (unitName != curName && unitName!= Material.blankName && unitName != Material.diffusionName) { if (cntUnit.x == 33 && (cntUnit.y == 16 || cntUnit.y == 18) && cntUnit.layer == Layers.metal1Trace) b = false; SetContact(cntUnit, Material.blankName, 0, 0, -1); //cntAdded.Add(cntUnit); if (GetPoint(cntUnit).isSource) { foreach (ContactSimple smp in GetSourceContacts(cntUnit, curName)) if (smp != cntUnit) cntArea.Add(smp); //cntArea.Add(GetSourceContacts //GetNearSource(cntUnit)); } foreach (ContactSimple cnt in cntUnit.GetNeborPoints(wide)) { string bn = GetPoint(cnt).name; if (cnt.x == 38 && cnt.y == 14 && cnt.layer == 1 && bn != Material.blankName) b = false; if ((GetPoint(cnt).name != curName) && (cntArea.FindIndex(el => el == cnt) < 0)) cntArea.Add(cnt); } } } foreach (PairInt cntUnit in cntArea) { foreach (int lay in Params.LayersRange[layerChanged]) { layoutMap[cntUnit.x][cntUnit.y][lay].isReplace = CheckNebors(new ContactSimple(cntUnit, lay)); } } }
/*private bool SetOneOfBest_old(PairInt inCnt, int inLayer, NodePoint inSample) { bool noLayer = false; int sourceBest = 0; ContactSimple simple = new ContactSimple(inCnt, inLayer); List<ContactSimple> arround = simple.GetArroundPoints(wide); foreach (ContactSimple cntArround in arround) { NodePoint pn = GetPoint(cntArround); if ((GetPoint(cntArround).name != inSample.name) && (!GetPoint(cntArround).isReplace) && (GetPoint(cntArround).name != Material.diffusionName)) noLayer = true; if (!noLayer && GetPoint(cntArround).isSource && (GetPoint(cntArround).name != inSample.name)) sourceBest++; } int sourseCount = 0; if ((sourceBest > 1) && (diffusionExeption.FindIndex(el => el == inSample.name) >= 0)) { foreach (ContactSimple cnt in GetSourceContacts(new ContactSimple(inCnt, inLayer), inSample.name)) { if (GetPoint(cnt).name == inSample.name) sourseCount++; } if (sourseCount > sourceBest) sourceBest = 1; } if (!noLayer && (sourceBest < 2) && (GetPoint(inCnt, inLayer).isReplace)) { SetNextCont(inCnt, inLayer, inSample);//error gap in line return true; } return false; }*/ private bool SetOneOfBest(PairInt inCnt, int inLayer, NodePointLayer inSample) { NodePoint crPnt = GetPoint(inCnt, inLayer); if (!crPnt.isReplace || inSample.name == Material.blankName || crPnt.name == inSample.name) return false; ContactSimple curCentr = new ContactSimple(inCnt, inLayer); SetContact(curCentr, Material.blankName, 0, 0, -1); /*layoutMap[inChanged.x][inChanged.y][layerChanged].isReplace = false; layoutMap[inChanged.x][inChanged.y][layerChanged].name = inSample.name; layoutMap[inChanged.x][inChanged.y][layerChanged].numberNode = inSample.numberNode; layoutMap[inChanged.x][inChanged.y][layerChanged].priority = inSample.priority; layoutMap[inChanged.x][inChanged.y][layerChanged].number = inSample.number; */ string curName = inSample.name; //ContactSimple curPoint = new ContactSimple(inChanged, layerChanged); List<ContactSimple> cntArround = curCentr.GetArroundPoints(wide); //List<PairInt> cntCheckRepl = inCnt.GetBigArround(wide); //cntCheckRepl.Add(inCnt); bool contSetting = true; bool retValue = true; //foreach (ContactSimple cntUnit in cntArround) while (contSetting) { contSetting = false; retValue = true; List<string> namesChanged = new List<string>(); foreach (ContactSimple cntUnit in cntArround) { NodePoint unitPnt = GetPoint(cntUnit); string unitName = unitPnt.name; if (unitName != curName && unitPnt.isReplace && unitName!= Material.blankName && unitName != Material.diffusionName) { contSetting = true; if (cntUnit.x == 29 && (cntUnit.y == 38) && cntUnit.layer == Layers.siliconTrace && unitName == "INC")//4 point !!!!! != 737 { List<NodePoint> ps = new List<NodePoint>(); foreach (ContactSimple cnt in cntUnit.GetNeborPoints(wide)) ps.Add(GetPoint(cnt)); contSetting = true; } namesChanged.Add(unitName); SetContact(cntUnit, Material.blankName, 0, 0, -1); //cntAdded.Add(cntUnit); if (GetPoint(cntUnit).isSource) { foreach (ContactSimple smp in GetSourceContacts(cntUnit, curName)) if (smp != cntUnit) layoutMap[smp.x][smp.y][smp.layer].isReplace = CheckNebors(new ContactSimple(smp, smp.layer)); //cntCheckRepl.Add(smp); } foreach (ContactSimple cnt in cntUnit.GetNeborPoints(wide)) { /*string bn = GetPoint(cnt).name; if (cnt.x == 38 && cnt.y == 14 && cnt.layer == 1 && bn != Material.blankName) b = false;*/ foreach (int lay in Params.LayersRange[inLayer]) { //if (GetPoint(cnt, lay).name == unitName)//curName) && (cntCheckRepl.FindIndex(el => el == cnt) < 0)) layoutMap[cnt.x][cnt.y][lay].isReplace = CheckNebors(new ContactSimple(cnt, lay)); //cntCheckRepl.Add(cnt); } } } else if (unitName != curName && unitName!= Material.blankName && unitName != Material.diffusionName) { retValue = false; if (namesChanged.FindIndex(el => el == unitPnt.name) >= 0)//--------delete layoutMap[cntUnit.x][cntUnit.y][cntUnit.layer].isReplace = CheckNebors(new ContactSimple(cntUnit, cntUnit.layer)); } } } if (retValue) { layoutMap[inCnt.x][inCnt.y][inLayer].isReplace = false; layoutMap[inCnt.x][inCnt.y][inLayer].name = inSample.name; layoutMap[inCnt.x][inCnt.y][inLayer].numberNode = inSample.numberNode; layoutMap[inCnt.x][inCnt.y][inLayer].priority = inSample.priority; layoutMap[inCnt.x][inCnt.y][inLayer].number = inSample.number; } List<PairInt> checkRepl = inCnt.GetBigArround(wide); checkRepl.Add(inCnt); foreach (PairInt cntUnit in checkRepl) { foreach (int lay in Params.LayersRange[inLayer]) { //if (GetPoint(cntUnit, lay).name == curName) layoutMap[cntUnit.x][cntUnit.y][lay].isReplace = CheckNebors(new ContactSimple(cntUnit, lay)); } } return retValue; //-------------------------- /*bool noLayer = false; int sourceBest = 0; ContactSimple simple = new ContactSimple(inCnt, inLayer); List<ContactSimple> arround = simple.GetArroundPoints(wide); foreach (ContactSimple cntArround in arround) { NodePoint pn = GetPoint(cntArround); if ((GetPoint(cntArround).name != inSample.name) && (!GetPoint(cntArround).isReplace) && (GetPoint(cntArround).name != Material.diffusionName)) noLayer = true; if (!noLayer && GetPoint(cntArround).isSource && (GetPoint(cntArround).name != inSample.name)) sourceBest++; } int sourseCount = 0; if ((sourceBest > 1) && (diffusionException.FindIndex(el => el == inSample.name) >= 0)) { foreach (ContactSimple cnt in GetSourceContacts(new ContactSimple(inCnt, inLayer), inSample.name)) { if (GetPoint(cnt).name == inSample.name) sourseCount++; } if (sourseCount > sourceBest) sourceBest = 1; } if (!noLayer && (sourceBest < 2) && (GetPoint(inCnt, inLayer).isReplace)) { if (!SetNextCont(inCnt, inLayer, inSample)) return false; return true; }*/ //return false; }
private bool IsTwoLayerBridge(ContactSimple inCnt, List<int> opposLayers) { string curName = GetPoint(inCnt).name; foreach(int lay in opposLayers) if (GetPoint(inCnt, lay).name != curName) return false; List<ContactSimple> arround = inCnt.GetArroundPoints(wide); foreach (ContactSimple cnt in arround) { if (GetPoint(cnt).name == curName) return false; } return true; }
private bool SetNextCont(PairInt inChanged, int layerChanged, NodePoint inSample) { /*bool b = false; if (inChanged.x == 33 && (inChanged.y == 16 || inChanged.y == 18) && layerChanged == Layers.metal1Trace && inSample.name != "N6859613") b = false;*/ if (inSample.name == Material.blankName) return true; string curName = inSample.name; List<string> deletedNames = new List<string>(); ContactSimple curPoint = new ContactSimple(inChanged, layerChanged); List<ContactSimple> cntArround = curPoint.GetArroundPoints(wide); List<PairInt> cntArea = inChanged.GetBigArround(wide); cntArea.Add(inChanged); foreach (ContactSimple cntUnit in cntArround) { string unitName = GetPoint(cntUnit).name; if (unitName != curName && unitName!= Material.blankName && unitName != Material.diffusionName) { /*if (cntUnit.x == 33 && (cntUnit.y == 16 || cntUnit.y == 18) && cntUnit.layer == Layers.metal1Trace) b = false;*/ if (deletedNames.FindIndex(el => el == unitName) >= 0) { bool rem = CheckNebors(new ContactSimple(cntUnit, cntUnit.layer)); if (!rem) { layoutMap[cntUnit.x][cntUnit.y][cntUnit.layer].isReplace = rem; return false; } } deletedNames.Add(unitName); SetContact(cntUnit, Material.blankName, 0, 0, -1); //cntAdded.Add(cntUnit); if (GetPoint(cntUnit).isSource) { foreach (ContactSimple smp in GetSourceContacts(cntUnit, curName)) if (smp != cntUnit) cntArea.Add(smp); //cntArea.Add(GetSourceContacts //GetNearSource(cntUnit)); } //List<PairInt> cntForCheck = new List<PairInt>(); foreach (ContactSimple cnt in cntUnit.GetNeborPoints(wide)) { /*string bn = GetPoint(cnt).name; /*if (cnt.x == 38 && cnt.y == 14 && cnt.layer == 1 && bn != Material.blankName) b = false;*/ if ((GetPoint(cnt).name != curName) && (cntArea.FindIndex(el => el == cnt) < 0)) { cntArea.Add(cnt); //cntForCheck.Add(cnt); } } } } layoutMap[inChanged.x][inChanged.y][layerChanged].isReplace = false; layoutMap[inChanged.x][inChanged.y][layerChanged].name = inSample.name; layoutMap[inChanged.x][inChanged.y][layerChanged].numberNode = inSample.numberNode; layoutMap[inChanged.x][inChanged.y][layerChanged].priority = inSample.priority; layoutMap[inChanged.x][inChanged.y][layerChanged].number = inSample.number; foreach (PairInt cntUnit in cntArea) { foreach (int lay in Params.LayersRange[layerChanged]) { layoutMap[cntUnit.x][cntUnit.y][lay].isReplace = CheckNebors(new ContactSimple(cntUnit, lay)); } /*bool b; if (cntUnit.x == 20 && cntUnit.y == 16) b = true; layoutMap[cntUnit.x][cntUnit.y][Layers.metal1Trace].isReplace = CheckNebors(new ContactSimple(cntUnit, Layers.metal1Trace)); layoutMap[cntUnit.x][cntUnit.y][Layers.siliconTrace].isReplace = CheckNebors(new ContactSimple(cntUnit, Layers.siliconTrace));*/ } return true; }
private bool IsPointFree(ContactSimple inPoint, string curName) { if (GetPoint(inPoint).name != curName && GetPoint(inPoint).name != Material.blankName) return false; foreach (ContactSimple pn in inPoint.GetArroundPoints(wide)) if (GetPoint(pn).name != curName && GetPoint(pn).name != Material.blankName) return false; return true; }
private bool IsBridgeM1Si(ContactSimple inCnt, int opposLayer) { /*int opposLayer = Layers.metal1Trace; if (inCnt.layer == Layers.metal1Trace) opposLayer = Layers.siliconTrace;*/ string curName = GetPoint(inCnt).name; if (curName != GetPoint(inCnt, opposLayer).name || GetPoint(inCnt, Layers.contactTrace).name == Material.diffusionName) return false; bool isSpreadThisL = false; //bool isSpredOpposL = false; List<ContactSimple> arround = inCnt.GetArroundPoints(wide); foreach (ContactSimple cnt in arround) { if (GetPoint(cnt).name == curName && GetPoint(cnt, opposLayer).name == curName && GetPoint(cnt, Layers.contactTrace).name != Material.diffusionName) return false; if (GetPoint(cnt).name == curName && (GetPoint(cnt, opposLayer).name != curName || GetPoint(cnt, Layers.contactTrace).name == Material.diffusionName)) isSpreadThisL = true; //if (GetPoint(cnt).name != curName && (GetPoint(cnt, opposLayer).name == curName || // GetPoint(cnt, Layers.contactTrace).name == Material.diffusionName)) // isSpredOpposL = true; } bool isBridgeBool = false; if (isSpreadThisL)// && isSpredOpposL) //isSpredOpposL - delete isBridgeBool = true; if (!isBridgeBool && isSpreadThisL && IsOnlyConnectionM1Si(inCnt)) isBridgeBool = true; return isBridgeBool;//false; }
private bool IsBridgeM1M2(ContactSimple inCnt, int opposLayer) { /*int opposLayer = Layers.metal1Trace; if (inCnt.layer == Layers.metal1Trace) opposLayer = Layers.metal2Trace;*/ string curName = GetPoint(inCnt).name; if (curName != GetPoint(inCnt, opposLayer).name) return false; bool isSpreadThisL = false; //bool isSpredOpposL = false; List<ContactSimple> arround = inCnt.GetArroundPoints(wide); foreach (ContactSimple cnt in arround) { if (GetPoint(cnt).name == curName && GetPoint(cnt, opposLayer).name == curName) return false; if (GetPoint(cnt).name == curName && (GetPoint(cnt, opposLayer).name != curName)) isSpreadThisL = true; //if (GetPoint(cnt).name != curName && (GetPoint(cnt, opposLayer).name == curName)) // isSpredOpposL = true; } bool isBridgeBool = false; if (isSpreadThisL)// && isSpredOpposL) isBridgeBool = true; return isBridgeBool;//false; }
private bool FindSource(ContactSimple inCnt) { string sourceName = GetPoint(inCnt).name; Node nd = nodeList.Find(el => el.name == sourceName); int coordY = Params.lineN; if ( inCnt.y < Params.lineMiddle )//(inCnt.y - Params.lineP) <= 3 ) coordY = Params.lineP; ContactSimple pin = new ContactSimple(inCnt.x, coordY, inCnt.layer); if (nd.arcCollection.FindIndex(el => el == pin) < 0)//not this node return true; int countOneName = 0; bool nebourS = false; foreach (ContactSimple cnt in inCnt.GetArroundPoints(wide)) { if (GetPoint(cnt).name == sourceName && (cnt.x != inCnt.x)) countOneName++; if ((GetPoint(cnt).name == sourceName) && (cnt.x == inCnt.x)) { NodePoint ndPnt = GetPoint(new ContactSimple(cnt.x, cnt.y + (cnt.y - inCnt.y)*2, cnt.layer)); if ( (ndPnt.name == sourceName) && ndPnt.isSource ) nebourS = true; else countOneName++; } } if (countOneName > 0) return false; if (nebourS) return true; countOneName = 0; foreach (ContactSimple cnt in GetSourceContacts(inCnt, sourceName)) { if (GetPoint(cnt).name == sourceName) countOneName++; } if (countOneName < 2) return false; /*if (layoutMap[inCnt.x][inCnt.y + 2][inCnt.layer].isSource && layoutMap[inCnt.x][inCnt.y + 2][inCnt.layer].name != sourceName && (nd.arcCollection.FindIndex(el => el == pin) >= 0)) return false; if (layoutMap[inCnt.x][inCnt.y - 2][inCnt.layer].isSource && layoutMap[inCnt.x][inCnt.y - 2][inCnt.layer].name != sourceName && (nd.arcCollection.FindIndex(el => el == pin) >= 0)) return false;*/ return true; }
//, string curName) private bool CheckBigArea(ContactSimple curCnt) { //ContactSimple curCnt = new ContactSimple(inCnt, inLayer); /*bool b = false; if (curCnt.x == 15 && curCnt.y == 33 && curCnt.layer == Layers.siliconTrace) b = true;*/ string curName = GetPoint(curCnt).name; foreach(ContactSimple smp in curCnt.GetArroundPoints(wide)) if (GetPoint(smp).name != curName) return true; List<ContactSimple> rhombus = curCnt.GetAnyInBigRadius(wide); int start = rhombus.FindIndex(el => GetAnyPoint(el).name == curName); int end = rhombus.FindIndex(el => GetAnyPoint(el).name != curName); if (end < 0) return true; if (end == 0 && start < 0) return true; List<ContactSimple> nebors = new List<ContactSimple>(); int start2 = rhombus.FindIndex(end, el => GetAnyPoint(el).name == curName); if (end < start2) { nebors.AddRange(rhombus.GetRange(start2, rhombus.Count - start2)); nebors.AddRange(rhombus.GetRange(0, start2)); } else nebors = rhombus; bool nameThere = false; bool firstFilledArea = true; foreach (ContactSimple cntNebor in nebors) { if (GetAnyPoint(cntNebor).name == curName) { nameThere = true; } else if (nameThere && firstFilledArea) { firstFilledArea = false; nameThere = false; } else if (nameThere) { return false; } } return true; }