### Complete Workflow Example Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt A comprehensive example demonstrating a typical workflow within the project, integrating multiple functionalities. This serves as a practical guide to using the library's features in sequence. ```SKILL ;; This is a placeholder for a complete workflow example. ;; Actual code would integrate barcode generation, text rendering, ;; PCell usage, and layout manipulation in a cohesive sequence. ;; Example: ;; cell = dbOpenCellViewByType("myLib" "myCell" "layout" "w") ;; barcode("W123" list(0:0)) ;; pgText("Design Top" list(100:100) "v2=t") ;; CCSencapRodPcell(?width 50 ?height 10) ;; generateMultiMask(list(list("METAL1" 1))) ;; dbSave(cell) ;; dbClose(cell) ``` -------------------------------- ### Parametric Cell (PCell) Usage Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Shows how to use the provided Parametric Cell (PCell) definitions. Examples cover the usage of CCSencapRodPcell, CapPcell, and SETPcell. Ensure PCell definitions and CDF configurations are loaded. ```SKILL ;; Usage of CCSencapRodPcell CCSencapRodPcell(?width 10 ?height 20 ?handles '("top" "bottom")) ;; Usage of CapPcell CapPcell(?fingers 4 ?fingerWidth 2 ?gap 1) ;; Usage of SETPcell SETPcell(?length 50 ?width 10 ?oxideThickness 0.5) ``` -------------------------------- ### Code Examples and Usage Patterns Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt A collection of code examples and practical usage patterns for various functionalities within the Cadence SKILL library. ```APIDOC ## Code Examples and Usage Patterns ### Description This section provides practical code examples and usage patterns demonstrating how to effectively utilize the various features and APIs of the Cadence SKILL library. ### Example Categories - **Barcode Examples (4)**: Demonstrates simple barcode creation, multiple positions, programmatic generation, and adding labels. - **Text Rendering Examples (5)**: Covers basic text rendering, auto-positioning, multi-line text, and custom font usage. - **PCell Examples (3)**: Illustrates the usage of all three provided Parametric Cell types. - **Layout Manipulation Examples (8)**: Shows practical applications of multi-mask generation, layer inversion, XOR operations, visualization, tiling, and scaling. - **Scale Bar Examples (3)**: Includes examples for basic scale bar creation, multi-scale bars, and custom label formatting. ### Workflow and Best Practices - **Complete Workflow Example**: A comprehensive example showcasing an end-to-end workflow. - **Error Handling Patterns (3)**: Demonstrates effective strategies for handling errors. - **Performance Optimization Tips (2)**: Provides guidance on optimizing code for better performance. - **Debugging Patterns (2)**: Offers techniques for debugging SKILL code. - **Reusable Procedures (3)**: Presents examples of creating reusable code procedures. - **Best Practices (10)**: A list of recommended best practices for using the library. ### Troubleshooting - **Common Issues and Solutions**: A table outlining frequent problems and their resolutions. ``` -------------------------------- ### Tile Shapes: Simple Grid Example Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Creates a 3x3 grid of selected shapes with 100µm spacing horizontally and vertically. ```skill ; Tile selected shapes in 3×3 grid with 100µm spacing ; xSteps = {100, 0} means move right ; ySteps = {0, -100} means move down tileShapes(3 3 list(100 0) list(0 -100)) ``` -------------------------------- ### Barcode Generation Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Demonstrates various ways to generate barcodes, including simple generation, multiple positions, programmatic control, and adding labels. Requires setup related to the GCA Barcode Generator API. ```SKILL ;; Simple barcode generation barcode("1234567890") ;; Barcode generation at a specific position barcode("ABCDEF", list(100:100)) ;; Programmatic barcode generation with options barcode("XYZ", list(200:200) "width=10:height=5:rotation=90") ;; Barcode generation with a label barcode("112233", list(300:300) "label=MyBarcode") ``` -------------------------------- ### Grid Displacement Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/06-types-and-structures.md Illustrates various X and Y displacements for grid tiling, including movement in different directions and no displacement. ```skill list(100 0) ; Move 100 units right per X step ``` ```skill list(0 -100) ; Move 100 units down per Y step ``` ```skill list(50 -50) ; Move right and down (diagonal) ``` ```skill list(100 100) ; Move right and up ``` ```skill list(0 0) ; No displacement (degenerate case) ``` -------------------------------- ### Layout Manipulation Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Demonstrates various layout manipulation utilities, including multi-mask generation, layer inversion, XOR operations, visualization, and shape tiling. These functions operate on the current layout context. ```SKILL ;; Generate multi-mask generateMultiMask(list(list("M1" 1) list("M2" 2))) ;; Invert a layer xorLayer("METAL1" "METAL2") ;; Visualize overlap viewOverlap("LAYER_A" "LAYER_B") ;; Tile shapes tileShapes(list(list("RECT" list(0:0 10:10))) list(100:100) "grid=5:5") ``` -------------------------------- ### Scale Bar Generation Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Provides examples for generating scale bars with automatic unit conversion and custom label formatting. The scalebar() function handles unit selection (nm, µm, mm) and label formatting. ```SKILL ;; Basic scale bar generation scalebar(100) ;; Scale bar with multi-scale units scalebar(1000 "units=um") ;; Scale bar with custom label formatting (printf-style) scalebar(500 "units=mm" "labelFormat=%.2f mm") ``` -------------------------------- ### Horizontal Text Alignment Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/06-types-and-structures.md Shows how to use different horizontal alignment values with the 'pgText' function. ```skill pgText("DESIGN" 10 "left" "bottom") ; Left-aligned ``` ```skill pgText("DESIGN" 10 "center" "bottom") ; Center-aligned (preferred) ``` ```skill pgText("DESIGN" 10 "c" "bottom") ; Center (short form) ``` ```skill pgText("DESIGN" 10 "right" "bottom") ; Right-aligned ``` -------------------------------- ### Vertical Text Alignment Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/06-types-and-structures.md Demonstrates the usage of different vertical alignment options with the 'pgText' function. ```skill pgText("LABEL" 10 "c" "bottom") ; Baseline at Y ``` ```skill pgText("LABEL" 10 "c" "middle") ; Vertically centered ``` ```skill pgText("LABEL" 10 "c" "top") ; Top edge at Y ``` ```skill pgText("LABEL" 10 "c" "B") ; Baseline (v2) ``` -------------------------------- ### Text Rendering Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Illustrates different text rendering scenarios using the pgText API, including basic rendering, auto-positioning, multi-line text, and custom fonts. Ensure the pgText API and relevant font maps are available. ```SKILL ;; Basic text rendering pgText("Hello, World!" list(50:50)) ;; Text rendering with auto-positioning pgText("Auto Positioned Text" list(100:100) "align=center:valign=middle") ;; Multi-line text rendering (pgText v2) pgText("First line\nSecond line" list(150:150) "v2=t") ;; Text rendering with a custom font (requires font map setup) pgText("Custom Font" list(200:200) "font=myFont.pf") ``` -------------------------------- ### Tile Shapes: Offset Grid Example Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Produces a staggered tiling pattern, similar to brickwork, by using asymmetrical step displacements. ```skill ; Staggered tiling like brickwork tileShapes(2 3 list(100 0) list(50 -80)) ; Columns offset horizontally by 50µm ``` -------------------------------- ### Example: XOR Layer in Cell Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Demonstrates how to use xorLayerInCell to XOR shapes on a specific layer (EBL1/EBL) within a bounding box (0:0 to 1000:1000) in a given cell view. ```skill cvid = dbOpenCellViewByType("myLib" "myCell" "layout" "maskLayout" "w") lpp = list("EBL1" "EBL")box = list(0:0 1000:1000) xorLayerInCell(cvid lpp bbox) dbClose(cvid) ``` -------------------------------- ### Scale Current Cell Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Demonstrates different ways to use scaleCurrentCell for resizing. Magnification factors can be integers or fractions. ```skill ; Double size scaleCurrentCell(2.0) ; Half size scaleCurrentCell(0.5) ; Convert between scales scaleCurrentCell(1.0/5.0) ; Scale to 1/5 size ``` -------------------------------- ### Tile Shapes: Diagonal Tiling Example Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Generates a diagonal array of shapes by offsetting steps both horizontally and vertically. ```skill ; Create diagonal array ; xSteps moves right and down ; ySteps moves right-down and further down tileShapes(4 4 list(50 -50) list(0 -100)) ``` -------------------------------- ### Custom LPP Shifts Configuration Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Provides an example of creating custom offset configurations for specific mask designs. This allows for tailored layer positioning. ```skill customShifts = list( list(list("Layer1" "Purpose1") list(0 5000)) list(list("Layer2" "Purpose2") list(5000 0)) list(list("Layer3" "Purpose3") list(0 -5000)) ) ``` -------------------------------- ### Label Assembly Example Source: https://github.com/mfilmer/skill/blob/master/_autodocs/05-scalebar-api.md Demonstrates how to assemble the scale bar label by concatenating a formatted string with a unit. The format string is substituted with the result of sprintf. ```skill label = strcat(formatStr " " unit) ; formatStr is substituted with sprintf result ; Examples: ; "5 mm" ; "100.0 um" ; "500 nm" ``` -------------------------------- ### Error Handling Patterns Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Illustrates common patterns for handling errors within the SKILL library. These examples focus on robust implementation and debugging strategies. ```SKILL ;; Example of error handling using condition-case (condition-case err (progn ; code that might raise an error (someFunctionThatMightFail)) (error (message) ; error handler (printf "An error occurred: %s\n" message) nil ; return nil or a default value on error ) ) ;; Example of checking return values for errors (let ((result (someFunction))) (if (eq result nil) (printf "Operation failed.\n") (printf "Operation successful: %s\n" result) ) ) ;; Example using a custom error signaling mechanism (if applicable) (let ((status (callFunctionAndCheckStatus))) (unless (eq status "OK") (error "Custom error: %s" status) ) ) ``` -------------------------------- ### Get Entry Layer for Visibility Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md If text renders but is not visible, ensure the layer is included in the LPP list by using `leGetEntryLayer()`. ```c leGetEntryLayer() ``` -------------------------------- ### pgTextInCell() Example: Multi-line and Custom Font Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Renders multi-line text with custom font settings, specifying alignment and font name. ```skill pgTextInCell(cvid lpp 100:200 "Line1\nLine2" 10 "c" "m" "CS") ``` -------------------------------- ### Font Map Structure Example Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Defines the expected structure for font map files, including character height, scale, spacing, and symbol definitions. ```skill fontMap["height"] fontMap["scale"] fontMap["space"] fontMap["baselineSkip"] fontMap["symbols"] fontMap["symbols"][char]["library"] fontMap["symbols"][char]["cell"] fontMap["symbols"][char]["width"] ``` -------------------------------- ### SKILL LPP Shift Specification Examples Source: https://github.com/mfilmer/skill/blob/master/_autodocs/06-types-and-structures.md Specifies layers, offsets, and optional inversion for multi-mask generation. Use to define which layers to extract and how to process them. ```skill list(list("EBL1" "EBL") list(-5000 5000)) ; Extract layer EBL1, offset to top-left ``` ```skill list(list("EBL2" "EBL") list(5000 5000)) ; Extract layer EBL2, offset to top-right ``` ```skill list(list("EBL3" "EBL") list(-5000 -5000) list('negative 10000:10000)) ; Extract EBL3, invert within 10000×10000 zone ``` ```skill list(list("Metal1" "Metal") list(5000 -5000) list('negative 10000:10000)) ; Extract Metal1, offset and invert ``` -------------------------------- ### pgTextInCell() Example: Right-aligned, Baseline-aligned Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Renders text that is right-aligned horizontally and baseline-aligned vertically, using a specified font height and name. ```skill pgTextInCell(cvid lpp 500:300 "RIGHT" 12 "r" "B" "CS") ``` -------------------------------- ### Reusable Procedures Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Presents examples of reusable procedures or functions that can be incorporated into various workflows. These are designed for modularity and ease of use. ```SKILL ;; Procedure 1: A utility to get layer-purpose ID (defun getLppId (layerName purposeName) (let ((lpp (axlDBFindLayerPurpose layerName purposeName))) (if lpp (dbid lpp) nil ) ) ) ;; Procedure 2: A helper to create a simple rectangle (defun createRect (ll ur layerName purposeName) (let ((lppId (getLppId layerName purposeName))) (if lppId (axlCreateRect list(ll ur) lppId) nil ) ) ) ;; Procedure 3: A function to calculate bounding box center (defun getBboxCenter (bbox) (let ((ll (car bbox)) (ur (cadr bbox))) (list (xCoord ll) (yCoord ll)) ) ) ``` -------------------------------- ### Batch Load All Modules Source: https://github.com/mfilmer/skill/blob/master/_autodocs/07-module-index.md Shows how to load all project modules simultaneously using multiple 'load' commands in a single script. ```skill ; Load all modules at once load("barcode.il") load("pgText.il") load("pgText2.il") load("Layout_multiMask.il") load("Layout_layerXor.il") load("Layout_viewOverlap.il") load("Layout_viewUndercut.il") load("tileShapes.il") load("scalebar.il") ``` -------------------------------- ### Create and Configure CCSencapRodPcell Source: https://github.com/mfilmer/skill/blob/master/_autodocs/03-pcell-api.md Demonstrates creating an instance of CCSencapRodPcell and setting its width and length properties. The width can also be adjusted interactively. ```skill ; Create instance in trainingGrounds library ; Edit instance properties: ; w: 1.5 ; l: 0.8 ; Drag stretch handle to adjust width interactively ``` -------------------------------- ### Load and Use Individual Modules Source: https://github.com/mfilmer/skill/blob/master/_autodocs/07-module-index.md Demonstrates loading and using various modules like barcode, pgText, PCells, layout utilities, and scale bar. Each module is loaded and then its primary function is called. ```skill ; Load and use barcode module load("barcode.il") makeBarcode("SAMPLE") ; Load and use text module load("pgText.il") pgText("DESIGN" 10 "center" "middle") ; Load PCells (loads CDF automatically) load("SETPcell.il") ; PCells are now available for instantiation ; Load layout utilities load("Layout_multiMask.il") generateMultiMask() ; Load scale bar (requires pgText) load("pgText.il") load("scalebar.il") scalebar(50) ``` -------------------------------- ### Load and Instance CapPcell for Tunable Capacitors Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Loads the CapPcell definition and shows how to create capacitor instances with varying finger counts and lengths for capacitance tuning. ```skill ; 1. Load PCell load("CapPcell.il") ; 2. Create instances with different finger counts ; Instance 1: nFingers = 2, fLength = 1.0 ; Instance 2: nFingers = 4, fLength = 2.0 ; Instance 3: nFingers = 10, fLength = 5.0 ; 3. Compare capacitance scaling: ; Capacitance ∝ nFingers × fLength ; Result: Array of capacitors with tunable geometry ; Enables parametric design exploration ``` -------------------------------- ### bcode_writeCharacter Source: https://github.com/mfilmer/skill/blob/master/_autodocs/01-barcode-api.md Writes a barcode character (including special "start" and "stop" markers). ```APIDOC ## bcode_writeCharacter ### Description Writes a barcode character (including special "start" and "stop" markers). ### Method ```skill bcode_writeCharacter(char pos direction) ``` ### Parameters #### Path Parameters - **char** (character or string) - Required - Character to draw (single char) or special: "start", "stop" - **pos** (coordinate) - Required - Lower-left corner coordinate for character placement - **direction** (integer) - Required - Direction/scale factor ### Behavior: - Looks up character in `barcode_table` association table - Handles special case for "?" character - Calls `bcode_writeSequence()` with the character's encoding ``` -------------------------------- ### Create Parametric Device in Skill Source: https://github.com/mfilmer/skill/blob/master/_autodocs/README.md Load the necessary Skill library to create parametric devices. Instantiation is typically done through the Virtuoso PCells menu. ```skill load("SETPcell.il") ; Then instantiate from PCells menu in Virtuoso ``` -------------------------------- ### Create Parameterized Device Layout Source: https://github.com/mfilmer/skill/blob/master/_autodocs/07-module-index.md Demonstrates the creation of parameterized devices (PCells) in Skill. PCells auto-generate based on parameters, which can be edited in the instance properties dialog, and adjusted interactively using stretch handles. Requires Cadence Virtuoso and the CDF system. ```skill ; Create parameterized device ; PCells auto-generate based on parameters ; Edit parameters in instance properties dialog ; Stretch handles allow interactive adjustment ``` -------------------------------- ### Create CCSencapRodPcell Instance Source: https://github.com/mfilmer/skill/blob/master/_autodocs/03-pcell-api.md Instructions for creating an instance of the CCSencapRodPcell in the Cadence Virtuoso layout editor. ```skill ; In Cadence Virtuoso layout editor: ; File New Cell View ; Library: trainingGrounds ; Cell: encapRodPcell ; View: layout ; Type: layout ``` -------------------------------- ### Array Generation with SKILL Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Create repeated structures by designing a base unit, selecting it using `geSelectByTouch`, and then tiling it into an array with `tileShapes`. Specify the number of rows, columns, and the tiling offsets. ```skill ; Create repeated structures ; 1. Design base unit ; ... design shapes in cell ... ; 2. Select base pattern geSelectByTouch(100 100) ; Select shapes at position ; 3. Tile the pattern tileShapes(5 3 list(50 0) list(0 -75)) ; 5×3 array ``` -------------------------------- ### Provide User Feedback Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Use `printf()` to provide informative feedback to the user during script execution. This improves usability. ```c printf() ``` -------------------------------- ### Tile Shapes Usage Pattern Source: https://github.com/mfilmer/skill/blob/master/_autodocs/06-types-and-structures.md Demonstrates how to use grid displacement lists with the 'tileShapes' function to create a grid with specified spacing. ```skill ; Create 3×3 grid with 100µm horizontal spacing and 50µm vertical spacing tileShapes(3 3 list(100 0) list(0 -50)) ``` -------------------------------- ### Create and Configure SETPcell for Island Coupling Source: https://github.com/mfilmer/skill/blob/master/_autodocs/03-pcell-api.md Illustrates the creation of a SETPcell for fine-tuning island coupling. Parameters control electrical coupling, gate distances, island tuning, and overlap. ```skill ; Fine-tune island coupling: ; Create instance in trainingGrounds library ; Parameters control: ; channel width/gap (electrical coupling) ; gate distances (geometric control) ; island position/size (tunnel barrier tuning) ; overlap (fine adjustment of coupling) ``` -------------------------------- ### Load and Instance CCSencapRodPcell Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Loads the CCSencapRodPcell definition and provides instructions for creating an instance in Cadence with adjustable width and length. ```skill ; 1. Load the PCell definition load("CCSencapRodPcell.il") ; 2. In Cadence, create instance: ; File → New → Instance ; Library: trainingGrounds ; Cell: encapRodPcell ; View: layout ; 3. Edit instance properties (double-click): ; w = 2.0 (width in µm) ; l = 1.0 (length in µm) ; 4. Use stretch handle: ; Click centerRight edge of rectangle ; Drag to adjust width interactively ``` -------------------------------- ### Write Barcode Character Source: https://github.com/mfilmer/skill/blob/master/_autodocs/01-barcode-api.md Encodes and writes a single barcode character, including special 'start' and 'stop' markers. It looks up character encodings in a table and calls bcode_writeSequence. ```skill bcode_writeCharacter(char pos direction) ``` -------------------------------- ### Render Scaled Text with Custom Font Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Renders text with a specified height and alignment, using a custom font. This example demonstrates right-aligned and top-aligned text at a specific coordinate. ```skill ; Right-aligned, top-aligned, large font pgTextAtPosition(cvid lpp "TITLE" 20.0 "right" "top" 1000:1000 "ledit") ``` -------------------------------- ### Performance Optimization Tips Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Provides tips and techniques for optimizing the performance of SKILL code. Focuses on efficient data handling and algorithm choices. ```SKILL ;; Tip 1: Minimize database access in loops ;; Instead of: ;; (foreach obj (getSomeObjects)) ;; (dbTransformObject obj tform) ;; Use: ;; (let ((tform ...)) ;; (foreach obj (getSomeObjects)) ;; (dbTransformObject obj tform)) ;; Tip 2: Use efficient data structures ;; Prefer hash tables or arrays for quick lookups over lists when appropriate. ;; Example using hash table: ;; (let ((ht (make-hash-table :test 'eq))) ;; (putprop ht 'key1 'value1) ;; (getprop ht 'key1)) ``` -------------------------------- ### Visualize Undercut from Specific Cell Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Creates an undercut resist simulation for a specified cell view. Configuration includes undercut distance (`dxdy`), source layers (`lpp`), and output layers for exposed areas, undercut regions, and resist. ```skill dxdy = 0.2 ; Undercut distance in microns lpp = list("EBL1" "EBL") ; Source layer ``` ```skill source = deGetCellView() viewUndercutFromView(source) ; Opens window showing: ; - Original shapes (EBL1) ; - Undercut 0.2µm around shapes (EBL2) ; - Inverted bottom resist (EBL3) ``` -------------------------------- ### pgText v1 Workflow Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Illustrates the data flow for pgText version 1, involving setting reference points, retrieving coordinates, and creating/flattening instances for text rendering. ```skill pgText(userText, fontHeight, horizAlign, vertAlign, font) ↓ leHiSetRefPoint() ; Set reference point ↓ leGetRefPoint() ; Get coordinate ↓ pgTextAtPosition(cvid, lpp, userText, fontHeight, horizAlign, vertAlign, position, font) ↓ Open scratch cell: "polygonText" / "pgText_scratch" ↓ For each character: - Look up font_CHAR cell in "polygonText" library - dbCreateInst() in scratch cell - dbFlattenInst() ↓ dbTransformCellView() ; Scale scratch cell by fontHeight/baseCharHeight ↓ Update layer-purpose in scratch cell ↓ dbCreateInst() ; Instance scaled text into target cell ↓ dbFlattenInst() ; Flatten result ↓ dbClose(scratch_cvId) ``` -------------------------------- ### viewUndercutFromView(source_cvid) Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Creates a visualization of undercut resist for a specified cell. It simulates resist exposure, undercut expansion, and XOR operations to show exposed areas, undercut regions, and the resulting resist pattern. ```APIDOC ## viewUndercutFromView(source_cvid) ### Description Creates an undercut resist visualization for a specified cell view. This function simulates the effect of resist undercut by expanding shapes and performing XOR operations to generate layers representing exposed areas, undercut regions, and the final resist pattern. ### Method SKILL Function ### Endpoint N/A (SKILL function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **source_cvid** (cellView) - Required - The source cell view to visualize. ### Undercut Configuration ```skill dxdy = 0.2 ; Undercut distance in microns lpp = list("EBL1" "EBL") ; Source layer ``` ### Behavior 1. **Setup**: Opens temporary and output cells, and a layout viewer. 2. **Flattening**: Instances the source cell and flattens it. 3. **Shape Processing**: Extracts shapes, creates original and expanded (undercut) copies, and sets the undercut layer. 4. **Resist Simulation**: Creates bottom resist layer and performs XOR operations to simulate undercut holes and bridge areas. 5. **Cleanup**: Deletes temporary objects and closes the temporary cell. ### Result Layers - **EBL1** (Layer): Represents exposed areas (original shapes). - **EBL2** (Layer): Represents undercut regions. - **EBL3** (Layer): Represents bottom resist with undercut holes cut out. ### Request Example ```skill ; Visualize undercut for mask design source = deGetCellView() viewUndercutFromView(source) ; Opens window showing: Original shapes (EBL1), Undercut 0.2µm (EBL2), Inverted bottom resist (EBL3) ``` ### Response #### Success Response (200) N/A (SKILL function returns nil) #### Response Example nil ``` -------------------------------- ### Best Practices Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Outlines best practices for writing maintainable and efficient SKILL code. Covers aspects like naming conventions, code structure, and error handling. ```SKILL ;; Best Practice 1: Use meaningful variable and function names. ;; Avoid single-letter variables unless for loop counters (e.g., i, j). ;; Best Practice 2: Add comments to explain complex logic. ;; Document function arguments, return values, and side effects. ;; Best Practice 3: Encapsulate logic in functions. ;; Avoid large, monolithic scripts; break down functionality into smaller, reusable functions. ;; Best Practice 4: Handle errors gracefully. ;; Use condition-case or check return values to prevent unexpected script termination. ;; Best Practice 5: Be consistent with indentation and formatting. ;; Improves readability and maintainability. ;; Best Practice 6: Use let/letq for local variable bindings. ;; Use progn for sequencing expressions within a let. ;; Best Practice 7: Prefer `axl...` functions for layout operations. ;; They provide a higher-level, more robust interface. ;; Best Practice 8: Understand the difference between `let` and `letq`. ;; `letq` evaluates arguments before binding, `let` evaluates sequentially. ;; Best Practice 9: Use `dbid` to get database IDs when needed. ;; For functions that require database object IDs. ;; Best Practice 10: Test your code thoroughly. ;; Especially edge cases and error conditions. ``` -------------------------------- ### Load and Tune SETPcell for Device Design Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Loads the SETPcell definition and outlines the process for creating a single-electron transistor instance and tuning its parameters for optimized coupling and geometry. ```skill ; 1. Load PCell load("SETPcell.il") ; 2. Create instance with base parameters ; Library: trainingGrounds ; Cell: SETPcell ; 3. Tune parameters: ; - width/gap: Adjust drain-source geometry ; - gate1dist/gate2dist: Control gate placement ; - xOL/yOL: Fine-tune tunnel coupling ; - evapShift: Shift island position ; - islWidth: Adjust island size ; 4. Interactive tuning workflow: procedure(tuneSet(xol_start xol_end xol_step) for(xol xol_start xol_end xol_step ; Edit instance parameter xOL ; Evaluate SET performance ; Record results ) ) ; Result: Parameter-optimized SET device ``` -------------------------------- ### Resist Simulation with SKILL Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Simulate photoresist processing by visualizing undercut behavior with `viewUndercut` and adjusting the design by scaling the current cell. Use `scaleCurrentCell` to compensate for undercut. ```skill ; Simulate photoresist processing ; 1. Visualize undercut behavior viewUndercut() ; Shows undercut zone around shapes ; 2. Adjust design if needed scaleCurrentCell(1.1) ; Scale up slightly to compensate ``` -------------------------------- ### CDF Initialization Pattern Source: https://github.com/mfilmer/skill/blob/master/_autodocs/03-pcell-api.md A robust pattern for initializing Cell Description Files (CDFs). It ensures that the CDF is recreated fresh on script load, avoiding conflicts and keeping parameters current. ```SKILL let( (cellId cdfId) when(cellId = ddGetObj(library cell) ;; Delete existing CDF if present when( cdfId = cdfGetBaseCellCDF(cellId) cdfDeleteCDF(cdfId) ) ;; Create new CDF cdfId = cdfCreateBaseCellCDF(cellId) ;; Add parameters... cdfSaveCDF(cdfId) ) ) ``` -------------------------------- ### Visualize Undercut with Default Distance Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Opens a new window to simulate resist undercut for the active cell using a default undercut distance of 0.2 µm. ```skill viewUndercut() ``` -------------------------------- ### Project Overview and Module Index Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Provides a high-level overview of the project structure, module organization, and a quick reference for all exported functions. ```APIDOC ## Project Overview and Module Index ### Description This document offers a comprehensive overview of the project's organization, detailing module functionalities, a quick reference for all exported functions, and essential information for users. ### Module Organization - Functions are organized by functionality into distinct modules. ### Function Quick Reference - A consolidated list of all 35+ exported functions within the library. ### Global Information - **Global Variables and Constants**: Lists and describes globally accessible variables and constants. - **Type Summary**: A summary of all data types used in the project. ### Project Structure - **File Structure and Statistics**: Overview of the project's file organization and size metrics. - **Dependency Graph**: Visual representation of module dependencies. ### Usage and Workflows - **Typical Workflows**: Describes common usage scenarios and procedures. - **Loading Instructions**: Guidance on how to load and initialize the library. ### Support and Troubleshooting - **API Reference Cross-Index**: Links to detailed API documentation for each function. - **Feature Checklist**: Overview of implemented features. - **Performance Notes**: Tips and observations regarding performance. - **Known Limitations**: Lists any known issues or limitations. - **Troubleshooting Guide**: Provides solutions for common problems. ``` -------------------------------- ### viewUndercut() Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Opens a new window simulating undercut resist for the active cell. It calls `viewUndercutFromView` with the active cell view and uses a default undercut distance. ```APIDOC ## viewUndercut() ### Description Opens a new window showing undercut resist simulation for the active cell. This function uses a default undercut distance of 0.2 µm and calls `viewUndercutFromView`. ### Method SKILL Function ### Parameters None ### Return Type nil ### Behavior 1. Gets the active cell view. 2. Calls `viewUndercutFromView()` with the active cell view. ### Default Undercut Distance 0.2 µm ``` -------------------------------- ### Basic Text Placement (pgText v1) Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Use pgText to render text at a reference point with specified alignment and font size. The alignment options control how the text is positioned relative to the reference point. ```skill ; Render text at reference point, default font pgText("METAL_1" 10 "left" "bottom") ; Result: "METAL_1" rendered in left-bottom aligned text at design scale pgText("VIA_LAYER" 8 "center" "middle") ; Result: "VIA_LAYER" centered, middle-aligned pgText("SUBSTRATE" 6 "right" "top") ; Result: "SUBSTRATE" right-aligned at top ``` -------------------------------- ### Batch Operations for Performance Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Illustrates the performance benefit of batching similar operations (like shape copying, transformations, or layer operations) instead of executing them individually within a loop. ```skill ; Instead of multiple small operations: for(i 1 100 dbCopyShape(shape cvid transform) dbTransformCellView(cvid scale 0) dbLayerXor(...) ) ; Do all similar operations together: ; Copy all shapes for(i 1 100 dbCopyShape(shape cvid transform) ) ; Then transform once dbTransformCellView(cvid scale 0) ; Then XOR all at once dbLayerXor(...) ``` -------------------------------- ### Full Mask Documentation Workflow Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Demonstrates a complete workflow for mask documentation, including loading modules, adding identification elements like barcodes, scale bars, and text labels, generating mask quadrants, and verifying/documenting the generated quadrants. ```skill ; Load required modules load("barcode.il") load("pgText.il") load("scalebar.il") load("Layout_multiMask.il") ; Step 1: Design multi-layer pattern ; (create shapes on EBL1, EBL2, EBL3, Metal1) ; Step 2: Add identification ; Set reference point at top-left leHiSetRefPoint() ; Step 2a: Add barcode for machine reading makeBarcode("DESIGN_V1") ; Step 2b: Add scale bar for measurement scalebar(100) ; Step 2c: Add text label for humans pgText("Chip v1.0 - 2024-01" 5 "left" "bottom") ; Step 3: Generate mask quadrants generateMultiMask() ; Creates "DESIGN_quad" cell with 4 offset layers ; Step 4: Verify quadrant generation deOpenCellView("myLib" "DESIGN_quad" ...) ; Step 5: Document quadrant ; (repeat identification steps for quad cell) makeBarcode("QUAD_001") scalebar(50) ; Result: Complete documented mask with: ; - Original multi-layer design ; - Quad version with offset layers ; - Barcodes for stepper identification ; - Scale bars for measurement ; - Text labels for human reading ; - Ready for mask fabrication ``` -------------------------------- ### Scale Bar Creation and Text Labeling Workflow Source: https://github.com/mfilmer/skill/blob/master/_autodocs/05-scalebar-api.md Illustrates a typical workflow for adding a scale bar and text labels to a layout design. Ensure pgText module is loaded before calling scalebar. ```skill ; 1. Design layout ; 2. Add scale bar for documentation scalebar(10) ; 3. Add text labels pgText("DESIGN_V1" 5 "left" "bottom") ; 4. Save cell for documentation ``` -------------------------------- ### Basic Scale Bar Creation (Micrometers) Source: https://github.com/mfilmer/skill/blob/master/_autodocs/05-scalebar-api.md Creates a basic scale bar with a specified width in micrometers. The label is automatically generated based on the width. ```skill ; Create a 10 µm scale bar scalebar(10) ; Result: Rectangle 10 µm wide, 0.5 µm tall ; Label: "10 um" ``` -------------------------------- ### Handle File Operations Safely Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Before loading files, verify their readability to prevent errors and ensure safe file operations. ```c Check readability before loading ``` -------------------------------- ### Undercut Visualization Flow Source: https://github.com/mfilmer/skill/blob/master/_autodocs/04-layout-utilities-api.md Details the process for visualizing undercuts, including opening cell views, creating instances, flattening, copying and expanding shapes, and performing XOR operations for undercut and bridge holes. ```pseudocode viewUndercutFromView(source_cvid) ├─→ dbOpenCellViewByType (temp, dest cells) ├─→ dbCreateInst (source into temp) ├─→ dbFlattenInst (flatten all) ├─→ Find shapes on LPP ├─→ For each shape: │ ├─→ dbCopyShape (original) │ ├─→ dbCopyShape (undercut version) │ └─→ leSizeShape (expand undercut) ├─→ dbCreateRect (bottom resist) ├─→ dbLayerXor (undercut holes) ├─→ dbLayerXor (bridge holes) └─→ dbClose (temp) ``` -------------------------------- ### Debugging Patterns Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Illustrates common patterns and techniques for debugging SKILL code. Covers methods for inspecting variables and tracing execution flow. ```SKILL ;; Pattern 1: Using printf for variable inspection (let ((myVar 10)) (printf "myVar = %d\n" myVar) ; ... rest of the code ... ) ;; Pattern 2: Using trace to follow function calls (trace 'myFunction "myFunction called") (myFunction arg1 arg2) (untrace 'myFunction) ``` -------------------------------- ### Create and Configure CapPcell Source: https://github.com/mfilmer/skill/blob/master/_autodocs/03-pcell-api.md Shows how to create a typical capacitor Pcell with specified finger pairs and length. This configuration generates multiple primary and secondary fingers. ```skill ; Typical capacitor with 4 finger pairs and 5µm length ; Create instance in DM_utility library ; Set nFingers = 4 ; Set fLength = 5.0 ; Generates 4 primary + 5 secondary fingers interdigitated ``` -------------------------------- ### Inspect Variables at Each Step Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Check the values of key variables like cell view, layer, and bounding box during execution. This is useful for verifying data integrity and understanding the context. ```skill ; Check values at each step cvid = deGetCellView() printf("Cell: %s:%s\n" cvid~>libName cvid~>cellName) lpp = leGetEntryLayer() printf("Layer: %s:%s\n" nth(0 lpp) nth(1 lpp)) box = dbComputeBBoxNoNLP(cvid) printf("Bbox: %g:%g to %g:%g\n" nth(0 nth(0 bbox)) nth(1 nth(0 bbox)) nth(0 nth(1 bbox)) nth(1 nth(1 bbox))) ``` -------------------------------- ### Automatic Text Positioning (pgText v1) Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Place text labels by setting reference points in the Cadence layout editor and then rendering text at those points using pgText. This allows for interactive placement of text. ```skill ; Step 1: In Cadence layout editor, click to set reference point ; Step 2: In Skill console, render text at that point pgText("LABEL_1" 15 "center" "bottom") ; Step 3: Set new reference point, render again leHiSetRefPoint() pgText("LABEL_2" 15 "center" "bottom") ; Result: Multiple labels positioned via editor GUI ``` -------------------------------- ### Tile Shapes for Array Generation Source: https://github.com/mfilmer/skill/blob/master/_autodocs/07-module-index.md Selects shapes by touch and then tiles them according to specified dimensions and offsets. Requires Cadence Virtuoso. ```skill ; Select pattern, then tile it geSelectByTouch(100 100) tileShapes(5 3 list(100 0) list(0 -100)) ``` -------------------------------- ### pgText v2 Workflow Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Details the data flow for pgText version 2, including loading font maps, parsing strings, calculating metrics, and creating instances in a temporary cell. ```skill pgText(userText, fontHeight, horizAlign, vertAlign, font) ↓ leHiSetRefPoint() ↓ leGetRefPoint() ↓ pgTextAtPosition(position, userText, fontHeight, horizAlign, vertAlign, font) ↓ pgTextInCell(cvid, lpp, anchor, userText, fontHeight, horizAlign, vertAlign, font) ↓ Load font map: "SKILL/{font}.fontmap" ↓ parseString(userText, "\n") ; Split into lines ↓ Calculate line metrics and offsets ↓ Open temporary cell: "polygonText" / "pgText2_tmp" ↓ For each character per line: - Look up in fontMap["symbols"][char] - dbCreateInst() from specified library/cell - dbFlattenInst() ↓ dbTransformCellView() ; Apply scaling ↓ Update layer-purpose in temporary cell ↓ dbCreateInst() ; Instance into target cell ↓ dbFlattenInst() ↓ dbClose(tmp_cvid) ``` -------------------------------- ### Safe Text Rendering with Module Check Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Ensures the 'pgText' module is loaded before use, attempting to load it if not found. Useful for robust UI element rendering. ```skill ; Check for required module before using if(isCallable('pgText) then pgText("LABEL" 10 "left" "bottom") else printf("Error: pgText module not loaded\n") load("pgText.il") pgText("LABEL" 10 "left" "bottom") ) ``` -------------------------------- ### Common Issues and Solutions Source: https://github.com/mfilmer/skill/blob/master/_autodocs/INDEX.txt Addresses common problems encountered when using the SKILL library, providing solutions and workarounds. This section helps in troubleshooting and resolving typical issues. ```SKILL ;; Issue 1: "Undefined function" error ;; Solution: Ensure the function is defined or loaded before being called. Check the load path and function definitions. ;; Issue 2: Incorrect layer-purpose mapping ;; Solution: Verify layer and purpose names match the technology file. Use `axlDBFindLayerPurpose` to check existence. ;; Issue 3: Performance degradation with large datasets ;; Solution: Apply performance optimization tips, such as minimizing DB access in loops and using efficient data structures. ;; Issue 4: Script terminates unexpectedly ;; Solution: Implement robust error handling using `condition-case` or by checking function return values. ;; Issue 5: PCell parameter errors ;; Solution: Ensure parameter names and types match the PCell's CDF. Check for default values and constraints. ;; Issue 6: Barcode generation errors (e.g., invalid characters) ;; Solution: Validate input data against the supported character set and encoding rules for the barcode specification. ;; Issue 7: Text rendering issues (e.g., alignment, font problems) ;; Solution: Check text alignment parameters, ensure font maps are correctly loaded, and verify text rendering API version compatibility. ;; Issue 8: Layout manipulation producing incorrect geometry ;; Solution: Double-check input coordinates, layer names, and transformation parameters. Visualize intermediate steps if necessary. ;; Issue 9: Scale bar units or labels are incorrect ;; Solution: Verify the `units` and `labelFormat` arguments passed to the `scalebar` function. Ensure format strings are valid printf-style. ;; Issue 10: Issues with database object manipulation (e.g., `dbTransformObject`) ;; Solution: Ensure you are working with valid database IDs and that the transformation object is correctly defined. ``` -------------------------------- ### bcode_writeQuietZone Source: https://github.com/mfilmer/skill/blob/master/_autodocs/01-barcode-api.md Writes a quiet zone rectangle (blank space). ```APIDOC ## bcode_writeQuietZone ### Description Writes a quiet zone rectangle (blank space). ### Method ```skill bcode_writeQuietZone(pos direction) ``` ### Parameters #### Path Parameters - **pos** (coordinate) - Required - Starting coordinate - **direction** (integer) - Required - Direction/scale factor ### Behavior: - Creates 4 mm × 3 mm rectangle (scaled by direction) - Draws as single rectangle using `dbCreateRect()` ``` -------------------------------- ### Barcode Generation with Checksum Verification Source: https://github.com/mfilmer/skill/blob/master/_autodocs/01-barcode-api.md Shows how to generate a barcode for a string and verify table integrity using `bcode_verifyAsciiTable`. This function is useful for ensuring the accuracy of barcode data. ```skill ; Generate barcode and verify table integrity bcode_verifyAsciiTable(list('A 'B 'C 'D 'E)) makeBarcode("ABCDE") ``` -------------------------------- ### Add Basic Scale Bar Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Adds a 10 µm scale bar to the layout for measurement reference. Ensure the reference point is set before calling the function. ```skill ; Set reference point in layout editor leHiSetRefPoint() ; Add 10 µm scale bar scalebar(10) ; Result: 10 µm scale bar with "10 um" label ; Height: 0.5 µm ; Label height: 1.5 µm ``` -------------------------------- ### Add Multi-Scale Documentation Source: https://github.com/mfilmer/skill/blob/master/_autodocs/08-examples-and-patterns.md Documents a layout at four different measurement scales (1 µm, 10 µm, 100 µm, 1 mm) using custom formats for labels. This enables scale verification at multiple magnification levels. ```skill ; Fine scale reference leHiSetRefPoint() scalebar(1 "%2.1f") ; 1 µm scale bar, "1.0 um" ; Medium scale reference leHiSetRefPoint() scalebar(10 "%1.0f") ; 10 µm scale bar, "10 um" ; Coarse scale reference leHiSetRefPoint() scalebar(100 "%2.0f") ; 100 µm scale bar, "100 um" ; Large scale reference leHiSetRefPoint() scalebar(1000) ; 1000 µm = "1 mm" ; Result: Four scale bars at different magnifications ; Enables scale verification at multiple levels ``` -------------------------------- ### Create Cell Instance Source: https://github.com/mfilmer/skill/blob/master/_autodocs/03-pcell-api.md Creates an instance of a cell within a cell view. Requires the source cell view, target cell view (often nil), position, and orientation. ```SKILL dbCreateInst(cv sourcecv nil pos orient) ``` -------------------------------- ### Render Simple Text in Layout Source: https://github.com/mfilmer/skill/blob/master/_autodocs/02-pgtext-api.md Renders text with specified parameters in the active layout cell. Requires the active cell view ID and layer/purpose entry. ```skill ; Get active cell and layer cvid = deGetCellView() lpp = leGetEntryLayer() ; Render text at specific position pgTextAtPosition(cvid lpp "LABEL" 5.0 "center" "top" 100:200 "ledit") ```