* hint to make pdf nicer, expeciall with thick lines ppe(20) open the drawing in pdfxchange edit select all (with right mouse) set Line_Cap = Round Line_Join = Round * ~/.cdsplotinit 888888888888888888888888888888888888888888888888888888888888888888888888 # Adobe PostScript Level 2 Plotter # AAAGregC|Generic 300 dpi Adobe PostScript Level 2 Plotter: \ :manufacturer=Adobe: \ :type=postscript2: \ :spool=lpr: \ :queue=lpq: \ :maximumPages#30: \ :resolution#300: \ :paperSize="A" 2400 3150 75 75: # # Adobe PostScript Level 1 Plotters # AAAGregE|Epsi Plotter: \ :manufacturer=Adobe: \ :type=epsf: \ :maximumPages#1: \ :resolution#300: \ :paperSize="5x5 inches" 1500 1500: \ :paperSize="8x8 inches" 2400 2400: \ :paperSize="PPL" 300000 300000: \ :paperSize="Unlimited" 72000 72000: # Adobe PostScript Level 1 Plotter # AAAGregB|Generic 300 dpi Adobe PostScript Level 1 Plotter: \ :manufacturer=Adobe: \ :type=postscript1: \ :spool=lpr: \ :queue=lpq: \ :maximumPages#30: \ :resolution#300: \ :paperSize="A" 2400 3150 75 75: 888888888888888888888888888888888888888888888888888888888888888888888888 procedure( ppe(@optional ( lwid 10 ) ( fnameo "junk.pdf" ) ) prog( (cv bBox jstr lname cname vname) cv = getCurrentWindow() bBox = hiGetViewBBox(cv) xsize = 10.0 * (nth(0 nth(1 bBox)) - nth(0 nth(0 bBox))) ysize = 10.0 * (nth(1 nth(1 bBox)) - nth(1 nth(0 bBox))) lname = cv~>cellView~>libName cname = cv~>cellView~>cellName vname = cv~>cellView~>cellViewType gregOpen("gregPlot.plt") fprintf(gregOPort "schPlotOptions = '( nil\n") fprintf(gregOPort " hierarchy nil\n") fprintf(gregOPort " hierleveldown 0\n") fprintf(gregOPort " multisheet nil\n") fprintf(gregOPort " view \"%s\"\n" vname) fprintf(gregOPort " cell \"%s\"\n" cname) fprintf(gregOPort " library \"%s\"\n" lname) fprintf(gregOPort " plot \"cellview\"\n") fprintf(gregOPort " bBox %L\n" bBox) fprintf(gregOPort " fullarea nil\n") fprintf(gregOPort " noteText \"\"\n") fprintf(gregOPort " grid nil\n") fprintf(gregOPort " indexsheet t\n") fprintf(gregOPort " notes nil\n") fprintf(gregOPort " header nil\n") fprintf(gregOPort " plotToFile t\n") fprintf(gregOPort " vsheets 1\n") fprintf(gregOPort " hsheets 1\n") fprintf(gregOPort " pagecount 1\n") fprintf(gregOPort " nullpage nil\n") fprintf(gregOPort " paperdim (1.0 1.0)\n") fprintf(gregOPort " papersize \"PPL\"\n") fprintf(gregOPort " resolution 300\n") fprintf(gregOPort " plottertype \"epsf\"\n") fprintf(gregOPort " plotter \"AAAGregE\"\n") fprintf(gregOPort " fit nil\n") fprintf(gregOPort " outputfile \"junktmp.ps\"\n") fprintf(gregOPort " time \"now\"\n") fprintf(gregOPort " tmpdir \"/tmp\"\n") fprintf(gregOPort " copy 1\n") fprintf(gregOPort " unit \"inches\"\n") fprintf(gregOPort " scale 10.0\n") fprintf(gregOPort " center nil\n") fprintf(gregOPort " mail nil\n") fprintf(gregOPort " orientation \"portrait\"\n") fprintf(gregOPort " offset (0.0 0.0)\n") fprintf(gregOPort " plotsize (%0.5f %0.5f)\n" xsize ysize) fprintf(gregOPort ")\n") fprintf(gregOPort "\n") gregClose() schPlot("gregPlot.plt" cv) sprintf(jstr "cat junktmp.ps | sed -e 's/1 setlinewidth/%d setlinewidth/' > junktmp1.ps" lwid) system(jstr) sprintf(jstr "ps2pdf -dEPSCrop junktmp1.ps") system(jstr) sprintf(jstr "mv junktmp1.pdf %s" fnameo) system(jstr) sprintf(jstr "cp %s ~/junk_last.pdf" fnameo) system(jstr) system("rm junktmp.ps") printf("\n") printf("Created %s (%d)\n" fnameo lwid) printf("scp $SS:junk_last.pdf .\n") ) ) ~ * unbelievable This code does not work NUMH = 61 VREFH = 1.2 VREFL = 0.6 VDELB = (VREFH - VREFL) / (NUMH -1) This code works NUMH = 61 VREFH = 1.2 VREFL = 0.6 VDELB = (VREFH - VREFL) / (NUMH - 1) in the first case, Cadence decides that "(NUMH -1) must be a function call === NUMH(-1) in the second case, Cadence decides "-" looks like an operator, so it tries to apply it, and thinks that NUMH might be a number, which it is, and then it does the mathematical operation, ... this is obviously ridiculous, and the kind of thing if you have to explain, then forget trying to convince the person you're talking to. * procedure notes According to the skill manual, a procedure returns the value of the symbol with the same name as the procedure, but I have verified that it actually returns the last value calculated, even if you assign a value somewhere else in the function to the function name. Any temporary variables used in a procedure are global unless you use a let() or prog() inside of the procedure. let() is faster than prog(), but does not support a return statement. HERE IS MY STRONG RECOMMENDATION : * if the procedure is simple and it doesn't need any local variables and you don't care what it returns or you are fine with it just returning the value of the last statement then : procedure( add2( x y ) x + y ) * otherwise always use a prog() inside the function and if you want it to return something, then use an explicit return() statement procedure( add3( x y z) prog( (tmp1 tmp2) tmp1 = x + y tmp2 = tmp1 + z return(tmp2) ) ) procedure( gregTst( z ) prog( ( x y ) if( (z == 1) then x = 1 y = 2 else if( (z == 2) then x = 3 y = 4 else if( (z == 3) then x = 5 y = 6 else if( (z == 4) then x = 7 y = 8 else x = 9 y = 10 )))) return(list(x y)) ) ) * cond The cond structure provides an efficient multiway branch and RETURNS the last value executed in the branch cond( ( condition1 exp1 exp2 exp3 ... ) ( condition2 exp1 exp2 exp3 ... ) ( condition3 exp1 exp2 exp3 ... ) ( condition4 exp1 exp2 exp3 ... ) ( t exp1 exp2 exp3 ... ) ) Note how we put a final condition that must be true in case none of the above was true * Example Procedure ;; note the use of then. If you leave it out you will get unexpected behavior ;; note the matching ) is part of the if( ;; note there is no () on the last else block ;; note the return statement is inside the prog() block procedure( gregTst( z ) prog( ( x y ) if( (z == 1) then x = 1 y = 2 else if( (z == 2) then x = 3 y = 4 else if( (z == 3) then x = 5 y = 6 else if( (z == 4) then x = 7 y = 8 else x = 9 y = 10 ) ) ) ) return(list(x y)) ) ) * Skill Basic Data Types (sklanguser-->Language_Char-->Data_Char-->Data_Types) d - Cadence database object l - list n - number (integer or floating) p - port s - symbol S - symbol or string t - text string w - window x - integer number y - binary function * Numbers 0b0011 --> binary value 3 0x3f --> hex 63 * Strings strings are limited to 8191 chars \ddd --> ascii code * boolean t nil myPort = instring( "abc" )=> port:"*string*" char = getc( myPort ) => a ;;; the first character type( char ) => symbol ;;; is represented by the symbol a. getc( myPort ) => b ;;; the next character getc( myPort ) => c ;;; the next character getc( myPort ) => nil ;;; end of string close( myPort ) char = 'A printf("Character = %c\n" char ) char = '\120 char => P printf( "Char = %c\n" '\120 ) if( (type(dlayer) == 'string) then dlayer = list( dlayer "drawing" ) )