<> <> <> <> DIRECTORY Atom, CD, CDCells, CDColors, CDEvents, CDOps, CDPanel, CDProperties, CDRects, CDTipEtc, CDValue, CDViewer, IO, PrincOpsUtils, Rope, TerminalIO, TokenIO; ColorTestImpl: CEDAR PROGRAM IMPORTS Atom, CD, CDCells, CDColors, CDOps, CDPanel, CDProperties, CDRects, CDTipEtc, CDValue, CDViewer, IO, PrincOpsUtils, TerminalIO = BEGIN key: ATOM _ $TestColor0; tech: CD.Technology; lambda: CD.Number = 1; numMax: INT = 56; num: INT = 14; layers: REF ARRAY[0..numMax) OF CD.Layer _ NEW [ARRAY[0..numMax) OF CD.Layer]; InitKernel: PROC [] = BEGIN ss: CARDINAL = 1+16+16*16+16*16*16; WITH Atom.GetProp[key, key] SELECT FROM p: REF ARRAY[0..numMax) OF CD.Layer => { TerminalIO.WriteRope["colortest impl\n"]; layers _ p; tech _ CD.FetchTechnology[key]; TerminalIO.WriteRope["colortest re started\n"]; RETURN }; ENDCASE => NULL; tech _ CD.RegisterTechnology[key, "colortest", lambda]; <<--layers>> FOR i: INT IN [0..numMax) DO layers[i] _ CD.NewLayer[tech, Atom.MakeAtom[IO.PutFR["color%g", IO.int[i]]]]; CDColors.DefineColor[layers[i], NEW[CDColors.Brick_[4*ss, 4*ss, 4*ss, 4*ss]], bit4]; CDColors.DefineColor[layers[i], NEW[CDColors.Brick_[8*ss, i MOD 16, 2*ss, (i/16)]], bw]; CDColors.DefineColor[layers[i], NEW[CDColors.Brick_[0, 255,0 , 255]], bit8]; CDPanel.DefineLayerEntry[tech, layers[i], IO.PutR[IO.int[i]], 0, 0]; ENDLOOP; CDTipEtc.SetIcon[tech, "Chipndale.icons", 3]; CDTipEtc.SetPanelIcon[tech, "Chipndale.icons", 4]; CDTipEtc.SetTipTable[tech, "Standard"]; Atom.PutProp[key, key, layers]; TerminalIO.WriteRope["colortest impl\n"]; END; InitDesign: PROC [] = BEGIN step: INT _ 8; w: INT _ 5; l1: INT _ step*(num+2); l0: INT _ 80; gap: INT _ 5; d: CD.Design _ CDOps.CreateDesign[tech]; FOR i: INT IN [0..num) DO ob1: CD.Object _ CDRects.CreateRect[[w, l1], layers[i]]; ob2: CD.Object _ CDRects.CreateRect[[l1+l0+num/4*gap, w], layers[i]]; [] _ CDCells.IncludeOb[design: d, ob: ob1, position: [l0+i*step+i/4*gap, 0]]; [] _ CDCells.IncludeOb[design: d, ob: ob2, position: [0, step+i*step]]; ENDLOOP; [] _ CDViewer.CreateViewer[d]; END; device: ATOM _ $CDxVersatec; blackX: ATOM _ $CDxVersatecBlack; cyanX: ATOM _ $CDxVersatecCyan; yellowX: ATOM _ $CDxVersatecMagenta; magentaX: ATOM _ $CDxVersatecYellow; Stipple4: TYPE = ARRAY [0..4) OF [0..16); Stipple8: TYPE = ARRAY [0..8) OF [0..256); Clear: PROC [] = BEGIN FOR i: INT IN [0..numMax) DO CDProperties.PutPropOnLayer[onto: layers[i], prop: cyanX, val: NIL]; CDProperties.PutPropOnLayer[onto: layers[i], prop: magentaX, val: NIL]; CDProperties.PutPropOnLayer[onto: layers[i], prop: yellowX, val: NIL]; CDProperties.PutPropOnLayer[onto: layers[i], prop: blackX, val: NIL]; ENDLOOP; END; Key: PROC [i: INT] RETURNS [ATOM] = BEGIN <> <<1 => cyanX,>> <<2 => magentaX,>> <<3 => yellowX,>> < blackX;>> <<--change order>> a: ATOM _ SELECT i FROM 1 => magentaX, 2 => cyanX, 3 => blackX, ENDCASE => yellowX; RETURN [a] END; Col: PROC [i: INT, j: INT, stipple: Stipple8] = BEGIN CDProperties.PutPropOnLayer[onto: layers[i], prop: Key[j], val: NEW[Stipple8 _ stipple]] END; Set: PROC [i: INT, s: Stipple4] = BEGIN Set8[i, To8[s]]; END; Set8: PROC [i: INT, stipple: Stipple8] = BEGIN Col[i+0, 0, stipple]; Col[i+1, 1, stipple]; Col[i+2, 2, stipple]; Col[i+3, 3, stipple]; Col[i+4, 1, stipple]; Col[i+4, 2, stipple]; Col[i+5, 1, stipple]; Col[i+5, 3, stipple]; Col[i+6, 2, stipple]; Col[i+6, 3, stipple]; Col[i+7, 1, stipple]; Col[i+7, 2, stipple]; Col[i+7, 3, stipple]; END; InitPlot: PROC [] = BEGIN r: Rope.ROPE _ "color text"; CDValue.Store[tech, device, r]; CDProperties.PutPropOnAtom[device, $CDxColorPDPlotBlack, blackX]; CDProperties.PutPropOnAtom[device, $CDxColorPDPlotCyan, cyanX]; CDProperties.PutPropOnAtom[device, $CDxColorPDPlotYellow, yellowX]; CDProperties.PutPropOnAtom[device, $CDxColorPDPlotMagenta, magentaX]; CDProperties.PutPropOnAtom[device, $CDxLastTechnology, tech.key]; END; InitColor1: PROC [] = BEGIN Clear[]; Set[0, [15, 15, 15, 15]]; --full Set[8, [10, 5, 10, 5]]; --checker Set[16, [5, 0, 5, 0]]; -- Set[24, [8, 4, 2, 1]]; --diagonals Set[32, [3, 6, 12, 9]]; --double diagonals Set[40, [8, 2, 4, 1]]; Set[48, [10, 10, 3, 3]]; END; InitColor2: PROC [] = BEGIN Clear[]; Set[0, [15, 15, 15, 15]]; --full Set[8, [0, 6, 6, 0]]; Set[16, [5, 5, 10, 10]]; Set[24, [7, 14, 13, 11]]; Set[32, [12, 12, 3, 3]]; Set[40, [4, 14, 4, 0]]; Set[48, [10, 15, 5, 15]]; END; InitColor3: PROC [] = BEGIN Clear[]; Set[0, [15, 15, 15, 15]]; --full Set[8, [15, 3, 15, 3]]; Set8[16, [6, 12, 24, 48, 96, 192, 129, 3]]; Set8[24, [17, 51, 34, 102, 68, 204, 136, 153]]; Set8[32, [48, 48, 252, 252, 48, 48, 0, 0]]; Set8[40, [51, 51, 102, 102, 204, 204, 153, 153]]; Set[48, [3, 6, 12, 9]]; END; To8: PROC [x: Stipple4] RETURNS [y: Stipple8] = BEGIN FOR i: INT IN [0..4) DO y[i] _ y[i+4] _ x[i]*17; ENDLOOP END; Add: PROC [x, y: Stipple8] RETURNS [s: Stipple8] = TRUSTED BEGIN FOR i: INT IN [0..8) DO s[i] _ PrincOpsUtils.BITOR[x[i], y[i]]; ENDLOOP END; Up: PROC [x: Stipple8, j: INT _ 1] RETURNS [s: Stipple8] = BEGIN FOR i: INT IN [0..7) DO s[i] _ x[(i+j) MOD 8]; ENDLOOP END; Mirr: PROC [x: Stipple8] RETURNS [s: Stipple8] = BEGIN FOR i: INT IN [0..8) DO s[i] _ x[7-i] ENDLOOP END; full: Stipple8 _ To8[[15, 15, 15, 15]]; diagD: Stipple8 _ To8[[3, 6, 12, 9]]; checkerD: Stipple8 _ To8[[0, 6, 6, 0]]; crazy: Stipple8 _ To8[[10, 10, 3, 3]]; diagD8: Stipple8 _ [6, 12, 24, 48, 96, 192, 129, 3]; LDS8: Stipple8 _ [17, 51, 34, 102, 68, 204, 136, 153]; LDL8: Stipple8 _ [51, 51, 102, 102, 204, 204, 153, 153]; Green: PROC [i: INT, stipple: Stipple8] = BEGIN Col[i, 1, stipple]; Col[i, 3, stipple]; END; Orange: PROC [i: INT, stipple: Stipple8] = BEGIN Col[i, 2, stipple]; Col[i, 3, stipple]; END; InitColor4: PROC [] = BEGIN Clear[]; --greens Green[0, full]; Green[1, diagD]; Green[2, checkerD]; Green[3, crazy]; Green[4, diagD8]; Green[5, LDS8]; Green[6, LDL8]; Col[7, 1, diagD]; Col[7, 3, To8[[11, 6, 14, 9]]]; Col[8, 1, LDS8]; Col[8, 3, [17+128, 51+64, 34, 102+16, 68+8, 204, 136+2, 153]]; Col[9, 1, LDS8]; Col[9, 3, [17+2, 51, 34+4, 102, 68+8, 204, 136+16, 153]]; Col[10, 1, LDS8]; Col[10, 3, [17+2+32, 51, 34+4+64, 102, 68+8+128, 204, 136+16+1, 153]]; Col[11, 1, LDS8]; Col[11, 3, [17+2+32+8+128, 51, 34+4+64+1+16, 102, 68+8+128+2+32, 204, 136+16+1+4+64, 153]]; Col[12, 1, LDL8]; Col[12, 3, [51, 51+4, 102, 102+8, 204, 204+16, 153, 153+32]]; Green[13, Mirr[diagD]]; Green[14, Mirr[Up[diagD, 2]]]; Green[15, Mirr[LDS8]]; Green[16, Mirr[Up[LDS8, 2]]]; Green[17, Mirr[LDL8]]; Green[18, Mirr[Up[LDL8, 2]]]; --full colors Col[19, 1, full]; Col[20, 2, full]; Col[21, 3, full]; Orange[22, full]; Col[23, 0, full]; --reds Col[24, 2, diagD]; Col[25, 2, checkerD]; Col[26, 2, crazy]; Col[27, 2, diagD8]; Col[28, 2, LDS8]; Col[29, 2, LDL8]; Orange[30, Mirr[diagD]]; Orange[31, Mirr[checkerD]]; Orange[32, Mirr[crazy]]; Orange[33, Mirr[diagD8]]; Orange[34, Mirr[LDS8]]; Orange[35, Mirr[LDL8]]; --blues Col[37, 1, diagD]; Col[38, 1, checkerD]; Col[39, 1, crazy]; Col[40, 1, diagD8]; Col[41, 1, LDS8]; Col[42, 1, LDL8]; END; InitColor6: PROC [] = BEGIN Clear[]; --greens Green[1, diagD]; Green[2, checkerD]; Green[3, LDL8]; Col[4, 1, diagD]; Col[4, 3, To8[[11, 6, 14, 9]]]; Green[5, Mirr[LDL8]]; --black Col[6, 0, full]; Col[6, 1, full]; --reds Col[7, 2, diagD]; Col[8, 2, crazy]; Col[9, 2, LDS8]; Col[10, 2, LDL8]; Orange[11, Mirr[diagD]]; --blues Col[12, 1, diagD]; Col[13, 1, crazy]; Col[14, 1, diagD8]; Col[15, 1, LDS8]; Col[16, 1, LDL8]; --yellows Col[17, 3, diagD]; Col[18, 3, [255-diagD[0], 255-diagD[1], 255-diagD[2], 255-diagD[3], 255-diagD[4], 255-diagD[5], 255-diagD[6], 255-diagD[7]]]; Col[19, 3, diagD8]; Col[20, 3, Mirr[diagD8]]; END; -- the diagD8 yellow made the other layers looking bad InitColor7: PROC [] = BEGIN Clear[]; --decided actually that metal is some kind of diagD (unknown mirror and phase) --metal 2 is diagD8; are the only blue combinations which overlap nice. --all reds did good overlap with the yellows and with blue, fair with greens; decide red last --metal/nwell overlapp is difficult and goal of this test. The problem is to make a blue yellow overlapp which is different from green. --greens Green[1, diagD]; Green[2, checkerD]; Green[3, LDL8]; Col[4, 1, diagD]; Col[4, 3, To8[[11, 6, 14, 9]]]; Green[5, Mirr[LDL8]]; --black Col[6, 0, full]; Col[6, 1, full]; --blues Col[7, 1, diagD];--3, 6, 12, 9 Col[8, 1, To8[[6, 12, 9, 3]]]; Col[9, 1, To8[[12, 9, 3, 6]]]; Col[10, 1, To8[[9, 3, 6, 12]]]; Col[11, 1, To8[[9, 12, 6, 3]]]; Col[12, 1, To8[[12, 6, 3, 9]]]; Col[13, 1, To8[[6, 3, 9, 12]]]; Col[14, 1, To8[[3, 9, 12, 6]]]; Col[15, 1, diagD8]; --yellows Col[16, 3, [15, 15, 15, 15, 0, 0, 0, 0]]; Col[17, 3, diagD]; Col[18, 3, To8[[1, 2, 4, 8]]]; Col[19, 3, diagD8]; Col[20, 3, diagD8]; END; --decide: blue To8[[6, 12, 9, 3]] -- yellow: Col[18, 3, To8[[1, 2, 4, 8]]]; InitColor8: PROC [] = BEGIN Clear[]; Col[0, 1, To8[[6, 12, 9, 3]]];--blue metal 1 Col[1, 3, To8[[1, 2, 4, 8]]];--yellow nwell Col[3, 1, [6, 12, 24, 48, 96, 192, 129, 3]]; --metal 2 guess Col[4, 1, [12, 24, 48, 96, 192, 129, 3, 6]]; --metal 2 guess --black Col[5, 0, full]; Col[5, 1, full]; Col[5, 3, full]; --greens Green[6, diagD]; Green[7, checkerD]; Green[8, LDL8]; Col[9, 1, diagD]; Col[9, 3, To8[[11, 6, 14, 9]]]; Green[10, Mirr[LDL8]]; Green[11, Mirr[diagD]]; Green[12, To8[[12, 9, 3, 6]]]; Green[13, To8[[9, 3, 6, 12]]]; --reds Col[14, 2, diagD]; Orange[15, diagD]; Col[16, 2, crazy]; Col[17, 2, LDS8]; Col[18, 2, LDL8]; Orange[19, Mirr[diagD]]; Orange[20, Mirr[LDL8]]; Orange[21, To8[[12, 9, 3, 6]]]; Orange[22, To8[[9, 3, 6, 12]]]; Orange[23, Mirr[To8[[12, 9, 3, 6]]]]; Orange[24, Mirr[To8[[9, 3, 6, 12]]]]; END; InitColor9: PROC [] = BEGIN Clear[]; --good guesses Col[0, 1, To8[[6, 12, 9, 3]]];--blue metal 1 Col[1, 3, To8[[1, 2, 4, 8]]];--yellow nwell Green[2, To8[[12, 9, 3, 6]]]; Orange[3, To8[[9, 3, 6, 12]]]; --variety green Col[4, 1, diagD]; Col[4, 3, To8[[11, 6, 14, 9]]]; Col[5, 1, To8[[12, 9, 3, 6]]]; Col[5, 3, To8[[12+1, 9, 3+4, 6]]]; Green[6, Mirr[diagD]]; --variety red --variety metal 2 Col[8, 1, [6, 12, 24, 48, 96, 192, 129, 3]]; --metal 2 guess Col[9, 1, [12, 24, 48, 96, 192, 129, 3, 6]]; --metal 2 guess Col[10, 1, [24, 48, 96, 192, 129, 3, 6, 12]]; --metal 2 guess Col[11, 1, [48, 96, 192, 129, 3, 6, 12, 24]]; --metal 2 guess Col[12, 1, [96, 192, 129, 3, 6, 12, 24, 48]]; --metal 2 guess Col[13, 1, [3, 129, 192, 96, 48, 24, 12, 6]]; --metal 2 guess Col[14, 1, [129, 192, 96, 48, 24, 12, 6, 3]]; --metal 2 guess Col[15, 1, [192, 96, 48, 24, 12, 6, 3, 129]]; --metal 2 guess Col[16, 1, [96, 48, 24, 12, 6, 3, 129, 192]]; --metal 2 guess Orange[17, Mirr[To8[[9, 3, 6, 12]]]]; Orange[18, diagD]; Orange[19, Mirr[LDL8]]; Col[20, 0, [0, 0, 8, 0, 0, 0, 0, 0]]; --black dots Col[20, 1, [0, 0, 8, 0, 0, 0, 0, 0]]; Col[20, 2, [0, 0, 8, 0, 0, 0, 0, 0]]; Col[20, 3, [0, 0, 8, 0, 0, 0, 0, 0]]; END; InitColor10: PROC [] = BEGIN Clear[]; --good guesses Col[0, 1, To8[[6, 12, 9, 3]]];--blue metal 1 Col[1, 3, To8[[1, 2, 4, 8]]];--yellow nwell Col[2, 1, To8[[12, 9, 3, 6]]]; --green with more yellow Col[2, 3, To8[[12+1, 9, 3+4, 6]]]; Orange[3, To8[[9, 3, 6, 12]]]; --poly Col[4, 1, [24, 48, 96, 192, 129, 3, 6, 12]]; --metal 2 Col[5, 3, full];--yellow implant Col[6, 0, full];--black cut Col[6, 1, full]; Col[6, 2, full]; Col[6, 3, full]; Col[7, 0, [255-96, 255-192, 255-129, 255-3, 255-6, 255-12, 255-24, 255-48]];--black cut 2 Col[7, 1, [255-96, 255-192, 255-129, 255-3, 255-6, 255-12, 255-24, 255-48]]; Col[7, 2, [255-96, 255-192, 255-129, 255-3, 255-6, 255-12, 255-24, 255-48]]; Col[7, 3, [255-96, 255-192, 255-129, 255-3, 255-6, 255-12, 255-24, 255-48]]; Green[8, checkerD];-- pwellCont Green[9, LDL8];--nwellCont Col[10, 0, [0, 0, 0, 0, 0, 56, 56, 56]]; --burried Col[10, 1, [0, 0, 0, 0, 0, 56, 56, 56]]; Col[10, 2, [0, 0, 0, 0, 0, 56, 56, 56]]; Col[10, 3, [0, 0, 0, 0, 0, 56, 56, 56]]; Col[11, 0, [0, 0, 12, 12, 0, 0, 0, 0]]; --black dots Col[11, 1, [0, 0, 12, 12, 0, 0, 0, 0]]; Col[11, 2, [0, 0, 12, 12, 0, 0, 0, 0]]; Col[11, 3, [0, 0, 12, 12, 0, 0, 0, 0]]; Col[12, 0, [0, 0, 8, 4, 0, 0, 0, 0]]; --black dots Col[12, 1, [0, 0, 8, 4, 0, 0, 0, 0]]; Col[12, 2, [0, 0, 8, 4, 0, 0, 0, 0]]; Col[12, 3, [0, 0, 8, 4, 0, 0, 0, 0]]; Col[13, 0, To8[[3, 6, 12, 9]]]; --black test Col[13, 1, To8[[3, 6, 12, 9]]]; --black test Col[13, 2, To8[[3, 6, 12, 9]]]; --black test Col[13, 3, To8[[3, 6, 12, 9]]]; --black test END; InitKernel[]; InitPlot[]; <> <> <> <> <> <> END.