You are on page 1of 170

CUSTOMER EDUCATION SERVICES

The Power of Tcl 1:


Becoming a Proficient
Tcl User
Student Guide
50-V-041-SSG-003 2004.12

Synopsys Customer Education Services


700 East Middlefield Road
Mountain View, California 94043

Workshop Registration: 1-800-793-3448

www.synopsys.com
Copyright Notice and Proprietary Information
Copyright  2005 Synopsys, Inc. All rights reserved. This software and documentation contain confidential and proprietary
information that is the property of Synopsys, Inc. The software and documentation are furnished under a license agreement and
may be used or copied only in accordance with the terms of the license agreement. No part of the software and documentation
may be reproduced, transmitted, or translated, in any form or by any means, electronic, mechanical, manual, optical, or otherwise,
without prior written permission of Synopsys, Inc., or as expressly provided by the license agreement.

Right to Copy Documentation


The license agreement with Synopsys permits licensee to make copies of the documentation for its internal use only. Each copy
shall include all copyrights, trademarks, service marks, and proprietary rights notices, if any. Licensee must assign sequential
numbers to all copies. These copies shall contain the following legend on the cover page:

“This document is duplicated with the permission of Synopsys, Inc., for the exclusive use of
__________________________________________ and its employees. This is copy number __________.”

Destination Control Statement


All technical data contained in this publication is subject to the export control laws of the United States of America. Disclosure to
nationals of other countries contrary to United States law is prohibited. It is the reader’s responsibility to determine the applicable
regulations and to comply with them.

Disclaimer
SYNOPSYS, INC., AND ITS LICENSORS MAKE NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO
THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE.

Registered Trademarks (®)


Synopsys, AMPS, Arcadia, C Level Design, C2HDL, C2V, C2VHDL, Cadabra, Calaveras Algorithm, CATS, CSim, Design
Compiler, DesignPower, DesignWare, EPIC, Formality, HSPICE, Hypermodel, iN-Phase, in-Sync, Leda, MAST, Meta, Meta-
Software, ModelTools, NanoSim, OpenVera, PathMill, Photolynx, Physical Compiler, PowerMill, PrimeTime, RailMill, RapidScript,
Saber, SiVL, SNUG, SolvNet, Superlog, System Compiler, Testify, TetraMAX, TimeMill, TMA, VCS, Vera, and Virtual Stepper are
registered trademarks of Synopsys, Inc.

Trademarks (™)
abraCAD, abraMAP, Active Parasitics, AFGen, Apollo, Apollo II, Apollo-DPII, Apollo-GA, ApolloGAII, Astro, Astro-Rail, Astro-Xtalk,
Aurora, AvanTestchip, AvanWaves, BCView, Behavioral Compiler, BOA, BRT, Cedar, ChipPlanner, Circuit Analysis, Columbia,
Columbia-CE, Comet 3D, Cosmos, CosmosEnterprise, CosmosLE, CosmosScope, CosmosSE, Cyclelink, Davinci, DC Expert, DC
Expert Plus, DC Professional, DC Ultra, DC Ultra Plus, Design Advisor, Design Analyzer, Design Vision, DesignerHDL,
DesignTime, DFM-Workbench, DFT Compiler, Direct RTL, Direct Silicon Access, Discovery, DW8051, DWPCI,
Dynamic-Macromodeling, Dynamic Model Switcher, ECL Compiler, ECO Compiler, EDAnavigator, Encore, Encore PQ, Evaccess,
ExpressModel, Floorplan Manager, Formal Model Checker, FoundryModel, FPGA Compiler II, FPGA Express, Frame Compiler,
Galaxy, Gatran, HDL Advisor, HDL Compiler, Hercules, Hercules-Explorer, Hercules-II, Hierarchical Optimization Technology, High
Performance Option, HotPlace, HSPICE-Link, iN-Tandem, Integrator, Interactive Waveform Viewer, i-Virtual Stepper, Jupiter,
Jupiter-DP, JupiterXT, JupiterXT-ASIC, JVXtreme, Liberty, Libra-Passport, Library Compiler, Libra-Visa, Magellan, Mars,
Mars-Rail, Mars-Xtalk, Medici, Metacapture, Metacircuit, Metamanager, Metamixsim, Milkyway, ModelSource, Module Compiler,
MS-3200, MS-3400, Nova Product Family, Nova-ExploreRTL, Nova-Trans, Nova-VeriLint, Nova-VHDLlint, Optimum Silicon,
Orion_ec, Parasitic View, Passport, Planet, Planet-PL, Planet-RTL, Polaris, Polaris-CBS, Polaris-MT, Power Compiler,
PowerCODE, PowerGate, ProFPGA, ProGen, Prospector, Protocol Compiler, PSMGen, Raphael, Raphael-NES, RoadRunner,
RTL Analyzer, Saturn, ScanBand, Schematic Compiler, Scirocco, Scirocco-i, Shadow Debugger, Silicon Blueprint, Silicon Early
Access, SinglePass-SoC, Smart Extraction, SmartLicense, SmartModel Library, Softwire, Source-Level Design, Star, Star-DC,
Star-MS, Star-MTB, Star-Power, Star-Rail, Star-RC, Star-RCXT, Star-Sim, Star-SimXT, Star-Time, Star-XP, SWIFT, Taurus,
TimeSlice, TimeTracker, Timing Annotator, TopoPlace, TopoRoute, Trace-On-Demand, True-Hspice, TSUPREM-4, TymeWare,
VCS Express, VCSi, Venus, Verification Portal, VFormal, VHDL Compiler, VHDL System Simulator, VirSim, and VMC are
trademarks of Synopsys, Inc.

Service Marks (SM)


MAP-in, SVP Café, and TAP-in are service marks of Synopsys, Inc.

SystemC is a trademark of the Open SystemC Initiative and is used under license.
ARM and AMBA are registered trademarks of ARM Limited.
All other product or company names may be trademarks of their respective owners.

Printed in the U.S.A.

Document Order Number: 50-V-041-SSG-003


The Power of Tcl 1 Student Guide

Synopsys Customer Education Services


Table of Contents

Unit VC: Centra: An Introduction


Unit Goal.......................................................................................................................VC-2
Public Chat....................................................................................................................VC-3
Say Yes, No, Laugh or Clap..........................................................................................VC-4
Markup the Foils ...........................................................................................................VC-5
Participate During Lecture ............................................................................................VC-6
If You Have a Question! ...............................................................................................VC-7
Headset?........................................................................................................................VC-8
If You Do not Have a Headset ......................................................................................VC-9
If You Have a Headset ................................................................................................VC-10
Are You Ready For the Workshop?............................................................................VC-11
If You Need to Step Out .............................................................................................VC-12
If Using Phone Conference .........................................................................................VC-13
Appendix.....................................................................................................................VC-14
Running the Labs 1/3 ..................................................................................................VC-15
Running the Labs 2/3 ..................................................................................................VC-16
Running the Labs 3/3 ..................................................................................................VC-17

Unit i: Introduction & Overview


What is Tcl? ...................................................................................................................... i-2
Workshop Goal ................................................................................................................. i-3
Share Scripting Applications ............................................................................................ i-4
Workshop Prerequisites .................................................................................................... i-5
Curriculum Flow............................................................................................................... i-6
Agenda .............................................................................................................................. i-7
By the End of Today, You Will Have:.............................................................................. i-8
Appendix........................................................................................................................... i-9
Icons Used in this Workshop .......................................................................................... i-10
Tcl Scripts are Based on Commands .............................................................................. i-11
References: Books........................................................................................................... i-12
References: Web ............................................................................................................. i-13
References: SolvNet Documentation .............................................................................. i-14
Translation of dcsh to Tcl ............................................................................................... i-15

Synopsys 50-V-041-SSG-003 i Tcl 1: Becoming a Proficient Tcl User


Table of Contents

Unit 1: Count Patterns in a String


Unit Objectives ................................................................................................................ 1-2
Important Components of a Tcl Script............................................................................. 1-3
Situation #1 ...................................................................................................................... 1-4
Output of report_constraint.............................................................................................. 1-5
Write a Tcl Script To . . . ................................................................................................. 1-6
What Command Is Used To . . ........................................................................................ 1-7
The Beginnings of a Tcl Script ........................................................................................ 1-8
Commands, Arguments and Grouping............................................................................. 1-9
tmp1212 Contains ALL Output ..................................................................................... 1-10
Does This Produce the Desired Results? ....................................................................... 1-11
Add Line Continuation .................................................................................................. 1-12
What Command Is Used To . . ...................................................................................... 1-13
First Tcl Script: Count TNV .......................................................................................... 1-14
What Command Is Used To . . ...................................................................................... 1-15
For Completeness........................................................................................................... 1-16
Caution With exec ......................................................................................................... 1-17
Write Scripts 100% in Tcl.............................................................................................. 1-18
What Command Is Used To . . ...................................................................................... 1-19
Instead of a File, Redirect to a Variable......................................................................... 1-20
Command Output and Return Value.............................................................................. 1-21
What Command Is Used To . . ...................................................................................... 1-22
Count Patterns In a String .............................................................................................. 1-23
It Would Be Nice if . . . ................................................................................................. 1-24
Capture TNV For a Report ............................................................................................ 1-25
Capture TNV Using a Variable...................................................................................... 1-26
Echo a Report to the Screen........................................................................................... 1-27
Group Exercise............................................................................................................... 1-28
Explanation: Capture All Output ................................................................................... 1-29
Explanation: Capture Only the Return Value ................................................................ 1-30
Instructor Availability During Lab................................................................................. 1-31
Lab 1: Count Library Cells ............................................................................................ 1-32
Lecture Will Resume At ................................................................................................ 1-33

Synopsys 50-V-041-SSG-003 ii Tcl 1: Becoming a Proficient Tcl User


Table of Contents

Unit 2: Control Flow, Math Functions and Procedures


Unit Objectives ................................................................................................................ 2-2
Adding Control Flow to Scripts....................................................................................... 2-3
Use Control Flow Commands.......................................................................................... 2-4
Logical Expressions and Operators.................................................................................. 2-5
Add to the Previous Example .......................................................................................... 2-6
Add in Error Catching...................................................................................................... 2-7
Other Control Flow Commands....................................................................................... 2-8
Time For Some Arithmetic!............................................................................................. 2-9
Details on Arithmetic Computations ............................................................................. 2-10
Your Own Command get_TNV..................................................................................... 2-11
Use Tcl Procedures ........................................................................................................ 2-12
More Details on Tcl Procedures..................................................................................... 2-13
Adding Arguments......................................................................................................... 2-14
Specifying Default Values for Arguments ..................................................................... 2-15
Global and Local Variables............................................................................................ 2-16
Procedure Variables are Local ....................................................................................... 2-17
Global Versus Local Namespaces.................................................................................. 2-18
Accessing Global Variables in a Procedure ................................................................... 2-19
More Details: global ...................................................................................................... 2-20
Command Result versus Output .................................................................................... 2-21
Output and Return Values of Procedures....................................................................... 2-22
Provide Explicit Return Values ..................................................................................... 2-23
What Happens Without an Explicit Return?.................................................................. 2-24
Gathering Information on Procedures............................................................................ 2-25
Two Tcl Commands for Lab.......................................................................................... 2-26
Be Successful In Lab...................................................................................................... 2-27
Most Importantly! .......................................................................................................... 2-28
Lab 2: Create a Command metrics................................................................................. 2-29
Lecture Will Resume At ................................................................................................ 2-30
Lab Review .................................................................................................................... 2-31
The Complete metrics Command .................................................................................. 2-32

Synopsys 50-V-041-SSG-003 iii Tcl 1: Becoming a Proficient Tcl User


Table of Contents

Unit 3: Strings, Lists and Pattern Matching


Unit Objectives ................................................................................................................ 3-2
Before Moving On . . . .................................................................................................... 3-3
Recall: What Are Strings? ............................................................................................... 3-4
What Are Lists? ............................................................................................................... 3-5
3 Types Pattern Matching on Strings or Lists .................................................................. 3-6
Globbing Versus Exact Pattern Matching........................................................................ 3-7
Globbing and Special Characters..................................................................................... 3-8
Exercise on Globbing....................................................................................................... 3-9
Use string match for Globbing....................................................................................... 3-10
Exercise on Globbing versus Exact ............................................................................... 3-11
What Are String Indices................................................................................................. 3-12
What Are List Indices .................................................................................................... 3-13
After Completing This Final Task ................................................................................ 3-14
Lab 3: Play With Strings and Lists ................................................................................ 3-15
Lecture Will Resume At ................................................................................................ 3-16

Unit 4: Practical Applications


Unit Objectives ................................................................................................................ 4-2
An Example with Lists and Globbing.............................................................................. 4-3
This Works – But It is Not Scalable! ............................................................................... 4-4
Use of the Command glob ............................................................................................... 4-5
What Happens If No Files Are Found?............................................................................ 4-6
Avoid Script Termination if No Files Found ................................................................... 4-7
Cut the Design Name From a String................................................................................ 4-8
An Example with Strings and Indices.............................................................................. 4-9
Step #1: Find the Appropriate Indices ........................................................................... 4-10
Try It Again - From a String to a List ............................................................................ 4-11
Which List Index is Appropriate?.................................................................................. 4-12
Group Exercise............................................................................................................... 4-13
Appendix........................................................................................................................ 4-14
Calculate TNV For Each Group..................................................................................... 4-15
What Should the Output Look Like? ............................................................................. 4-16
Recall the Output of report_constraint........................................................................... 4-17
Create a Script That Does Something Like . . ............................................................... 4-18

Synopsys 50-V-041-SSG-003 iv Tcl 1: Becoming a Proficient Tcl User


Table of Contents

Step #1: Break the Report String to a List ..................................................................... 4-19


Search Each Line for Key Characters ............................................................................ 4-20
Close, But Not Quite Perfect ......................................................................................... 4-21

Unit 5: Conclusion
Workshop Goal ................................................................................................................ 5-2
Congratulations! You Have Now.................................................................................... 5-3
Share Work Applications................................................................................................. 5-4
Continue to Play With Lab Exercises .............................................................................. 5-5
Course Evaluation............................................................................................................ 5-6
Thank You! ...................................................................................................................... 5-7
Appendix.......................................................................................................................... 5-8
Optional: After Completion of Workshop ....................................................................... 5-9
How to Download Lab Files (1/4) ................................................................................. 5-10
How to Download Lab Files (2/4) ................................................................................. 5-11
How to Download Lab Files (3/4) ................................................................................. 5-12
How to Download Lab Files (4/4) ................................................................................. 5-13

Unit CS: Customer Support


Synopsys Support Resources ........................................................................................ CS-2
SolvNet Online Support Offers..................................................................................... CS-3
SolvNet Registration is Easy......................................................................................... CS-4
Support Center: AE-based Support............................................................................... CS-5
Other Technical Sources ............................................................................................... CS-6
Summary: Getting Support ........................................................................................... CS-7

Synopsys 50-V-041-SSG-003 v Tcl 1: Becoming a Proficient Tcl User


Table of Contents

This page was intentionally left blank.

Synopsys 50-V-041-SSG-003 vi Tcl 1: Becoming a Proficient Tcl User


Centra
An Introduction

Synopsys Customer Education Services


© 2005 Synopsys, Inc. All Rights Reserved 2005-01-05

Centra: An Introduction VC-1


© 2005
Unit Goal

Participate comfortably and enjoy


learning in the Centra environment.

VC- 2

Centra: An Introduction VC-2


© 2005
Public Chat Public Chat

#1: Select the


Chat Button

Save the class log.

#2: Select
Public Chat

#3: Type hello and


select send

VC- 3

Centra: An Introduction VC-3


© 2005
Say Yes, No, Laugh or Clap Yes No

Select if all is ok.

Select an  if
you were unable
to use chat. Select a happy
face or clap if you
are having fun.

Press theor  icon again to deselect.

VC- 4

Centra: An Introduction VC-4


© 2005
Markup the Foils Markup Tools

For instructor only

Preferred markup tools

Now scribble
something!

VC- 5

Centra: An Introduction VC-5


© 2005
Participate During Lecture

I opened the
Yes No tool bar!
Circle the
Markup Tools
correct
command

I know
I know

Type the
Public Chat command

VC- 6

Centra: An Introduction VC-6


© 2005
If You Have a Question!

Raise hand to speak.


Lower hand by pressing icon again.

Please wait for the instructor to call on you.

VC- 7

Centra: An Introduction VC-7


© 2005
Headset?

Do you have
Yes No
a headset
with a
microphone?

VC- 8

Centra: An Introduction VC-8


© 2005
If You Do not Have a Headset

Private + public chat

Use private chat to ask questions!

VC- 9

Centra: An Introduction VC-9


© 2005
If You Have a Headset

Push and hold the Ctrl key on your


keyboard. Wait for the microphone to
highlight in yellow before speaking.

Release the Ctrl key when finished speaking.

VC- 10

Centra: An Introduction VC-10


© 2005
Are You Ready For the Workshop?

Do you have:
Yes No
 Printed lecture and lab materials?
 Printed job aid materials?

Are you ready to run the workshop labs?


Yes No
 Education Sphere:
 Close all network intensive applications
other than Centra and EducationSphere
 Your own workstation

VC- 11
Labs on EducationSphere will be available to you for 24 hours on each scheduled workshop day.

Centra: An Introduction VC-11


© 2005
If You Need to Step Out

Taking a break

VC- 12

Centra: An Introduction VC-12


© 2005
If Using Phone Conference

 Mute your phone during lecture:


 Do not forget to release the mute button to
ask questions
 Do not put the class on hold:
 Hold may initiate hold music!

VC- 13

Centra: An Introduction VC-13


© 2005
Appendix

Log on to EducationSphere

Centra: An Introduction VC-14


© 2005
Running the Labs 1/3
Step #1 Step #3
 Select “education” from the
“Project Name” pull down menu
Double click this
icon on your
windows desktop


Step #2 Type synopsys
for the User ID
Click the “Connect to
cluster” button on the
Design Sphere tool bar
 Type
education for
the Password

 Click Login
VC- 15

Centra: An Introduction VC-15


© 2005
Running the Labs 2/3
Please wait for the EducationSphere workspace window to appear.

Step #4

Use the same Login Name and Password from your


workshop confirmation email.
(The same information you typed in to log on to Centra)

VC- 16

Centra: An Introduction VC-16


© 2005
Running the Labs 3/3
You now have access to the UNIX environment to complete the lab exercises!

VC- 17

Centra: An Introduction VC-17


© 2005
This page was intentionally left blank.

Centra: An Introduction VC-18


© 2005
The Power of Tcl 1
Becoming a Proficient Tcl User
2004.12

Synopsys Customer Education Services


© 2005 Synopsys, Inc. All Rights Reserved Synopsys 50-V-041-SSG-003

Introduction & Overview i-1


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
What is Tcl?

 A widely used scripting tool that was developed for


controlling and extending applications:
 Created by John K. Ousterhout at the University of
California, Berkeley
 Distributed as open source software
 Used by many Synopsys command shells

i- 2
Tcl Tool Command Language

For additional reading, refer to SolvNet “Using Tcl with Synopsys Tools”,
v2004.06.

Introduction & Overview i-2


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Workshop Goal

Increase productivity with Synopsys tools through


an exposure to and application of the most
frequently used Tcl commands.

i- 3

Introduction & Overview i-3


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Share Scripting Applications

Please share a:
Scripting application you are struggling with,
a script problem you have at work,
Public Chat a wished-for enhancement to an existing script
that you are hoping to resolve with the skills
learned in this workshop.

i- 4

Introduction & Overview i-4


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Workshop Prerequisites

 Have used Design Compiler, PrimeTime or Physical


Compiler
 Have a limited cut & paste experience with Tcl, but
have not actually written Tcl code

Do you meet the


Yes No prerequisites?

i- 5
Tcl Tool Command Language

Introduction & Overview i-5


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Curriculum Flow

Physical Compiler 1

h ere
u are
Yo
PrimeTime 1
The Power of Tcl 1:
Becoming a
Proficient Tcl User
Design Compiler 1
The Power of Tcl 2:
Creating High-Impact
Procedures
DFT Compiler 1

i- 6

Introduction & Overview i-6


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Agenda

DAY 1 Count Patterns in a String


1
Control Flow, Math Functions and
2 Procedures

3 Strings, Lists and Pattern Matching

4 Practical Applications

5 Conclusion

6 Customer Support

i- 7

Introduction & Overview i-7


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
By the End of Today, You Will Have:

Exercised the most frequently used Tcl components (the


stuff you will use every day) and touched the majority of the
commands you will learn in this series of courses (which you
will revisit and reuse in each course).

Use the skills you learn today one month from


now with minimal memory burden!

Lists

Strings Procedures

Math functions
Control flow

Pattern matching and


counting
i- 8

Introduction & Overview i-8


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Appendix

Icons Used in this Workshop


Tcl Commands
Tcl References
Books
Web
Synopsys SolvNet

Introduction & Overview i-9


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Icons Used in this Workshop

Lab Exercise Caution

Definition of
Recommendation
Acronyms

For Further Reference Fill in workbook

“Under the Hood”


Group Exercise
Information

i- 10

Introduction & Overview i-10


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Tcl Scripts are Based on Commands

Builtin Commands Provided by the Tcl interpreter itself.

Provided by Synopsys tools, written


as a command procedure in C or
Application Commands C++ using the Tcl extension
mechanism.

User Defined Commands Provided by you, written as a


command procedure in Tcl.

This workshop will teach


a mixture of all three
types of commands

i- 11

Introduction & Overview i-11


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
References: Books

 Tcl and the Tk Toolkit, John Ousterhout:


 The authoritative Tcl reference manual written
by the creator of Tcl

 Practical Programming in Tcl and Tk, Brent Welch:


 One of a number of excellent Tcl tutorials, this one written by
one of Prof. Ousterhout’s former grad students

i- 12

Introduction & Overview i-12


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
References: Web

 http://www.tcl.tk
 Tcl developers’ forum
 Tcl / Tk / TclPro download
 man pages, documentation, etc.
 http://tcl.sourceforge.net/faqs
 Tcl FAQ
 http://wiki.tcl.tk

i- 13

Introduction & Overview i-13


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
References: SolvNet Documentation

 Using Tcl with Synopsys Tools


 PrimeTime User Guide: Fundamentals:
 Unit 13: Command Interface and Tcl
 PrimeTime User Guide: Advanced Timing Analysis:
 Unit 2: Tcl Advanced Features
 Design Compiler Command Line Interface Guide
 Using Synopsys Synthesis Tools in xg Mode
Application Note
 You can Print, Search, and Download all of the
above via SolvNet

i- 14

Introduction & Overview i-14


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Translation of dcsh to Tcl

 The following Synopsys synthesis tools now support the new


XG mode which uses optimized memory management
techniques that increase a tool’s capacity and can reduce
runtime.
 Design Compiler
 DFT Compiler
 Power Compiler
 Physical Compiler
 Synopsys provides two utilities to help with the conversion
from dcsh to Tcl and to the new command set for DFT
Compiler
# For translation from dcsh to Tcl for Design Compiler scripts
unix% dc-transcript dcsh_script dctcl_script

# For translation from Tcl to the new command set for DFT Compiler
unix% db2xg dctcl_script xg_script

i- 15

Introduction & Overview i-15


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
This page was intentionally left blank.

Introduction & Overview i-16


The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Agenda

DAY 1 Count Patterns in a String


1
Control Flow, Math Functions and
2 Procedures

3 Strings, Lists and Pattern Matching

4 Practical Applications

5 Conclusion

6 Customer Support

Synopsys 50-V-041-SSG-003 © 2005 Synopsys, Inc. All Rights Reserved 1- 1

Count Patterns in a String 1-1


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Unit Objectives

After lecture, you should be able to:

 State the commands for counting patterns in a


string or file
 Recognize important components of a Tcl script

After lab, you should be able to:

 Use help resources


 Apply the above commands to count cells in
library report
 Analyze components of an unfamiliar script

1- 2

Count Patterns in a String 1-2


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Important Components of a Tcl Script

These words will be repeated, highlighted, and


reviewed throughout today.

Command Argument Grouping

Command Substitution Backslash Substitution

Variable Substitution

Command output Command return value

1- 3

Count Patterns in a String 1-3


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Situation #1

You want to count the total number


of setup violations in a design.

This information is needed for the


implementation team or for
determining subsequent compile
strategies.

Can you gather this


information from
Yes No
report_constraint?

1- 4

Count Patterns in a String 1-4


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Output of report_constraint

pt_shell> report_constraint –all_violators –max_delay


max_delay/setup ('clk' group)

Endpoint Slack
-------------------------------------------------------
Zro_Flag_reg/D -0.32 (VIOLATED)
RESULT_DATA[0] -0.31 (VIOLATED)
RESULT_DATA[1] -0.31 (VIOLATED)
RESULT_DATA[2] -0.31 (VIOLATED)
RESULT_DATA[3] -0.31 (VIOLATED)
RESULT_DATA[4] -0.31 (VIOLATED)
RESULT_DATA[5] -0.31 (VIOLATED)
Neg_Flag_reg/D -0.17 (VIOLATED)
Lachd_Result_reg[15]/D -0.17 (VIOLATED)
. . .
This report does NOT tally the total
number of setup violations (TNV)!

1- 5
TNV Total Number of Violations

Count Patterns in a String 1-5


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Write a Tcl Script To . . .

Execute the command


report_constraint
and redirect the output
to a temporary file.

 grep -c Use unix _________


Markup Tools  ls to count and report
TNV!

Delete the temporary


file.

1- 6
TNV Total Number of Violations

Count Patterns in a String 1-6


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Command Is Used To . . .

Execute the command


report_constraint redirect -file
and redirect the output
to a temporary file.

Use unix grep -c to


count and report TNV!

Delete the temporary


file.

1- 7
TNV Total Number of Violations

Count Patterns in a String 1-7


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
The Beginnings of a Tcl Script

Single line comments

# Count total number of setup violations


redirect –file tmp1212 {report_constraint –all_violators}

Redirect all output from


this command

To this file How are Tcl


commands
structured?

1- 8
The redirect command will redirect all output, meaning intermediate output (eg. error, warning or
informational messages and the report itself) as well as the result of the command.
When there are errors during a redirect, a summary message will be printed to the screen.

pt_shell> redirect -help


redirect # Redirect output of a command to a file
[-append] (Append output to the file)
[-tee] (Tee output to the current output stream)
[-file] (Output to a file (default))
[-variable] (Output to a variable)
target (Name of file/variable target for redirect)
command_string (Command to redirect. Should be in braces {}.)

Count Patterns in a String 1-8


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Commands, Arguments and Grouping

Mark the
Markup Tools key words.
argument
command argument (script)

redirect –file tmp1212 {report_constraint –all_violators}

argument
(switch)
{ } and " " define a single
argument – this is called grouping

1- 9

Count Patterns in a String 1-9


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
tmp1212 Contains ALL Output
unix% cat tmp1212

****************************************
Report : constraint
-all_violators
-max_delay Output of
Design : ORCA command
. . .
max_delay/setup ('clk' group)

Endpoint Slack
-------------------------------------------------------
Zro_Flag_reg/D -0.32 (VIOLATED)
RESULT_DATA[0] -0.31 (VIOLATED)
. . .
1
unix% Return value or
result of command May include Error or
Warning messages.

1- 10

Count Patterns in a String 1-10


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Does This Produce the Desired Results?

# Count total number of setup violations


redirect –file tmp1212 {report_constraint –all_violators}

Reports setup, hold as well as


Yes No design rule violations.

1- 11

Count Patterns in a String 1-11


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Add Line Continuation

Backslash substitution
used for line continuation

# Count total number of setup violations


redirect –file tmp1212 \
{report_constraint –all_violators –max_delay}

Yes No
Is grep a Tcl command?

1- 12
The characters \<newline> are replaced with a single space and is used for line continuation.

pt_shell> report_constraint –help


. . .
[-all_violators] (Show all constraint violators)
[-max_delay] (Only max_delay & setup)

Count Patterns in a String 1-12


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Command Is Used To . . .

Execute the command


report_constraint
and redirect the output
to a temporary file.

Use unix grep -c to


count and report TNV! exec

Delete the temporary


file.

1- 13
TNV Total Number of Violations

pt_shell> man exec


NAME
exec - Invoke subprocess(es)
SYNOPSIS
exec ?switches? arg ?arg ...?
DESCRIPTION
This command treats its arguments as the specification of one or more
subprocesses to execute. The arguments take the form of a standard shell
pipeline where each arg becomes one word of a command, and each distinct
command becomes a subprocess.

Count Patterns in a String 1-13


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
First Tcl Script: Count TNV

myscript.tcl

# Count total number of setup violations


redirect –file tmp1212 \
{report_constraint –all_violators –max_delay}
exec grep –c VIOLATED tmp1212

pt_shell> source myscript.tcl


 28

1- 14

Count Patterns in a String 1-14


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Command Is Used To . . .

Execute the command


report_constraint
and redirect the output
to a temporary file.

Use unix grep -c to


count and report TNV!

Delete the temporary file delete


file.

1- 15
TNV Total Number of Violations

pt_shell> man file


NAME
file - Manipulate file names and attributes
SYNOPSIS
file option name ?arg arg ...?
DESCRIPTION
This command provides several operations on a file's name or attributes. Name
is the name of a file; if it starts with a tilde, then tilde substitution is
done before executing the command (see the manual entry for filename for
details). Option indicates what to do with the file name. Any unique
abbreviation for option is acceptable. . .

Count Patterns in a String 1-15


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
For Completeness

# Count total number of setup violations


redirect tmp1212 \
{report_constraint –all_violators –max_delay -nosplit}
exec grep –c VIOLATED tmp1212
file delete tmp1212

command argument
argument
(option)

Identify the above


Yes No commands on job aid #1.
1- 16

Count Patterns in a String 1-16


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Caution With exec

 Use caution with exec:


 May cause a large memory footprint on some systems
which may result in the Synopsys tool running out of
memory
 Script execution depends on operating system

Show me another way to


Yes No
count patterns in a string.

1- 17
Tcl has a comprehensive set of system commands that allow you to write you scripts 100% in Tcl!
# Lists the contents of a directory
ls
# Returns total CPU time in seconds
cputime
# Returns peak memory usage in kbytes
mem
# Manipulate file names and attributes
file
# Manipulate strings
regexp/string/regsub
# File I/O
open/close/read/puts

Count Patterns in a String 1-17


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Write Scripts 100% in Tcl

Redirect the output of


report_constraint Suggest a command
Public Chat for this step.
to a Tcl variable.

Use a Tcl command to


count and report TNV!

1- 18

Count Patterns in a String 1-18


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Command Is Used To . . .

Redirect the output of


report_constraint redirect -variable
to a Tcl variable.

Use a Tcl command to


count and report TNV!

1- 19

Count Patterns in a String 1-19


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Instead of a File, Redirect to a Variable

# Count total number of setup violations


redirect –variable rptstring \
{report_constraint –all_violators –max_delay}

What is captured in
Public Chat rptstring?

1- 20

Count Patterns in a String 1-20


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Command Output and Return Value

" " used to define a single string


pt_shell> printvar rptstring
rptstring == "
****************************************
Report : constraint
-all_violators
-max_delay Output of command
Design : ORCA
. . .
max_delay/setup ('clk' group)

Endpoint Slack
-------------------------------------------------------
Zro_Flag_reg/D -0.32 (VIOLATED)
RESULT_DATA[0] -0.31 (VIOLATED)
. . .
1
" Return value or
result of command
1- 21

Count Patterns in a String 1-21


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Command Is Used To . . .
What Tcl
command will
count patterns
in a string?

Redirect the output of


report_constraint
to a Tcl variable.

Use a Tcl command to regexp -all


count and report TNV!

1- 22

Count Patterns in a String 1-22


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Count Patterns In a String

# Count total number of setup violations


redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
regexp –all VIOLATED $rptstring

Variable
substitution

1- 23
Variable substitution causes the $ and the variable name to be replaced by the value of the variable.

pt_shell> man regexp


NAME
regexp - Match a regular expression against a string
DESCRIPTION
. . .
-all
Causes the regular expression to be matched as many times as possible in the
string, returning the total number of matches found. If this is specified
with match variables, they will continue information for the last match only.

Count Patterns in a String 1-23


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
It Would Be Nice if . . .

You pt_shell> source myscript.tcl


currently  28
have pt_shell>

pt_shell> source myscript.tcl

Nicer 
 The total number of violations is 28
pt_shell>

1- 24

Count Patterns in a String 1-24


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Capture TNV For a Report

Redirect the output of


report_constraint to a
Tcl variable.

Use a Tcl command to


report and count TNV!

Capture TNV using a


set
Tcl variable.

Echo TNV to the


echo
screen.
1- 25
TNV Total Number of Violations

Count Patterns in a String 1-25


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Capture TNV Using a Variable

Mark the
Markup Tools key words.

Command substitution

set TNV [regexp -all VIOLATED $rptstring]

The return value (in this case, the


count) of this embedded command

is captured in this variable.

1- 26
The square brackets [ ] cause command substitution. Everything inside the square brackets and the
square brackets themselves are replaced with the return value of the embedded command execution.

Count Patterns in a String 1-26


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Echo a Report to the Screen
Variable substitution
set TNV [regexp -all VIOLATED $rptstring]
echo "\nThe total number of violations is\t$TNV"

Backslash substitution replaced


with newline and tab
respectively.
pt_shell> source myscript.tcl

 The total number of violations is 28
pt_shell>

echo outputs a newline


character after the string
1- 27
The characters \n and \t are substituted with a newline and tab respectively.

Count Patterns in a String 1-27


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Group Exercise

What happens if this


script is condensed
Public Chat
to a single line?

good.tcl
redirect –var rptstring \
{report_constraint –all_violators}
regexp –all VIOLATED $rptstring

nice_try.tcl
regexp –all VIOLATED [report_constraint –all_violators]

1- 28

Count Patterns in a String 1-28


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Explanation: Capture All Output

redirect captures all output of a command.

redirect –var rptstring {report_constraint –all}


regexp –all VIOLATED $rptstring

What are { }
Public Chat used for?

1- 29
The { } characters are used for grouping – to identify a single argument for the redirect command
in the example above.

Count Patterns in a String 1-29


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Explanation: Capture Only the Return Value

What are [ ]
Public Chat used for?

The command return value (not


the output) is captured.

set myresult [report_constraint –all_violators]


printvar myresult
 myresult == 1
regexp –all VIOLATED $myresult
 0

1- 30
The [ ] delimit an embedded command – report_constraint is executed and replaced with its
result.

Count Patterns in a String 1-30


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Instructor Availability During Lab

 During lab, the instructor will be available on Centra:


 Take advantage of this time to ask questions!
 Instructor may “walk around class” during lab using
shadow in EducationSphere:
 You may decline if you do not require help during lab

PHONE NUMBER ______________________

INSTRUCTOR

1- 31

Count Patterns in a String 1-31


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lab 1: Count Library Cells

10 Minute BREAK
20 Minute LAB

The objective is to:


• Apply the commands to count patterns in strings –
counting cells in a library report
• Analyze components of an unfamiliar script

1- 32

Count Patterns in a String 1-32


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lecture Will Resume At

1- 33

Count Patterns in a String 1-33


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
This page was intentionally left blank.

Count Patterns in a String 1-34


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Agenda

DAY 1 Count Patterns in a String


1
Control Flow, Math Functions and
2 Procedures

3 Strings, Lists and Pattern Matching

4 Practical Applications

5 Conclusion

6 Customer Support

Synopsys 50-V-041-SSG-003 © 2005 Synopsys, Inc. All Rights Reserved 2- 1

Control Flow, Math Functions and Procedures 2-1


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Unit Objectives

After lecture, you should be able to:

 State the commands for:


 Adding control flow to scripts
 Creating user defined commands
 Executing arithmetic functions

After lab, you should be able to:

 Apply the above commands to expand an


existing script to generate runtime metrics

2- 2

Control Flow, Math Functions and Procedures 2-2


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Adding Control Flow to Scripts
Design
Compiler
Example
Count and capture TNV

TNV < 20
 YES  YES
Markup Tools  NO Markup Tools  NO

Generate a timing
High effort compile
report

2- 3

Control Flow, Math Functions and Procedures 2-3


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Use Control Flow Commands

Logical expression

if {$TNV < 20} {


report_timing
} else {
compile –incr –map_effort high
}

Circle each argument for if.


Markup Tools
 Recall that { } define a single
argument.

2- 4
pt_shell> man if
NAME
if - Execute scripts conditionally
SYNOPSIS
if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ...
?else? ?bodyN?
DESCRIPTION
The if command evaluates expr1 as an expression (in the same way that expr
evaluates its argument). The value of the expression must be a boolean (a
numeric value, where 0 is false and anything is true, or a string value
such as true or yes for true and false or no for false); if it is true then
body1 is executed by passing it to the Tcl interpreter. Otherwise expr2 is
evaluated as an expression and if it is true then body2 is executed,
and so on. If none of the expressions evaluates to true then bodyN is
executed. The then and else arguments are optional ``noise words'' to make
the command easier to read. There may be any number of elseif clauses,
including zero. BodyN may also be omitted as long as else is omitted too.
The return value from the command is the result of the body script that was
executed, or an empty string if none of the expressions was non-zero and
there was no bodyN.

Control Flow, Math Functions and Procedures 2-4


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Logical Expressions and Operators

Use with numeric operands


< > <= >=
Boolean compare: Returns 0 if false, 1 if true.
== !=
Logical OR: Returns 0 if both operands are
||
zero, 1 otherwise.

Logical NOT: Returns 1 if operand is zero, 0


!
otherwise.

Logical AND: Returns 1 if both operands are


&&
non-zero, 0 otherwise.

0 is interpreted as false.
Any number other than 0 is interpreted
as true.

2- 5
Numeric operands refers to either integers or floating point.

To do string comparison and matching, it is preferable to use the string command. This
command is taught later in this unit.

pt_shell> man expr; # The expression in if statements are evaluated using expr
. . .
Operands may be specified in any of the following ways:
1. As an numeric value, either integer or floating-point.
2. As a Tcl variable, using standard $ notation. The variable's value
will be used as the operand.
3. As a string enclosed in double-quotes. The expression parser will
perform backslash, variable, and command substitutions on the information
between the quotes, and use the resulting value as the operand
4. As a string enclosed in braces. The characters between the open brace and
matching close brace will be used as the operand without any substitutions.
5. As a Tcl command enclosed in brackets. The command will be executed
and its result will be used as the operand.
6. As a mathematical function whose arguments have any of the above forms
for operands, such as sin($x). See below for a list of defined functions.

Control Flow, Math Functions and Procedures 2-5


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Add to the Previous Example

if {$TNV <= 20 && $TNV > 0} {


report_timing
} elseif {$TNV > 20} {
compile –incr –map_effort high
} else {
echo "There are no violations!"
}

What happens if
Identify operators TNV does not
Yes No on job aid #1. exist?

2- 6

Control Flow, Math Functions and Procedures 2-6


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Add in Error Catching
What must info return if the
Public Chat variable TNV does NOT exist?

if {[info exists TNV]} {


if {$TNV <= 20 && $TNV > 0} {
report_timing
} elseif {$TNV > 20} {
compile –incr –map_effort high
} else {
echo "There are no violations!"
}
}

2- 7
pt_shell> man info
. . .
info exists varName
Returns 1 if the variable named varName exists in the current context
(either as a global or local variable) and has been defined by being given a
value, returns 0 otherwise.

Control Flow, Math Functions and Procedures 2-7


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Other Control Flow Commands

if {expr} {body}

# Execute the body until expr is false


while {expr} {body}

# Execute start
# Execute body + next until expr is false
for {start} {expr} {next} {body}

break - Abort looping command


continue - Skip to the next iteration of a loop

2- 8

Control Flow, Math Functions and Procedures 2-8


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Time For Some Arithmetic!

if {$TNV == 0} {
set new_clk_skew [expr $old_clk_skew * 1.1]
set_clock_uncertainty $new_clk_skew CLK
compile –incr –map_effort high
} else {
report_timing
}

2- 9
The above script is NOT representative of a recommended compile strategy. It is a
simple example to illustrate the expr command.

Control Flow, Math Functions and Procedures 2-9


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Details on Arithmetic Computations
Integers are used until a floating-point number is
introduced, after which floating-point is used.

expr 10 + 5
 15
expr 10.0 + 5
 15.0
expr 12 / 7
 1
expr 12 / 7 + 3.0
 4.0
expr 12.0 / 7 + 3
 4.71428571429
2- 10
Available operators and functions with the expr command. More details available in the man pages.

MATH OPERATORS
- + ~ ! Unary minus, unary plus, bit-wise NOT, logical NOT
* / % Multiply, divide, remainder
+ - Add and subtract
<< >> Left and right shift
< > <= >= Boolean less, greater, less than or equal, and greater than or equal
== != Boolean equal and not equal
& | Bit-wise AND and OR
^ Bit-wise exclusive OR
&& || Logical AND and OR
x?y:z If-then-else, as in C
MATH FUNCTIONS
abs cosh log sqrt
acos double log10 srand
asin exp pow tan
atan floor rand tanh
atan2 fmod round
ceil hypot sin
cos int sinh
Control Flow, Math Functions and Procedures 2-10
© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Your Own Command get_TNV

In the script below, get_TNV is a?


Markup Tools
 command
 variable
Create your own
command to
calculate TNV.

if {[get_TNV] < 20} {


report_timing
} else {
compile –incr –map_effort high
}

2- 11

Control Flow, Math Functions and Procedures 2-11


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Use Tcl Procedures

proc get_TNV {} {
redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
regexp –all VIOLATED $rptstring
}

get_TNV.tcl

pt_shell> source get_TNV.tcl


pt_shell> get_TNV
 28

2- 12

Control Flow, Math Functions and Procedures 2-12


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
More Details on Tcl Procedures

Adding arguments
and default values

Global and local


variables

Command result
and command
output

2- 13

Control Flow, Math Functions and Procedures 2-13


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Adding Arguments

pt_shell> source get_TNV.tcl


pt_shell> get_TNV –max_delay
 28
pt_shell> get_TNV –min_delay
 3
What is
Public Chat
substituted for
proc get_TNV {max_or_min} { each example?
redirect –variable rptstring \
{report_constraint –all_violators $max_or_min}
regexp –all VIOLATED $rptstring
}

get_TNV.tcl

2- 14

Control Flow, Math Functions and Procedures 2-14


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Specifying Default Values for Arguments

proc get_TNV {{max_or_min –max_delay}} {


redirect –variable rptstring \
{report_constraint –all_violators $max_or_min}
regexp –all VIOLATED $rptstring
}

get_TNV.tcl

pt_shell> source get_TNV.tcl


pt_shell> get_TNV
  3

Markup Tools
  28
  Error: no value given for parameter
"max_or_min" to "get_TNV"
2- 15
Defaulted arguments, if any, must be the last arguments for the procedure. If a default is
not specified, the argument is required. The following example is provided for
clarification:

proc my_incr {value {increment 1}} {


expr $value + $increment
}
my_incr 42 3
 45
my_incr 42
 43
proc my_incr {{increment 1} value} {
expr $value + $increment
}
my_incr 3 42
 45
my_incr 42
 Error: no value given for parameter "value" to “my_incr"

Control Flow, Math Functions and Procedures 2-15


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Global and Local Variables

Adding arguments
and default values

Global and local


variables

Command result
and command
output

2- 16

Control Flow, Math Functions and Procedures 2-16


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Procedure Variables are Local

pt_shell> source get_TNV.tcl


pt_shell> get_TNV
 28
pt_shell> printvar rptstring
 Information: No variables matched 'rptstring'.

proc get_TNV {} {
redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
regexp –all VIOLATED $rptstring
}

get_TNV.tcl
2- 17

Control Flow, Math Functions and Procedures 2-17


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Global Versus Local Namespaces

A namespace is an encapsulation of commands and


variables to avoid interference with other namespaces.

Global
pt_shell> set rptstring "hello world"
pt_shell> get_TNV
proc get_TNV
 28
pt_shell> printvar rptstring
rptstring == "hello world" Local and
temporary

2- 18

Control Flow, Math Functions and Procedures 2-18


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Accessing Global Variables in a Procedure
proc silly_TNV {} {
global rptstring
redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
regexp –all VIOLATED $rptstring
}

silly_TNV.tcl

pt_shell> set rptstring “hello world”


pt_shell> source silly_TNV.tcl
pt_shell> silly_TNV
 28
pt_shell> printvar rptstring Public Chat


2- 19

Control Flow, Math Functions and Procedures 2-19


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
More Details: global

Only useful inside a procedure.

Typically the 1st line.

proc silly_TNV {} { Does not create the variable.


If the variable does not
global rptstring
exist – it remains that way!
if {[info exists rptstring]} {
echo "WARNING: Variable rptstring will be overwritten"
}
redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
regexp –all VIOLATED $rptstring
}

2- 20

Control Flow, Math Functions and Procedures 2-20


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Command Result versus Output

Adding arguments
and default values

Global and local


variables

Command result
and command
output

2- 21

Control Flow, Math Functions and Procedures 2-21


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Output and Return Values of Procedures

pt_shell> source get_TNV.tcl Output of


pt_shell> get_TNV command

 The total number of violations is 28


 28

Return value or
result of command

What command will


generate “command
Public Chat
output”?

2- 22

Control Flow, Math Functions and Procedures 2-22


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Provide Explicit Return Values

Circle the line below that generates:


Markup Tools Command output
Command return value

proc get_TNV {} {
redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
set TNV [regexp –all VIOLATED $rptstring]
echo "The total number of violations is $TNV"
return $TNV
}

2- 23
pt_shell> man return
NAME
return - Return from a procedure
SYNOPSIS
return ?-code code? ?-errorinfo info? ?-errorcode code? ?string?
DESCRIPTION
Return immediately from the current procedure (or top-level command or source
command), with string as the return value. If string is not specified then
an empty string will be returned as result.

Control Flow, Math Functions and Procedures 2-23


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Happens Without an Explicit Return?

proc get_TNV {} {
redirect –variable rptstring \
{report_constraint –all_violators –max_delay}
regexp –all VIOLATED $rptstring
}

get_TNV.tcl

The return value is the return value of the


last executed command in the procedure
body (in this example, the count).

2- 24

Control Flow, Math Functions and Procedures 2-24


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Gathering Information on Procedures

pt_shell> source get_TNV.tcl


pt_shell> info body get_TNV
redirect –variable rptstring \
{report_constraint –all_violators $max_or_min}
regexp –all VIOLATED $rptstring
pt_shell> info args get_TNV
max_or_min

Identify on
Yes No job aid #1.

2- 25

Control Flow, Math Functions and Procedures 2-25


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Two Tcl Commands for Lab

cputime Total CPU time in seconds

mem Peak memory usage in kbytes

2- 26

Control Flow, Math Functions and Procedures 2-26


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Be Successful In Lab

Use job aid #1

Use man pages unix% tclman

Use xemacs, Helps in finding those missing


emacs or vi braces and quotes!

2- 27
To set up man pages from the unix prompt, take a look at SolvNet article “How can I find
information on a command or variable I don’t know”, Doc ID 901270, last modified
05/09/2001

Control Flow, Math Functions and Procedures 2-27


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Most Importantly!

NO

Ask the instructor!

YES!

2- 28

Control Flow, Math Functions and Procedures 2-28


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lab 2: Create a Command metrics

10 Minute BREAK
30 Minute LAB

The objective is to:


• Apply the commands learned in lecture to expand an
existing script to generate runtime metrics

2- 29

Control Flow, Math Functions and Procedures 2-29


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lecture Will Resume At

2- 30

Control Flow, Math Functions and Procedures 2-30


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lab Review
Describe what
happens if this was a
Public Chat
local variable.

Echo the header message


Echo memory used since
beginning of process
Does the global variable
metrics_last_cputime exist?
Set the global variable
metrics_last_cputime to
NO YES the current cputime

echo CPU usage since Calculate and echo CPU


beginning of process usage since last metrics
Return ""

Describe what
happens if this last
Public Chat
step is eliminated.
2- 31

Control Flow, Math Functions and Procedures 2-31


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
The Complete metrics Command

proc metrics {header} {


# Use long variable names to avoid potential conflicts
global metrics_last_cputime

echo $header
if {![info exists metrics_last_cputime]} {
echo "CPU usage since beginning of process is [cputime] seconds"

} else {
set delta_cputime [expr [cputime] -$metrics_last_cputime]
echo "CPU usage since last metrics is $delta_cputime seconds"
}
echo "Maximum memory used since beginning of process is [mem] kbytes\n"

set metrics_last_cputime [cputime]


return ""
}

2- 32

Control Flow, Math Functions and Procedures 2-32


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Agenda

DAY 1 Count Patterns in a String


1
Control Flow, Math Functions and
2 Procedures

3 Strings, Lists and Pattern Matching

4 Practical Applications

5 Conclusion

6 Customer Support

Synopsys 50-V-041-SSG-003 © 2005 Synopsys, Inc. All Rights Reserved 3- 1

Strings, Lists and Pattern Matching 3-1


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Unit Objectives

After lecture, you should be able to:

 State what are strings


 State what are lists
 State three ways to perform pattern matching and
the distinction between exact and globbing
 State what are indices

After lab, you should be able to:

 Create and use “hello world” examples to explore


commands for lists and strings

3- 2

Strings, Lists and Pattern Matching 3-2


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Before Moving On . . .

You will see and use strings and lists in most Tcl scripts!

What are strings?


What are lists?
What is pattern matching?

What are indices?

Then, on to exciting applications of strings and lists!

3- 3

Strings, Lists and Pattern Matching 3-3


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Recall: What Are Strings?

Strings are a sequence of characters.


pt_shell> printvar rptstring
rptstring == "
****************************************
Report : constraint
-all_violators
-max_delay
Design : ORCA
. . .
max_delay/setup ('clk' group)

Endpoint Slack
-------------------------------------------------------
Zro_Flag_reg/D -0.32 (VIOLATED)
. . .
1
"
3- 4

Strings, Lists and Pattern Matching 3-4


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Are Lists?

Lists are an ordered group of elements.

strings embedded
lists

set mylist "red blue green"

Spaces used to separate


each element

Which of these two can be performed on strings?


Markup Tools
 Count patterns
 Tie them
3- 5

Strings, Lists and Pattern Matching 3-5


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
3 Types Pattern Matching on Strings or Lists

You will find pattern matching to be an essential


component for a variety of useful tasks.

Exact Related Tcl commands


lsearch
string
glob
Globbing

Regular Expressions (regexp –all)

3- 6

Strings, Lists and Pattern Matching 3-6


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Globbing Versus Exact Pattern Matching

Describe the
difference between
Public Chat
globbing and exact.

Pattern String Match?


Exact "hello world" "hello world" YES
"hello w4rld" "hello world" NO

Globbing "hello*" "hello world" YES


"*Good*" "hello world" NO

3- 7
The commands used to perform pattern matching for strings:
# Exact pattern matching
string exact pattern string
# Glob style pattern matching
string match pattern string
# Regular expression pattern matching and string extraction or counting
regexp
# Regular expression pattern matching and replacing
regsub

Strings, Lists and Pattern Matching 3-7


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Globbing and Special Characters

The pattern may contain these


special characters:

* Matches 0-n characters in the string


? Matches exactly 1 character in the string
[chars] Matches any single character in set in the string
\c Avoid interpretation of [ ] * ? in the pattern

3- 8

Strings, Lists and Pattern Matching 3-8


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Exercise on Globbing

Mark your answers below.


Markup Tools
1 is a successful match and 0 is fail.

Pattern String
sd_DQ* sd_DQ[2]
 1  0

sd_DQ\[?\] sd_DQ[22]
 1  0

sd_DQ\[[0-3]\] sd_DQ[1]
 1  0

3- 9

Strings, Lists and Pattern Matching 3-9


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Use string match for Globbing

Circle the pattern in each


Markup Tools command below.

string match {sd_DQ*} sd_DQ[2]


 1
string match {sd_DQ\[?\]} sd_DQ[22]
 0
string match {sd_DQ\[[0-3]\]} sd_DQ[1]
 1

3- 10
More information on the rules and the need for curly braces in the above examples
can be found in the next workshop The Power of Tcl 2: Creating high impact
procedures.

Strings, Lists and Pattern Matching 3-10


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Exercise on Globbing versus Exact

Are the
reports
identical? redirect –variable rpt1 {report_timing}
# Change the design mode
redirect –variable rpt2 {report_timing}

Exact string equal $rpt1 $rpt2

Globbing string match $rpt1 $rpt2

 Exact Recall that timing reports may


contain *’s and [ ]
Markup Tools  Globbing

3- 11
This example does NOT work exactly as shown above. Each timing report will have a
date stamp which will differ. This date stamp must be eliminated and then the remainder
of the timing report can be matched.

Strings, Lists and Pattern Matching 3-11


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Are String Indices

Every character in a string is assigned an index.

mydes/Verilog/ALU.v

0 end
1 end-1
2 end-2

Related Tcl
commands string last
string range
string index
string first
3- 12
The command that allows you to manipulate strings based on indices is string.

Strings, Lists and Pattern Matching 3-12


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Are List Indices

Every element in a list is assigned an index.

"red blue green white black yellow"

end
0 end-1
1 end-2
2
3

Related Tcl
commands lrange lreplace
lindex
lsearch linsert

3- 13

Strings, Lists and Pattern Matching 3-13


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
After Completing This Final Task

If you are using EducationSphere

To exit, click on the


EXIT button

3- 14

Strings, Lists and Pattern Matching 3-14


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lab 3: Play With Strings and Lists

10 Minute BREAK
20 Minute LAB

The objective is to:


• Create and use “hello world” examples to
explore Tcl commands for lists and strings

3- 15

Strings, Lists and Pattern Matching 3-15


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Lecture Will Resume At

3- 16

Strings, Lists and Pattern Matching 3-16


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Agenda

DAY 1 Count Patterns in a String


1
Control Flow, Math Functions and
2 Procedures

3 Strings, Lists and Pattern Matching

4 Practical Applications

5 Conclusion

6 Customer Support

Synopsys 50-V-041-SSG-003 © 2005 Synopsys, Inc. All Rights Reserved 4- 1

Practical Applications 4-1


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Unit Objectives

After lecture, you should be able to:

 State several applications for strings and lists


 State the commands for each example

4- 2

Practical Applications 4-2


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
An Example with Lists and Globbing

Read all the


pp_*.v files
myprojectdir

mydes libs

Verilog
√ pp_ORCA.v
X post_ORCA.v
√ pp_ALU.v
X post_ALU.v
√ pp_CLOCK_GEN.v Design
. . . Compiler

4- 3

Practical Applications 4-3


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
This Works – But It is Not Scalable!

read_verilog pp_ORCA.v
read_verilog pp_ALU.v
read_verilog pp_CLOCK_GEN.v
. . .

Show me a
Yes No better way.

4- 4

Practical Applications 4-4


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Use of the Command glob

Returns a list of UNIX file names that match a pattern


using globbing:

set design_files [glob ./mydes/Verilog/pp_*.v]


read_verilog $design_files

4- 5
pt_shell> man glob
NAME
glob - Return names of files that match patterns
SYNOPSIS
glob ?switches? pattern ?pattern ...?
DESCRIPTION
This command performs file name ``globbing'' in a fashion similar to the
csh shell. It returns a list of the files whose names match any of the
pattern arguments.

Practical Applications 4-5


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Happens If No Files Are Found?

set design_files [glob ./mydes/Verilog/pp_*.v]


read_verilog $design_files

run.tcl

pt_shell> source run.tcl


Error: no files matched glob pattern
"./mydes/Verilog/pp_*.v"
Information: script 'run.tcl' stopped at line 1 due to error.

Write a more
Yes No robust script.

4- 6

Practical Applications 4-6


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Avoid Script Termination if No Files Found

Do not generate Errors if no files are found.

set design_files [glob –nocomplain ./mydes/Verilog/pp_*.v]

Verify that at least


one design was
found before
reading?

4- 7

Practical Applications 4-7


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Cut the Design Name From a String

./mydes/Verilog/pp_ORCA.v ./mydes/Verilog/pp_ALU.v

read_verilog $design_files

Design You want to compile


Compiler the design contained
in each file.

current_design ORCA current_design ALU


compile compile

4- 8
The file name and the design name are assumed to be equivalent for the above example.

Practical Applications 4-8


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
An Example with Strings and Indices

Find the string index of the last


Find the string index
underscore. of the last .v

./mydes/Verilog/pp_ALU.v

Return the range in between


these indices.

Suggest the appropriate


Public Chat
command for each step.
(Use job aid #1)

4- 9

Practical Applications 4-9


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Step #1: Find the Appropriate Indices

Find the last underscore And the last .v

./mydes/Verilog/pp_ALU.v

foreach des $design_files {


set lwr_indx [expr [string last _ $des] + 1]
set upr_indx [expr [string last .v $des] – 1]
. . .
}

4- 10

Practical Applications 4-10


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Try It Again - From a String to a List

Circle the characters


Markup Tools used to split the string.

./mydes/Verilog/pp_ALU.v
split
{} /mydes/Verilog/pp ALU v

4- 11

Practical Applications 4-11


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Which List Index is Appropriate?

Circle the desired


Markup Tools list index.

./mydes/Verilog/pp_ALU.v
split
{} /mydes/Verilog/pp ALU v

list index 0 1 2 3

list index end-3 end-2 end-1 end

4- 12

Practical Applications 4-12


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Group Exercise

What does this


Public Chat command do?

proc mystery {lib} {


redirect -variable rptstring {report_lib $lib}
set rptlist [split $rptstring \n]
echo [lindex $rptlist \
[lsearch –glob $rptlist "*Time Unit*"]]
}

4- 13

Practical Applications 4-13


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Appendix

Optional Homework: Lab 3 Task 4


Calculate TNV for each group

Practical Applications 4-14


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Calculate TNV For Each Group

You want the TNV for


each group, not the
entire design!

4- 15

Practical Applications 4-15


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
What Should the Output Look Like?

pt_shell> rpt_TNV

max_delay/setup ('clk1' group)


Endpoint Slack
-------------------------------------------------------
The total number of violations is 35

max_delay/setup ('clk2' group)


Endpoint Slack
-------------------------------------------------------
The total number of violations is 8

4- 16

Practical Applications 4-16


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Recall the Output of report_constraint

pt_shell> report_constraint –all_violators

max_delay/setup ('clk1' group)


Endpoint Slack
-------------------------------------------------------
Zro_Flag_reg/D -0.32 (VIOLATED)
RESULT_DATA[0] -0.31 (VIOLATED)
RESULT_DATA[1] -0.31 (VIOLATED)
The total number of violations is 35
RESULT_DATA[2] -0.31 (VIOLATED)
RESULT_DATA[3] -0.31 (VIOLATED)
. . .
max_delay/setup ('clk2' group)
RESULT_DATA[4] -0.31 (VIOLATED)
RESULT_DATA[5]
The total number of violations -0.31
is 8 (VIOLATED)
Neg_Flag_reg/D -0.17 (VIOLATED)
. . .

4- 17
Use caution when parsing tool reports. Synopsys does not guarantee format of reports
from tool version to version.

Practical Applications 4-17


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Create a Script That Does Something Like . . .

Capture report_constraint as a string in rptstring

Split each line in rptstring to a list rptlist

Iterate for each line in this list

YES
*VIOLATED*? YES
NO

Echo that line Increment TNV


and reset TNV

4- 18

Practical Applications 4-18


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Step #1: Break the Report String to a List

proc rpt_TNV {} {
redirect –variable rptstring {report_constraint –all_violators}
set rptlist [split $rptstring \n]
}

****************************************
Report : constraint
-all_violators Each line is now an
-path slack_only
-max_delay
item in a list, the
Design : ORCA newlines removed.
****************************************

max_delay/setup ('IO_PCI_CLK' group)

Endpoint Slack
----------------------------------------------------------------
pad[22] -0.14 (VIOLATED)
pad[27] -0.14 (VIOLATED)

4- 19

Practical Applications 4-19


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Search Each Line for Key Characters

. . .
set TNV 0
foreach line $rptlist {
if {[string match *VIOLATED* $line]} {
incr TNV
} else {
echo $line
set TNV 0
}
}

4- 20
pt_shell> man incr
NAME
incr - Increment the value of a variable
SYNOPSIS
incr varName ?increment?
DESCRIPTION
Increments the value stored in the variable whose name is varName. The
value of the variable must be an integer. If increment is supplied then its
value (which must be an integer) is added to the value of variable
varName; otherwise 1 is added to varName. The new value is stored as a
decimal string in variable varName and also returned as result.

Practical Applications 4-20


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Close, But Not Quite Perfect

pt_shell> rpt_TNV
****************************************
Report : constraint
-all_violators
-path slack_only
Design : ORCA
****************************************
Forgot to write out
TNV!
max_delay/setup ('clk1' group)
Endpoint Slack
-------------------------------------------------------

max_delay/setup ('clk2' group)


Endpoint Slack
-------------------------------------------------------

See full script in Lab 3 . . .


4- 21

Practical Applications 4-21


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
This page was intentionally left blank.

Practical Applications 4-22


© 2005
The Power of Tcl 1: Becoming a Proficient Tcl User
Agenda

DAY 1 Count Patterns in a String


1
Control Flow, Math Functions and
2 Procedures

3 Strings, Lists and Pattern Matching

4 Practical Applications

5 Conclusion

6 Customer Support

Synopsys 50-V-041-SSG-003 © 2005 Synopsys, Inc. All Rights Reserved 5- 1

Conclusion 5-1
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Workshop Goal

Increase productivity with Synopsys tools through


an exposure to and application of the most
frequently used Tcl commands.

5- 2

Conclusion 5-2
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Congratulations! You Have Now Yeah!

Exercised the most frequently used Tcl components (the


stuff you will use every day) and touched the majority of the
commands you will learn in this series of courses (which you
will revisit and reuse in each course).

Use the skills you learn today one month from


now with minimal memory burden!

Lists

Strings Procedures

Math functions
Control flow

Pattern matching and


counting
5- 3

Conclusion 5-3
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Share Work Applications

Share an application at work where you


can apply one of the skills learned in
Public Chat
this workshop.

5- 4

Conclusion 5-4
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Continue to Play With Lab Exercises

Over the next week -


Gain comfort with or master,
complete or further explore
the lab exercises to maximize the effectiveness of
this workshop.

When do you plan


Public Chat
on doing this?

5- 5

Conclusion 5-5
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Course Evaluation

 Synopsys needs your feedback to improve our


courses
 Take the time to complete the course evaluation
directly upon the completion of this workshop

5- 6

Conclusion 5-6
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Thank You!

Happy Tcl Scripting!

5- 7

Conclusion 5-7
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Appendix

Uninstall DesignSphere
Download Workshop Labs At Any Time

Conclusion 5-8
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Optional: After Completion of Workshop

Uninstall
DesignSphere

Search for and discard the CentraOne directory

5- 9

Conclusion 5-9
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
How to Download Lab Files (1/4)
From the Synopsys home page select “Education & Support”

Then Select
Customer Education

5- 10

Conclusion 5-10
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
How to Download Lab Files (2/4)

Then Select
Download Labs

5- 11
Direct link: https://solvnet.synopsys.com/retrieve/002471.html

Conclusion 5-11
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
How to Download Lab Files (3/4)
After logging in through SolvNet, you will see:

Scroll
down
to the
Workshop

5- 12

Conclusion 5-12
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
How to Download Lab Files (4/4)

Click to Download Labs

Locate README file


Course will walk you through
Title decompression
and untar steps.

5- 13
A read me file should be present to help you unpack and untar the lab files.

Conclusion 5-13
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
This page was intentionally left blank.

Conclusion 5-14
The Power of Tcl 1: Becoming a Proficient Tcl User © 2005
Customer Support

© 2005 Synopsys, Inc. All Rights Reserved 20041220

Customer Support CS-1


© 2005
Synopsys Support Resources

1. Build Your Expertise:


Customer Education Services
 www.synopsys.com
 Workshop schedule and registration
 Download materials (SolvNet id
required)

2. Empower Yourself:
solvnet.synopsys.com
 Online technical information and
access to support resources
 Documentation & Media

3. Access Synopsys Experts:


Support Center

CS- 2

Customer Support CS-2


© 2005
SolvNet Online Support Offers
 Immediate access to the
latest technical
information
 Thousands of expert-
authored articles, Q&As,
scripts and tool tips
 Enter-a-call online
Support Center access
 Release information
 Online documentation
 License keys
 Electronic software
downloads
 Synopsys
announcements (latest
tool, event and product
information)

CS- 3

Customer Support CS-3


© 2005
SolvNet Registration is Easy
1. Go to solvnet.synopsys.com/
ProcessRegistration
2. Pick a username and password.
3. You will need your “Site ID” on
the following page.
4. Authorization typically takes
just a few minutes.

CS- 4

Customer Support CS-4


© 2005
Support Center: AE-based Support
 Industry seasoned Application Engineers:
 50% of the support staff has > 5 years applied experience
 Many tool specialist AEs with > 12 years industry experience
 Access to internal support resources
 Great wealth of applied knowledge:
 Service >2000 issues per month
 Remote access and debug via ViewConnect

Fastest access
 Contact us:
 Web “Enter A Call” from solvnet.synopsys.com
 E-Mail support_center@synopsys.com
 Phone 1-800-245-8005
 Business Hours: Monday - Friday, 7am - 5:30pm PST

CS- 5

Customer Support CS-5


© 2005
Other Technical Sources

 Application Consultants (ACs):


 Tool and methodology pre-sales support
 Contact your Sales Account Manager for more information
 Synopsys Professional Services (SPS) Consultants:
 Available for in-depth, on-site, dedicated, custom consulting
 Contact your Sales Account Manager for more details
 SNUG (Synopsys Users Group):
 www.snug-universal.org

CS- 6

Customer Support CS-6


© 2005
Summary: Getting Support

 Customer Education Services


 SolvNet
 Support Center
 SNUG

CS- 7

Customer Support CS-7


© 2005
This page was intentionally left blank.

Customer Support CS-8


© 2005
To provide you with the highest quality training and a meaningful
Course Evaluation learning experience, your feedback is used to continuously update the
Customer Education course content and training methodologies. Please
take a moment to express if your training needs were met. Thank you!

Course Title Your Name (print)


Course Start Date Company (print)
Location E-mail (optional)
Instructor Phone (optional)

Did you meet the pre-requisites prior to attending class? Yes No

Strongly Strongly Not


Agree Agree Neutral Disagree Disagree Applicable

Course Content and Materials

1. The course content met my expectations

2. The course met the stated objectives

3. The course length was long enough to cover the content

4. The time allotted for labs was long enough

5. The lab exercises helped in learning the course material

6. The visual aids used by the instructor were helpful

Instructor

7. The instructor was knowledgeable in the subject area

8. The instructor effectively used class time to enable me to


learn the key concepts

9. The instructor encouraged students to ask questions

10. Student questions were answered clearly and completely

11. The instructor was available and helpful during labs

Facilities and Registration

12. The quality of the facilities was conducive to learning

13. Classroom equipment was an effective tool in my learning

14. Registration process made it easy to enroll


5 4 3 2 1 0

Would you recommend this course to others? Yes No Continued 


5 0

Please provide contact information for any one you feel would benefit from one of our courses.
Name Name
Phone Number Phone Number
e-mail e-mail

Customer Education Services


Course Evaluation (continued)

What Units were the most valuable, least valuable for you and why?
Most:

Least:

What recommendations can you suggest for course improvement: materials and or presentation?

What topics require more coverage in class? Less coverage?


More:

Less:

Should the lab time be lengthened or shortened? Any lab in particular?

Should the course be made longer or shorter? Any unit in particular?

What suggestions would you offer the instructor to improve his/her delivery of the course?

What suggestions do you have for improving the classroom environment?

What follow up course(s) would you like to see?

What suggestions do you have that would make it easier to do business with us?

Your comments are sincerely appreciated. Please return the completed form to the instructor. Thanks!

8/01
Customer Education Services