Skill_Programming_5_0.lab
Skill_Programming_5_0.lab
Programming
Version 5.0
Lab Manual November 22, 2002
1990-2002 Cadence Design Systems, Inc. All rights reserved.
Printed in the United States of America.
Cadence Design Systems, Inc., 555 River Oaks Parkway, San Jose, CA 95134, USA
Cadence Trademarks
Alanza SM Gate Ensemble® Quest®
Allegro® HDL-ICE® Quickturn®
Ambit® how big can you dream?™ Radium™
Assura™ Integration Ensemble™ SignalStorm™
BuildGates® MegaSim™ Silicon Ensemble®
Cadence® (brand and logo) Mercury™ SoC Encounter™
CeltIC™ NC-Verilog® SourceLink® online customer support
ClockStorm™ OpenBook® online documentation library SPECCTRA®
CoBALT™ Orcad® SPECCTRAQuest™
Concept® Orcad Capture® Spectre®
Connections® Orcad Layout® TtME®
Diva® Palladium™ Vampire®
Dracula® Pearl® Verifault-XL®
ElectronStorm™ PowerSuite™ Verilog®
Fire & Ice® PSpice® Verilog®-XL
First Encounter® Q/Bridge® Virtuoso®
FormalCheck® QPlace® VoltageStorm™
Other Trademarks
All other trademarks are the exclusive property of their respective owners.
Confidentiality Notice
No part of this publication may be reproduced in whole or in part by any means (including photocopying or storage in an information storage/retrieval system)
or transmitted in any form or by any means without prior written permission from Cadence Design Systems, Inc. (Cadence).
Information in this document is subject to change without notice and does not represent a commitment on the part of Cadence. The information contained herein
is the proprietary and confidential information of Cadence or its licensors, and is supplied subject to, and may be used only by Cadence’s customer in
accordance with, a written agreement between Cadence and its customer. Except as may be explicitly set forth in such agreement, Cadence does not make, and
expressly disclaims, any representations or warranties as to the completeness, accuracy or usefulness of the information contained in this document. Cadence
does not warrant that use of such information will not infringe any third party rights, nor does Cadence assume any liability for damages or costs of any kind
that may result from use of such information.
RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the
Rights in Technical Data and Computer Software clause at DFARS 252.227-7013.
UNPUBLISHED This document contains unpublished confidential information and is not to be disclosed or used except as authorized by written contract with
Cadence. Rights reserved under the copyright laws of the United States.
Table of Contents SKILL Language Programming
Table of Contents
SKILL Language Programming
Module 3 Lists
Module 4 Windows
Module 6 Menus
Module 7 Customization
Lab 13-1 Enhancing the Layer Shape Report SKILL Program .................................................... 13-1
Requirements ........................................................................................................... 13-1
Suggestions .............................................................................................................. 13-2
Testing Your Solution.............................................................................................. 13-2
Sample Solution ....................................................................................................... 13-3
Lab 13-2 Creating a Cellview........................................................................................................ 13-4
Requirements ........................................................................................................... 13-4
Getting Started ......................................................................................................... 13-4
Writing Your Function............................................................................................. 13-5
Testing Your Solution.............................................................................................. 13-5
Lab 13-3 Aligning Rectangles....................................................................................................... 13-8
Requirements ........................................................................................................... 13-8
Testing Your Solution.............................................................................................. 13-8
Lab 13-4 Exploring Hierarchy..................................................................................................... 13-11
Opening a Design................................................................................................... 13-11
Retrieving a Cellview Database Object from a Window....................................... 13-11
Examining the Instance Masters ............................................................................ 13-12
Examining an Instance........................................................................................... 13-12
Querying the Master .............................................................................................. 13-13
Viewing the Master................................................................................................ 13-13
Lab 13-5 Traversing a Hierarchical Design ................................................................................ 13-15
Opening a Design................................................................................................... 13-15
Closing All the Master Cellviews .......................................................................... 13-17
Checking for Purged Cellview Database Objects.................................................. 13-17
Lab 13-6 Developing a Netlister ................................................................................................. 13-19
Requirements for the TriNetList Function ............................................................. 13-19
Requirements for the TrNetList Function .............................................................. 13-19
Testing Your Solution............................................................................................ 13-20
Sample Solution ..................................................................................................... 13-22
Lab 13-7 Developing an Instance-based Netlister....................................................................... 13-23
Requirements for the TriInstNetList Function ....................................................... 13-23
Requirements for the TrInstNetList Function ........................................................ 13-23
Testing Your Solution............................................................................................ 13-24
Sample Solution ..................................................................................................... 13-27
Lab 15-1 Adding a Menu Item to the Composer Edit Menu......................................................... 15-1
Studying the SKILL Source Code ........................................................................... 15-1
Loading the SKILL Source Code ............................................................................ 15-1
Checking the Trigger Function ................................................................................ 15-1
Opening a Design..................................................................................................... 15-2
Descending the Hierarchy........................................................................................ 15-2
Ascending the Hierarchy.......................................................................................... 15-3
Lab 15-2 Adding a Pull-Down Menu to a Composer Window..................................................... 15-5
Studying the SKILL Source Code ........................................................................... 15-5
Loading the SKILL Source Code ............................................................................ 15-5
Checking the User Postinstall Trigger ..................................................................... 15-5
Opening a Design..................................................................................................... 15-6
Descending the Hierarchy........................................................................................ 15-6
Ascending the Hierarchy.......................................................................................... 15-7
Lab 15-3 Reversing the Layout Editor Pull-Down Menus............................................................ 15-9
Studying the SKILL Source Code ........................................................................... 15-9
Loading the SKILL Source Code ............................................................................ 15-9
Opening a Design..................................................................................................... 15-9
Descending the Hierarchy...................................................................................... 15-10
Ascending the Hierarchy........................................................................................ 15-10
Lab 15-4 Customizing the Initial Window Placement ................................................................ 15-12
Requirements ......................................................................................................... 15-12
Planning Your Solution ......................................................................................... 15-12
Developing Your Trigger Function ....................................................................... 15-13
Introduction.............................................................................................................. 17-1
Lab 17-1 Exploring Associative Tables ........................................................................................ 17-2
Requirements ........................................................................................................... 17-2
Suggestions .............................................................................................................. 17-2
Testing Your Solution.............................................................................................. 17-3
Lab 17-2 Exploring Association Lists........................................................................................... 17-6
Requirements ........................................................................................................... 17-6
Suggestions .............................................................................................................. 17-6
Testing Your Solution.............................................................................................. 17-8
Lab 17-3 Exploring Disembodied Property Lists........................................................................ 17-12
Requirements ......................................................................................................... 17-12
Suggestions ............................................................................................................ 17-12
Module 18 OpenAccess
draw through Define a box by pressing the mouse button at one corner Draw
of the box, moving to the diagonally opposite corner of the ➝ through
box with the mouse button held down, and releasing the
button.
pop up Press the middle mouse button. Click
middle
pull down Move the mouse cursor to the menu name on the menu
banner, press and hold the left mouse button, move the
cursor down to highlight the menu selection, release the
mouse button to execute the selection.
Enter Type a command in an xterm window and press Return to
execute the command.
Select Position the cursor over a command and press the left
mouse button. Choose or pick are synonyms for select.
End of Lab
1. Log on to the system. At the Login prompt, enter your login ID.
user1
If you are not using CDE go to the section named Opening an xterm
Window.
2. Display the Root Menu by holding down the right mouse button.
3. Display the Root Menu by holding down the middle mouse button.
End of Lab
Here is a summary of the CIW pull-down menus for the icfb executable.
Options
1. Resize the CIW so that you can see at least 10 lines in the output
field of the CIW.
4. Click OK to execute the command and remove the form from the
screen.
The CIW output pane shows
■ SKILL output
■ Warnings
■ Error messages
1. Position the mouse pointer over the triangle at the top of the scroll
bar and click the left mouse button.
2. With the pointer still over the triangle at the top, press and hold the
left mouse button until you scroll all the way back.
3. Move the pointer over the rectangle in the scroll bar. Press the
middle mouse button and drag the rectangle to the bottom of the
scroll bar.
You’ll use vi to edit your .cdsinit file so that the next time you enter the
environment, the CDS log file display filter will be set as it is now (which is
not the default).
1. Click the left mouse button on the line 6*5 in the CIW output pane.
The line is pasted into the CIW input pane.
Lab Summary
■ Pasted a line from the CIW output pane into the input pane to
execute a SKILL expression again.
End of Lab
SKILL provides familiar operators for arithmetic computation. When all the
operands are integers, SKILL returns an integer result.
SKILL operators have precedence. Can you predict the values of the
following expressions?
You can use the SKILL trace facility to verify the order of evaluation.
When the SKILL trace facility is active, SKILL notifies you in the CIW
output pane before it evaluates an expression.
After evaluating the expression, SKILL notifies you of the return result.
■ to make it return
-196
■ to make it return
2744
■ to make it return
24
Answers
Lab Summary
End of Lab
Initializing a Variable
Use the variable name to retrieve the current value of the variable.
Incrementing a Variable
A SKILL variable can store any type of data. Use the type function to tell
what kind of data is currently in a variable.
Lab Summary
End of Lab
In this lab, you use the printf and println to display the values of variables in
the CIW output pane.
The println function uses the argument’s data type to determine how to
display it’s value.
2. Modify your solution to display the following line in the CIW output
pane.
The design Cells inverters schematic has many
shapes
Answers
Lab Summary
In this lab, you used the println and printf functions to display data in the
CIW.
End of Lab
1. Enter the following into the CIW exactly as shown. Notice there is
a missing " after the word lamb.
strcat( "mary had a little" " lamb )
2. Press Return.
Nothing happens.
4. Press Return.
Nothing happens.
Is the SKILL Evaluator occupied and therefore unable to respond?
Confirm that the SKILL Evaluator is available for your next command.
1. Enter the following into the CIW. Notice there is space after the
word strcat and the (
strcat ( "mary had a little" " lamb" )
3. Use the mouse to select your input line in the CIW output pane and
to paste it into the CIW input pane.
5. Press Return.
You see the following in the CIW:
"mary had a little lamb"
4. Press Return.
You see the following in the CIW:
"mary had a little lamb"
Summary
In this lab, you triggered input common errors and resolved them. The errors
were due to
■ Inappropriate space.
■ Mismatched data.
End of Lab
Lists
Lab 3-1 Creating New Lists
Objective: To build lists with the ’ operator and the list, cons,
and append functions.
2. Create a list containing the numbers 4, 5, and 6. Store the list in the
variable myNumbers.
Answers
The global variable _itemsperline governs how many list items per line
SKILL displays for a return result. Examine the current value of the variable.
2. Use the variables one, two, and three to create a list containing 1,2,
3, 2, 1 in that order. Store the list in the variable evenMoreNumbers.
Answers
Did you remember to use the list function instead of the ’ operator?
Answer
If we put 7 into a list, we could use the append function to add 7 to the end
of the list right.
How can we turn 7 into a list?
Answer
By using the list, cons and append functions, you use construct lists of
arbitrary depth and complexity.
3. Build list A with various combinations of the list function, the cons
function, the append function and the variables left and right.
Use the println function to display the list on a single line.
List A
( 1 2 3 ( 4 5 6 ) 1 2 3 )
4. Build list B with various combinations of the list function, the cons
function, the append function and the variables left and right.
Use the println function to display the list on a single line.
List B
( ( 1 2 3 ( 4 5 6 )) 1 2 3 )
5. Build list C with various combinations of the list function, the cons
function, the append function and the variables left and right.
Use the println function to display the list on a single line.
List C
( ( 1 2 3 ) ( 4 5 6 ) ( 1 2 3 ) )
Answers
Lab Summary
■ Built various hierarchical lists with the list, cons and append
functions.
End of Lab
Windows
Lab 4-1 Opening Windows
2. Look at the window and use its window number in place of INSERT
THE WINDOW NUMBER below. In the CIW, enter
designWindow = window( INSERT THE WINDOW NUMBER )
4. Supply the library name, cell name, and view name and click on OK.
The design appears.
Lab Summary
End of Lab
3. Retrieve the bounding box of the first design window you previously
opened. Assign it to the variable designBBox.
Answers
Resizing a Window
The CIW changes to match the size and position of the design
window exactly.
2. Resize the CIW to match the size and position of the text window
exactly.
Answers
Lab Summary
End of Lab
You establish a bindkey definition for both the Schematics and Layout
applications to raise the Command Interpreter Window.
After defining these two bindkeys, you can press a single key to view the
CIW or to view the current window.
You can thereby use a large CIW. Conversely, you can hide the CIW until
you need it.
Answers
To use the hiGetBindKey function to verify that the F8 key has no
bindkey definition, in the CIW enter
hiGetBindKey( "Command Interpreter" "<Key>F8" )
hiGetBindKey( "Schematics" "<Key>F8" )
hiGetBindKey( "Layout" "<Key>F8" )
Answers
To establish the Command Interpreter bindkey definition.
hiSetBindKey( "Command Interpreter"
"<Key>F8" "hiRaiseWindow( hiGetCurrentWindow() )" )
2. Open the master mux2 schematic cellview. Move the design window
so that it partially overlaps the CIW.
Open the master mux2 layout cellview and perform similar tests.
When you are satisfied that your bindkey definitions work, go on to the Lab
Summary.
Lab Summary
In this lab, you used the hiSetBindkey function to define the following
bindkeys:
■ A bindkey that raises the CIW for the Schematics and Layout
applications.
End of Lab
In this lab, you establish a bindkey on <Key>F8 for Show File windows to
clear the text selection.
Use this expression in your bindkey definition to clear the text selection in
the current window.
hiUnselectTextAll(
hiGetCurrentWindow())
Answers
Lab Summary
In this lab, you used the hiSetBindKey function to define a bindkey for the
Show File application.
End of Lab
Database Queries
Lab 5-1 Querying Design Databases
In this lab, you open several designs and make the following queries using
the ~> operator.
Opening a Design
Library master
Mode read
3. Click OK.
A Layout application window appears as the current window.
To query the design, you need to retrieve the cellView database object and
store it in a variable. The geGetWindowCellView function works on the
current window by default.
Making Queries
How many nets are in the design?
The system displays 6 in the CIW. There are 6 nets in this design.
What are the net names?
Lab Summary
In this lab, you queried several designs using ~> expressions. Each
expression retrieved one or more database object attributes.
End of Lab
Menus
Lab 6-1 Exploring Menus
In this lab, you examine SKILL source code to determine what the code does.
You validate your understanding by loading the source code and interacting
with menus.
Answer
Answer
The source code creates a pull-down menu named "Navigation" and installs
it in the leftmost position of the CIW menu banner.
Lab Summary
End of Lab
Customization
Lab 7-1 Defining Bindkeys in the .cdsinit File
In this lab, you define three bindkeys in your .cdsinit file. These three
bindkeys are immediately available the next time you access the Design
Framework II environment.
■ Two bindkeys raise the CIW to the top of the screen. One bindkey
applies to the Schematics application windows and the other
applies to Layout application windows.
■ A third bindkey raises the current window to the top of the screen
This bindkey applies to the Command Interpreter window.
2. Review the tests you performed to verify that the bindkeys behaved
appropriately.
In this lab, you perform these tests again.
1. Use the edit function to study the .cdsinit file for this course. In the
CIW, enter:
edit( "~/SKILL/.cdsinit" )
3. Use the editor to add your hiSetBindKey function calls after two
calls to the TrLoad function.
Answers
hiSetBindKey( "Schematics"
"<Key>F8" "hiRaiseWindow( window(1))" )
hiSetBindKey( "Layout"
"<Key>F8" "hiRaiseWindow( window(1))" )
Lab Summary
In this exercise, you edited the course .cdsinit file to make several bindkeys
immediately available to the user.
End of Lab
Requirements
Suggestions
Base your work on the TrBBoxHeight function discussed in the lecture. The
source code appears here:
procedure( TrBBoxHeight( )
let( ( ll ur lly ury )
ll = lowerLeft( bBox )
ur = upperRight( bBox )
lly = yCoord( ll )
ury = yCoord( ur )
ury - lly
) ; let
) ; procedure
■ Use the variables ll, ur, llx, lly, urx, ury, and area.
Note that you must use the %n specification because area might
be a floating point number.
2. If the value of writeProtect is not nil, then set it to nil. In the CIW,
enter
sstatus( writeProtect nil )
You can redefine any SKILL function you define while writeProtect
is nil.
2. If the editor variable indicates the wrong editor for you, change the
value of the editor variable. Assuming you prefer the textedit editor,
in the CIW, enter
editor = "textedit"
1. Enter the following skeletal definition in the file. You can omit the
comments.
procedure( TrBBoxArea( bBox )
;;; compute the area of bBox
;;; print the messag
printf( "Box %L area is: %n" bBox area )
area ;;; the return result
) ; procedure
2. Add source code statements to compute ll, ur, llx, lly, urx, ury and
finally area.
Try the following test cases. The bounding boxes have been chosen so that
you can compute their area easily yourself.
■ The square
Box ((100 100) (200 200)) area is: 10000
10000
Sample Solution
You compute the area of a bounding box that the user enters with the mouse.
You define a Layout bindkey that prompts the user for a bounding box and
calls the TrBBoxArea function to compute its area.
procedure( TrEnterBox()
enterBox(
?prompts ’( "First Corner" "Second Corner" )
?doneProc "TrEnterBoxCB"
)
) ; procedure
2. In the CIW, use the File ➝ Open command to open master mux2
layout.
Lab Summary
In this lab, you wrote a function that computes the area of a bounding box.
End of Lab
Flow of Control
Lab 9-1 Writing a Database Report Program
In this lab, you write a SKILL function that counts the shapes used in a
design. During the course, you will make several enhancements to this
program.
Requirements
Make the TrShapeReport function display a report in the CIW output pane
that includes the following items:
■ rectangle count
■ polygon count
■ path count
Suggestions
First Test
Second Test
Sample Solution
The following solution does not use local variables. You can enhance this
solution to make rectCount, polygonCount, pathCount, and miscCount
local.
procedure( TrShapeReport( wid )
rectCount = polygonCount = pathCount = miscCount = 0
cv = geGetWindowCellView( wid )
printf(
"%s %s %s contains:"
cv~>libName cv~>cellName cv~>viewName )
foreach( shape cv~>shapes
case( shape~>objType
( "rect" rectCount++ )
( "polygon" polygonCount++ )
( "path" pathCount++ )
( t miscCount++ )
) ; case
) ; foreach
printf( "\n%-10s %-10d" "Rectangles" rectCount )
printf( "\n%-10s %-10d" "Polygons" polygonCount )
printf( "\n%-10s %-10d" "Paths" pathCount )
printf( "\n%-10s %-10d" "Misc" miscCount )
) ; procedure
Lab Summary
■ a foreach loop
You use the load, edit, and view functions to develop your code and to test it.
End of Lab
The flow of control in a program that validates data can be complex. In this
lab, you write a SKILL function to validate a data item according to the
following definition.
Term Definition
Requirements
Recommendations
Use the following test cases in addition to other test cases of your own
choice.
TrValidatePoint( ’( 5 6 ) ) (56)
TrValidatePoint( list( 5:0 ) ) nil
TrValidatePoint( list( 5 "abc" )) nil
TrValidatePoint( list( 5 7 8 )) nil
Sample Solution
Lab Summary
End of Lab
In this lab, you write a SKILL function that tests whether one point is lower
and to the left of a second point, according to the following definition.
Term Definition
Requirements
Use the following test cases in addition to other test cases of your own
choice.
0:0 10:10 t
10:0 -1:-2 nil
-1:-2 10:0 t
Did you need to explicitly control the precedence of the <= and &&
operators?
Solution
Lab Summary
In this lab, you wrote a SKILL expression to test whether one point was lower
and to the left of another point. You used the
End of Lab
In this lab, you write two SKILL functions to build a bounding box according
to the following definition.
Term Definition
bounding box A list of two points. The first point in the list is
below and to the left of the second point.
Requirements
Suggestions
Notice that pt1 and pt2 can occupy the following corners of the bounding
box. In each of the four cases, you need to compute the coordinates of the
indicated lower-left and upper-right points. Consider using the min and max
functions to treat the four cases together.
pt2 pt1
pt1 pt2
pt1 pt2
pt2 pt1
TrMakeBBox( ’( 5 6 ) ) nil
TrMakeBBox( list( 5:0 6 ) ) nil
TrMakeBBox( list( 6 5:0 ) ) nil
TrMakeBBox( list( list( "z" ) 5:6 ) ) nil
TrMakeBBox( list( 0:0 5:6 ) ) ((00)(56))
TrMakeBBox( list( 5:6 0:0 ) ) ((00)(56))
TrMakeBBox( list( -5:-6 0:0 ) ) ( ( -5 -6 ) ( 0 0 ) )
TrMakeBBox( list( 0:6 5:0) ) ((00)(56))
TrMakeBBox( list( 5:0 0:6 ) ) ((00)(56)
Sample Solution
Lab Summary
In this lab, you wrote two SKILL functions to build a bounding box.
End of Lab
File I/O
Lab 10-1 Writing Data to a File
Objective: Use the infile, fprintf and close functions to write data
to a file.
2. Use the fprintf function to write the following line to the port:
No more lines
Answers
3. Since myPort has been closed, it is a good idea to set myPort to nil.
In the CIW, enter
myPort = nil
outportp( myPort )
1. Verify the contents of the file by starting the view function. In the
CIW, enter
view( "~/SKILL/FileIO/MyFile.text" )
Lab Summary
End of Lab
In this lab, you read data from the file you created in the preceding lab. You
can use the solution file.
Before you read data from a file, you need to obtain an input port.
Read a line from the file. Be aware of the order of the arguments to the gets
function.
The gets function returns the next line as a SKILL string and also
updates the value of nextLine. Notice that the string contains a "\n".
Answers
1. To read the next three lines from the file, enter the following in the
CIW:
gets( nextLine myPort )
gets( nextLine myPort )
gets( nextLine myPort )
You can paste the previous line from the log.
2. The gets function returns nil when positioned at the end of the file.
The variable nextLine is not automatically updated.
Continue with the lab.
Read words from a file and add each word to a list. The following steps guide
you.
2. To read the next word from the file, enter these two lines in the
CIW:
fscanf( myPort "%s" word )
word
3. Read the remaining words of the file. Initialize wordList to nil. Use
the cons function to add each word to a list, wordList.
Answers
1. To read the next word from the file and add it to the list in wordList,
enter these two lines in the CIW:
fscanf( myPort "%s" word )
wordList = cons( word wordList )
The first SKILL expression reads the next numeric data item and
stores its value in the variable number.
Answers
Lab Summary
End of Lab
In Lab 9-1, you wrote the TrShapeReport function. This function displays a
summary report in the CIW. In this lab, you enhance this function to send the
report to a temporary file and to display this file for the user in a Design
Framework II text window.
Requirements
Recommendations
Copy
procedure( TrShapeReport(...)
...
)
procedure( TrShapeReport(...)
...
)
■ Call the view function as follows. The second parameter, nil, asks
for the default bounding box.
view( "/tmp/ShapeReport.txt" nil "Shape Report" )
■ Replace each call to the printf function with a call to the fprintf
function. Be sure you include outport as the first argument.
First Test
Second Test
Solutions
Lab Summary
In this lab, you extended your TrShapeReport function to write its output to
a file and to display the file in a Show File window. You used these functions:
■ fprintf function
■ outfile function
■ close function
■ view function
End of Lab
1. In the CIW, use the File ➝ Open command to open master mux2
layout with Read.
A Layout application window displays master mux2 layout.
You loaded the source code for the TrShapeReport function when the SKILL
Debugger was installed. Therefore, the SKILL Development Environment
remembers the full pathname of the TrShapeReport source code file.
Lab Summary
End of Lab
In the previous lab, you assigned the window id of the design window to the
dwid variable. The rest of the lab assumes the window number is 7.
In the previous lab, you installed the SKILL Debugger. Verify that it is still
installed.
Setting a Breakpoint
Continuing Execution
You run the Shape Report program again. This time you use the Step
command to resume execution from the breakpoint at the entry to the
TriShapeReport program.
Each time you click Step, the system displays the SKILL expression that will
be executed as soon as you resume execution.
1. In the SKILL Debugger Toolbox, click Step several times, until the
system reaches the first call to the fprintf function.
Eventually, the system displays:
Debug 2>
ilStepCB()
stopped before evaluating fprintf(outport "%s %s %s contains:"
(cv~>libName)(cv~>cellName) (cv~>viewName))
To skip over the evaluation of the call to fprintf altogether, you can use the
Next command. The Debugger session continues with evaluation of the next
function invocation at the same depth.
Note: In this case, the Step command would have skipped over the
evaluation of fprintf because it is a built-in function.
You can use the Step command to step into the evaluation of the foreach
loop.
2. Click the Step command several more times until the system
displays the following:
ilStepCB()
stopped before evaluating miscCount++
You can use the Step Out command to skip the remaining evaluation of a
function.
Notice that the call to the close function is at the same level as the
call to the TriShapeReport function. You reenter the same Debugger
Session when the flow of control invokes another function at the
same level.
Lab Summary
End of Lab
3. Click OK.
SKILL Lint analyzes the ~/SKILL/DevEnv/Lint/TrShapeReport.il
file and displays the SKILL Lint Output window.
■ the cv variable
Resolve the following three problems. For each problem, edit and save the
source code file if necessary and run SKILL Lint again. Enter appropriate
package prefixes, such as Tr into the SKILL Lint form.
Answers
1. In the SKILL Lint form, you can list Tr as a package prefix. This
informs SKILL Lint that you own all global variables that start with
Tr.
Alternatively, you may get rid of the TrReportBBox variable since it
is used only once as an argument to the view function.
procedure( TrShapeReport( wid )
let( ( aPort )
thePort = outfile( "/tmp/ShapeReport.txt"
)
when( thePort
TriShapeReport( wid thePort )
close( thePort )
) ; when
view( "/tmp/ShapeReport.txt"
’((120 729) (372 876))
"Shape Report" )
) ; let
) ; procedure
Lab Summary
In this lab, you ran SKILL Lint and resolved several problems that it
uncovered.
End of Lab
List Construction
Lab 12-1 Revising the Layer Shape Report
In this lab, you use the setof and length functions to revise the TrShapeReport
function that you developed earlier.
Requirements
1. Using the same designs as in Lab 9-1, run the old version of the
TrShapeReport function.
The CIW displays the report.
Sample Solution
rectCount = length(
setof( shape cv~>shapes shape~>objType == "rect" ))
polygonCount = length(
setof( shape cv~>shapes shape~>objType == "polygon" ))
pathCount = length(
setof( shape cv~>shapes shape~>objType == "path" ))
miscCount =
length( cv~>shapes ) -
( rectCount + polygonCount + pathCount )
Lab Summary
In this lab, you used the length and setof functions in a new version of the
TrShapeReport function.
Which version do you prefer? Why?
End of Lab
In this lab, you write a function that returns a list of descriptions of the shapes
in a design.
For the purposes of this lab, a shape description is a three element list that
identifies the object type, the layer name, and the layer purpose of a shape as
in this example:
( "rect" "metal1" "drawing" )
Requirements
Recommendations
■ Use the cons function to add the objType attribute onto the front
of the lpp list.
Test your function on the same designs you used in previous labs.
Sample Solution
Lab Summary
In this lab, you used the foreach mapcar function to process the list of shapes
in a design.
End of Lab
Data Models
bBox
net
Figure net
figs
name
Lab 13-1 Enhancing the Layer Shape Report SKILL Program
Requirements
Suggestions
■ Use the following printf statements for the report heading and for
each line in the report:
;;; for the report heading
printf(
"%-15s %-15s %-10s %-10s %-10s %-10s"
"Layer Name" "Layer Purpose"
"Rectangle" "Label" "Line" "Misc"
)
Sample Solution
case( shape~>objType
( "rect" ++rectCount )
( "line" ++lineCount )
( "label" ++labelCount )
( t ++miscCount )
) ; case
) ; foreach
printf( "\n%-15s %-15s %-10d %-10d %-10d %-10d"
LP~>layerName LP~>purpose
rectCount labelCount lineCount miscCount
)
) ; foreach
printf( "\nComplete" )
) ; let
) ; procedure
Lab Summary
In this lab, you developed a SKILL function that produces a report that tallies
the number of shapes on each layer purpose pair in a design.
End of Lab
■ Open a cellview.
Requirements
You can assume that the layer names and bounding boxes are valid.
Getting Started
Before you write the SKILL function, try the following steps to familiarize
yourself with the actions your function performs.
Sample Solution
Lab Summary
In this lab, you wrote a function that adds several rectangles to a cellview
using the dbCreateRect function.
End of Lab
In this lab, you develop a function to align several rectangles with a target
rectangle. The function aligns the top side of the rectangles.
Requirements
■ Move the rectangles so that their top edges are collinear with the
top edge of the first rectangle.
Suggestions
Use the foreach function to process each rectangle in the cdr( rectList ) list
as follows:
2. Use the geOpen function to put the master new layout cellview into
a window.
Repeat the following steps to test your function until you are satisfied.
Sample Solution
Lab Summary
In this lab, you wrote a SKILL function to align several rectangles with a
target rectangle.
End of Lab
Opening a Design
Mode read
3. Click OK.
A Composer window displays the master mux2 schematic design.
Examining an Instance
Lab Summary
End of Lab
Opening a Design
2. Determine the libraries that each of the masters came from. In the
CIW, enter
expandedHierarchy~>libName
SKILL displays:
("pCells" "pCells" "master" "pCells" "pCells"
"master" "cellTechLib" "cellTechLib"
)
SKILL displays:
("ptranA" "ntran" "nand2" "ntransistor" "ptransistor"
"Inv" "M1_POLY1" "M2_M1"
)
SKILL displays:
("layout" "layout" "layout" "layout" "layout"
"layout" "symbolic" "symbolic"
)
The next SKILL expression you enter uses the dbClose function to close all
the master cellviews that the TrHierarchyTraversal function opened. To
understand the rationale for the expression, consider the following points:
■ When you call the dbClose function, CDBA does not necessarily
purge the cellView database object from memory.
To check whether CDBA has purged a cellView database object, retrieve one
of the object attributes, such as the libName attribute.
■ It returns a list with nil or the value of the libName attribute for
each cellView database object.
dbGetq: Object is a purged/freed object. - db:41192492
dbGetq: Object is a purged/freed object. - db:41193516
dbGetq: Object is a purged/freed object. - db:40007724
dbGetq: Object is a purged/freed object. - db:40009772
dbGetq: Object is a purged/freed object. - db:40010796
dbGetq: Object is a purged/freed object. - db:40016940
(nil nil nil nil nil
nil nil nil
)
Because each element of the list is nil, you can conclude that CDBA
has purged all the master database objects in the expandedHierarchy
list.
Lab Summary
■ ~> operator to determine the library name, cell name and view
name of each master cellview in the expanded hierarchy.
End of Lab
Structure your netlister as two functions: the TrNetList function and the
TriNetList function. The prefix Tri indicates that the TriNetList function is an
internal or private Tr function.
2. Make the TriNetList function use the following format for the
netlist:
NET: <net name> TERM: <terminal name or "none" >
INST_TERM: <instTerm name1> INST: <instance name1>
INST_TERM: <instTerm name2> INST: <instance name2>
INST_TERM: <instTerm name3> INST: <instance name3>
...
Sample Solution
Lab Summary
End of Lab
Make the TriInstNetList function use the following format for the netlist:
INST: <inst name>
INST_TERM: <instTerm name1> NET: <net name1>
INST_TERM: <instTerm name2> NET: <net name2>
INST_TERM: <instTerm name3> NET: <net name3>
...
or
INST: <inst name> TERM: <terminal name> NET: <net name>
Sample Solution
Lab Summary
End of Lab
Opening a Design
2. Note the application window number in the upper right corner for
future use. In the CIW, enter the following but replace the #
character with the window number of the application window:
designWid = window( # )
topLevelCV = geGetWindowCellView( designWid )
3. Save your edits and exit the editor. In the CIW, enter
TrShowProp( topLevelCV )
The user-defined property names and values appear on a single line
in the CIW.
5. Save your edits and then exit the editor again. In the CIW, enter
TrShowProp( topLevelCV )
Sometimes you need a SKILL list of the name and value pairs. In the CIW,
enter
foreach( mapcar prop topLevelCV~>prop
list( prop~>name prop~>value ))
How does this compare with what the TrShowProp function does?
Answer
Lab Summary
End of Lab
Objective: Use the ~> operator and the Show File Browser to
dump database objects.
Opening a Design
3. Verify the object type of each element of the list. In the CIW
enter
mux2Layout~>instances~>objType
4. List the attribute names for the first instance. In the CIW, enter
car( mux2Layout~>instances )~>?
Each element of the list is an attribute name for the inst object type.
The Show File Browser writes all the attribute names and values for a
database object to a file and displays the file in a Show File window.
1. Scroll the Show File Browser window until a portion resembling the
following lines becomes visible:
(instances
("inst33513212" ...
...
)
) Remember that the database object
references you see are probably different.
3. Pop up the Browser menu and select Browse Selection with the
middle mouse button.
A Show File Browser appears for the instance.
You can retrace your steps through a sequence of Show File Browser
windows. Successive Show File Browser windows are linked in
a parent/child relationship.
1. In the current Show File Browser window, pop up the Browser menu
and select Raise Parent Browser.
The initial Show File Browser for the cellview database object
becomes the top window.
2. In your initial Show File Browser, pop up the Browser menu and
select Raise Most Recent Child Browser.
The Show File Browser for the inst database object becomes the top
window.
You can enter SKILL expressions into the CIW to aid to your exploration.
Another Browser menu option allows you to raise the CIW.
1. In either Show File Browser window, pop up the Browser menu and
select Raise CIW.
The CIW becomes the top window.
You can clear all the selected text in a Show File Browser window with the
Clear Selection command.
Lab Summary
End of Lab
In this lab, you execute the TrRoadMap SKILL function to build the Cellview
Data Model Road Map.
The TrRoadMap function accepts a single argument named wid. When you
call the TrRoadMap function, pass the window ID of a window that contains
an empty layout cellview. The TrRoadMap function calls several dbCreate*
functions to create the shapes that comprise the Cellview Data Model Road
Map.
2. Use the File ➝ New ➝ Cellview command to create the cell master
RoadMap layout.
A window appears. It is the current window.
The TrRoadMap function creates the road map. You might have to
use the Fit ➝ All command so you can view the road map.
Lab Summary
You built the Cellview Database Model Road Map as a layout cellview.
End of Lab
User Interface
Lab 14-1 Exploring Fixed Menus
■ The set function assigns the data structure of the menu item to the
symbol contained in theMenuSymbol variable. The set function is
related to the setq function that implements the = operator.
The variables, item1, item2, and so forth, now contain the data
structures for menu items.
In the next step, you attach the fixed menu to a design window.
Mode read
3. Click OK.
A Virtuoso window displays the master mux2 layout design. The
window has a fixed menu attached to its left side.
The system stores the data structure for the attached fixed menu in
the attachedMenu variable. You will refer to attachedMenu later.
The attached fixed menu disappears from the side of the application
window.
What is the return value?
You do not need to remove a fixed menu before adding another one.
Lab Summary
4. Move the cursor to the CIW to verify that you can pull down a menu.
A modeless dialog box does not prevent you from interacting with
the Design Framework II environment.
3. Move the cursor to the CIW to verify that you CANNOT pull down a
menu.
A modal dialog box prevents you from interacting with the Design
Framework II environment. Yet you can still interact with
applications outside the Design Framework II environment.
3. Move the cursor to the CIW to verify that you CANNOT pull down a
menu.
4. Move the mouse off the dialog box to verify you CANNOT interact
with any other window in the environment.
A system modal dialog box prevents you from interacting with all
applications, even those outside the Design Framework II
environment.
Lab Summary
End of Lab
■ TrFunctionListBox function
■ TrListFunctions function
■ TrFunctionListBoxCB function
A list box appears. It includes choices for all functions whose names
begin with hi and include Box.
5. Click Cancel.
The list box disappears.
Lab Summary
In this lab, you loaded and examined two sample List Box applications.
End of Lab
4. Interact with the form and compare the results with the code.
3. Interact with the form and compare the results with the code.
Requirements
Build a form to allow the user to change the name or size of a window.
Make the form have the title "window:1" where the appropriate window
number is substituted for 1.
Make OK and Apply use current field values to set the name of window and
to resize the window.
■ Name field.
A string field with prompt "Name".
The initial and default value should be the window’s name.
■ Height Field
A scale field with prompt "Height".
The initial and default value should be the current height of the
window.
The value range should be from 0 to the maximum allowable y
value.
■ Width Field
A scale field with prompt "Width".
The initial and default value should be the current width of the
window.
The value range should be from 0 to the maximum allowable x
value.
Assumptions
Assume that there will be only one instance of your form active at any single
time. This assumption is removed in a subsequent optional portion of this lab.
Suggestions
■ Use the -> operator with the various field symbols to access the
current value of each field. For example, access the current value
of widthField as follows:
theForm->widthField->value
3. Choose new values for the fields and click Apply. Do this several
times, observing the obvious changes to the size and name of the
CIW.
4. Click Defaults to establish the original field values and then click
Apply. Observe how the CIW reacts.
Optional Enhancements
2. Change field values in the three forms and apply the changes.
The windows revert to their original sizes and titles.
Sample Solution
Lab Summary
In this lab, you built a form that allows the user to change the name or size of
a window.
End of Lab
Advanced Customization
Lab 15-1 Adding a Menu Item to the Composer Edit Menu
Opening a Design
Mode read
3. Click OK.
A Composer window displays the master mux2 schematic design.
4. Verify that the Edit pull-down menu contains a menu item named
Example.
1. Select the instance named I1 in the design. The instance cell name is
nand2.
2. Descend the hierarchy into the symbol view of the instance master
by selecting Design ➝ Hierarchy ➝ Descend Read.
The Descend form appears.
4. Click OK.
The window displays the master nand2 symbol cellview.
Is this a Composer window?
Do you expect the Edit pull-down menu to contain the Example
menu item?
5. Verify that the Edit pull-down menu does not contain a menu item
named Example.
2. Verify that the Edit pull-down menu contains a menu item named
Example.
In the next lab exercise, you register another trigger for the schematic view
type. To prepare for the next exercise, unregister the current schematic trigger
function.
Lab Summary
End of Lab
Opening a Design
Mode read
3. Click OK.
A Composer window displays the master mux2 schematic design.
1. Select the instance named I1 in the design. The instance cell name is
nand2.
2. Descend the hierarchy into the symbol view of the instance master
by selecting Design ➝ Hierarchy ➝Descend.
The Descend form appears.
4. Click OK.
The window displays the master nand2 symbol cellview.
Is this a Composer window?
Do you expect the graphics window to contain the pull-down
Example Menu?
Lab Summary
End of Lab
Opening a Design
1. Select File—Open.
Mode read
3. Click OK.
A Virtuoso window displays the master mux2 layout design.
4. Verify that the pull-down menus in the Layout Editor window are in
reverse order.
1. Select the left-most instance in the design. The master cell name is
nand2.
2. Descend the hierarchy into the symbol view of the instance master
by selecting Design ➝ Hierarchy ➝ Descend Read.
The Descend form appears.
The window displays the master nand2 layout cellview.
Do you expect the graphics window to contain pull-down menus in
reverse order?
3. Verify that the pull-down menus in the master nand2 layout design
window are in reverse order.
2. Verify that the pull-down menus in the Layout Editor window are in
reverse order.
Lab Summary
End of Lab
Requirements
The user’s .cdsinit file specifies the bounding box in the global variable
Trmasklayoutiwp. For example,
Trmasklayoutiwp = ’((0 0) (500 500))
Caution
The user must invoke the Fit All command after the Layout Editor window
appears.
Answers
Your trigger function can call the hiResizeWindow function to resize the
Layout Editor window.
Your trigger function can use the args->window syntax to determine the
Layout Editor window ID.
Answers
deRegUserTriggers( "maskLayout"
nil
nil
’TrUserPostInstallTrigger
)
Lab Summary
You developed a user postinstall trigger function that resizes a Layout Editor
window.
End of Lab
Interprocess Communication
ipcWriteProcess
stdin
SKILL stdout
ipcReadProcess
Program
stderr
Complete this lab before doing subsequent lab exercises. In subsequent lab
exercises, you launch this program as a separate UNIX child process.
■ gets(p)
■ toupper(*p)
■ printf("%s \n" , s)
2. Enter more lines of text to capitalize. End each line with a Return.
The program displays each line capitalized.
Lab Summary
In this lab, you compiled and ran the C program that you use in subsequent
lab exercises.
End of Lab
Important
If you have not completed Lab 16-1, please do so before proceeding with this
lab.
■ ipcBeginProcess
■ ipcWaitForProcess
■ ipcWriteProcess
■ ipcReadProcess
■ ipcKillProcess
Lab Summary
End of Lab
Important
If you have not completed Lab 16-1, please do so before proceeding with this
lab.
■ TrUpperCase_Launch
■ TrUpperCase_Write
■ TrUpperCase_DataHandler
■ TrUpperCase_PostFunction
In the steps that follow, use the SKILL trace facility to observe the flow of
control involving these functions:
■ TrUpperCase_Write
■ TrUpperCase_DataHandler
■ TrUpperCase_PostFunction
End of Lab
Data Structures
Introduction
In these labs, you enhance the TrShapeReport function to count every kind of
shape in a design. You do not use a miscellaneous count. Instead of variables,
you use a dynamic data structure.
■ Association Table
Using an association table is the syntactically the easiest of the
three approaches.
■ Association List
Using an association is just about as straight forward as using an
association table, provided you choose the right format for each
entry.
In this lab, you revise your original TrShapeReport function to count every
kind of shape in a design.
You can use the sample solution for the TrShapeReport function. The sample
solution is in the ~/SKILL/FlowOfControl/Solutions/TrShapeReport.il file.
Requirements
Suggestions
After you traverse the design counting shapes, use the foreach function to
traverse the association table, displaying the counts in the CIW.
foreach( key shapeTable
...
) ; foreach
Continue with the lab after you have finished writing your
TrShapeReportAssocTable function.
First Test
Second Test
Sample Solution
printf(
"%s %s %s contains:"
cv~>libName cv~>cellName cv~>viewName )
foreach( key shapeTable
printf( "\n%-10s %-10d"
key ;;; objType
shapeTable[ key ];;; count
)
) ; foreach
t
) ; when
) ; let
) ; procedure
Lab Summary
In this lab, you wrote the TrShapeReportAssocTable function to count all the
shapes in a design.
End of Lab
In this lab, you revise your original TrShapeReport function to count every
kind of shape in a design.
You can use the sample solution for the TrShapeReport function. The sample
solution is in the ~/SKILL/FlowOfControl/Solutions/TrShapeReport.il file.
Requirements
Suggestions
Use a foreach loop to traverse the design. Each time around the loop, you
either increment an existing count in the association list or add an entry to the
association list.
The crucial decision is how to structure the entries in the association list.
Make the entries in the association list initially resemble the following:
( "rect" count 0 )
Answer
You can use the -> operator to access and update the count, since the example
is a disembodied property list!
2. Compare the above syntax with the syntax of the rplaca function to
change the 0 to 1 in the following:
example2 = ’( "rect" 0 )
rplaca( cdr( example2 ) cadr( example2)+1 )
Continue with the lab when you have finished writing the
TrShapeReportAssocList function.
First Test
Second Test
Sample Solution
printf(
"%s %s %s contains:"
cv~>libName cv~>cellName cv~>viewName )
foreach( entry shapeAssocList
printf( "\n%-10s %-10d"
car( entry );;; objType
entry->count;;; count
)
) ; foreach
t
) ; when
) ; let
) ; procedure
Lab Summary
In this lab, you wrote the TrShapeReportAssocList function to count all the
shapes in a design.
End of Lab
In this lab, you revise your TrShapeReport function to count every kind of
shape in a design.
You can use the sample solution for the TrShapeReport function. The sample
solution is in the ~/SKILL/FlowOfControl/Solutions/TrShapeReport.il file.
Requirements
Suggestions
Print the counters using the while function to traverse the disembodied
property list.
Why can’t you use a foreach loop?
Second Test
Sample Solution
Lab Summary
In this lab, you wrote the TrShapeReportDPL function to count all the shapes
in a design.
End of Lab
OpenAccess
End of Lab