compiler-03_practic
VC++6.0常见编译错误中英文对照表
VC++6.0常见编译错误中英文对照表fatal error C1003: error count exceeds number; stopping compilation中文对照:(编译错误)错误太多,停止编译分析:修改之前的错误,再次编译fatal error C1004: unexpected end of file found中文对照:(编译错误)文件未结束分析:一个函数或者一个结构定义缺少“}”、或者在一个函数调用或表达式中括号没有配对出现、或者注释符“/*…*/”不完整等fatal error C1083: Cannot open include file: 'xxx': No such file or directory 中文对照:(编译错误)无法打开头文件xxx:没有这个文件或路径分析:头文件不存在、或者头文件拼写错误、或者文件为只读fatal error C1903: unable to recover from previous error(s); stopping compilation 中文对照:(编译错误)无法从之前的错误中恢复,停止编译分析:引起错误的原因很多,建议先修改之前的错误error C2001: newline in constant中文对照:(编译错误)常量中创建新行分析:字符串常量多行书写error C2006: #include expected a filename, found 'identifier'中文对照:(编译错误)#include命令中需要文件名分析:一般是头文件未用一对双引号或尖括号括起来,例如“#include stdio.h”error C2007: #define syntax中文对照:(编译错误)#define语法错误分析:例如“#define”后缺少宏名,例如“#define”error C2008: 'xxx' : unexpected in macro definition中文对照:(编译错误)宏定义时出现了意外的xxx分析:宏定义时宏名与替换串之间应有空格,例如“#define TRUE"1"”error C2009: reuse of macro formal 'identifier'中文对照:(编译错误)带参宏的形式参数重复使用分析:宏定义如有参数不能重名,例如“#define s(a,a) (a*a)”中参数a重复error C2010: 'character' : unexpected in macro formal parameter list中文对照:(编译错误)带参宏的形式参数表中出现未知字符分析:例如“#define s(r|) r*r”中参数多了一个字符‘|’error C2014: preprocessor command must start as first nonwhite space中文对照:(编译错误)预处理命令前面只允许空格分析:每一条预处理命令都应独占一行,不应出现其他非空格字符error C2015: too many characters in constant中文对照:(编译错误)常量中包含多个字符分析:字符型常量的单引号中只能有一个字符,或是以“\”开始的一个转义字符,例如“char error = 'error';”error C2017: illegal escape sequence中文对照:(编译错误)转义字符非法分析:一般是转义字符位于 ' ' 或 " " 之外,例如“char error = ' '\n;”error C2018: unknown character '0xhh'中文对照:(编译错误)未知的字符0xhh分析:一般是输入了中文标点符号,例如“char error = 'E';”中“;”为中文标点符号error C2019: expected preprocessor directive, found 'character'中文对照:(编译错误)期待预处理命令,但有无效字符分析:一般是预处理命令的#号后误输入其他无效字符,例如“#!define TRUE 1”error C2021: expected exponent value, not 'character'中文对照:(编译错误)期待指数值,不能是字符分析:一般是浮点数的指数表示形式有误,例如123.456Eerror C2039: 'identifier1' : is not a member of 'identifier2'中文对照:(编译错误)标识符1不是标识符2的成员分析:程序错误地调用或引用结构体、共用体、类的成员error C2041: illegal digit 'x' for base 'n'中文对照:(编译错误)对于n进制来说数字x非法分析:一般是八进制或十六进制数表示错误,例如“int i = 081;”语句中数字‘8’不是八进制的基数error C2048: more than one default中文对照:(编译错误)default语句多于一个分析:switch语句中只能有一个default,删去多余的defaulterror C2050: switch expression not integral中文对照:(编译错误)switch表达式不是整型的分析:switch表达式必须是整型(或字符型),例如“switch ("a")”中表达式为字符串,这是非法的error C2051: case expression not constant中文对照:(编译错误)case表达式不是常量分析:case表达式应为常量表达式,例如“case "a"”中“"a"”为字符串,这是非法的error C2052: 'type' : illegal type for case expression中文对照:(编译错误)case表达式类型非法分析:case表达式必须是一个整型常量(包括字符型)error C2057: expected constant expression中文对照:(编译错误)期待常量表达式分析:一般是定义数组时数组长度为变量,例如“int n=10; int a[n];”中n为变量,这是非法的error C2058: constant expression is not integral中文对照:(编译错误)常量表达式不是整数分析:一般是定义数组时数组长度不是整型常量error C2059: syntax error : 'xxx'中文对照:(编译错误)‘xxx’语法错误分析:引起错误的原因很多,可能多加或少加了符号xxxerror C2064: term does not evaluate to a function中文对照:(编译错误)无法识别函数语言分析:1、函数参数有误,表达式可能不正确,例如“sqrt(s(s-a)(s-b)(s-c));”中表达式不正确2、变量与函数重名或该标识符不是函数,例如“int i,j; j=i();”中i不是函数error C2065: 'xxx' : undeclared identifier中文对照:(编译错误)未定义的标识符xxx分析:1、如果xxx为cout、cin、scanf、printf、sqrt等,则程序中包含头文件有误2、未定义变量、数组、函数原型等,注意拼写错误或区分大小写。
Encounter RTL Compiler命令参考手册(中文版)说明书
July 20092003-2009 Cadence Design Systems, Inc. All rights reserved.Portions © Concept Engineering GmbH. Used by permission.Printed in the United States of America.Cadence Design Systems, Inc. (Cadence), 2655 Seely Ave., San Jose, CA 95134, USA.Product Encounter™ RTL Compiler contains technology licensed from, and copyrighted by: Concept Engineering GmbH, and is 1998-2006, Concept Engineering GmbH. All rights reserved.Open SystemC,Open SystemC Initiative,OSCI,SystemC,and SystemC Initiative are trademarks or registered trademarks of Open SystemC Initiative, Inc. in the United States and other countries and are used with permission.Trademarks:Trademarks and service marks of Cadence Design Systems,Inc.contained in this document are attributed to Cadence with the appropriate symbol. For queries regarding Cadence’s trademarks, contact the corporate legal department at the address shown above or call 800.862.4522. All other trademarks are the property of their respective holders.Restricted Permission:This publication is protected by copyright law and international treaties and contains trade secrets and proprietary information owned by Cadence.Unauthorized reproduction or distribution of this publication,or any portion of it,may result in civil and criminal penalties.Except as specified in this permission statement,this publication may not be copied,reproduced,modified,published,uploaded,posted,transmitted, or distributed in any way, without prior written permission from Cadence. Unless otherwise agreed to by Cadence in writing, this statement grants Cadence customers permission to print one (1) hard copy of this publication subject to the following conditions:1.The publication may be used only in accordance with a written agreement between Cadence and itscustomer.2.The publication may not be modified in any way.3.Any authorized copy of the publication or portion thereof must include all original copyright, trademark,and other proprietary notices and this permission statement.4.The information contained in this document cannot be used in the development of like products orsoftware, whether for internal or external use, and shall not be used for the benefit of any other party, whether or not for consideration.Patents:Cadence Product Encounter™RTL Compiler described in this document,is protected by U.S.Patents [5,892,687]; [6,470,486]; 6,772,398]; [6,772,399]; [6,807,651]; [6,832,357]; and [7,007,247]Disclaimer:Information in this publication is subject to change without notice and does not represent a commitment on the part of Cadence. 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:Use,duplication,or disclosure by the Government is subject to restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its successorContentsAlphabetical List of Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23 About This Manual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 Additional References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24 How to Use the Documentation Set. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25 Reporting Problems or Errors in Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Customer Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Cadence Online Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Other Support Offerings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26 Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 Man Pages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .27 Command-Line Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 Getting the Syntax for a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 Getting the Syntax for an Attribute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 Searching for Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 Searching For Commands When Y ou Are Unsure of the Name . . . . . . . . . . . . . . . .29 Documentation Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30 T ext Command Syntax. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 basename. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32 cd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33 dirname . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35 dirs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36filter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..37find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .39 inout_mate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 ll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45ls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .46 popd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 pushd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 pwd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .52 vdir_lsearch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 what_is. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .542General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..58 all_inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .59 all_outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60 apropos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..62 date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 enable_transparent_latches. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 exec_embedded_script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65 exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..67 get_attribute. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68 get_liberty_attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 get_read_files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ..73 include . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74 lcd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75 license . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 license checkin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77 license checkout. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .78 license list. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79 lls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 lpopd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81 lpushd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82 lpwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83 man . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84 more. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85quit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87 rc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .88 redirect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92 reset_attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94 resume. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96 sdc_shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 set_attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98 shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101 suppress_messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .102 suspend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 unsuppress_messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1043GUI Text. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105 General GUI T ext Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106 gui_hide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 gui_info. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 gui_raise. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 gui_reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107 .gui_selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108 gui_show . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108 gui_status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108 gui_update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108 HDL Viewer GUI Text Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109 gui_hv_clear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 gui_hv_get_file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 gui_hv_load_file. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 gui_hv_set_indicators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 Schematic Viewer GUI T ext Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112 gui_sv_clear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 gui_sv_get_instance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 gui_sv_grey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113 gui_sv_highlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114 gui_sv_load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115 Physical Viewer GUI T ext Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116gui_pv_airline_add. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117 gui_pv_airline_delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118 gui_pv_airline_display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118 gui_pv_airline_raw_add. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 gui_pv_clear. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119 gui_pv_highlight. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .120 gui_pv_highlight_update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122 gui_pv_label. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122 gui_pv_redraw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 gui_pv_selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 gui_pv_snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123 gui_pv_zoom_fit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 gui_pv_zoom_in. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 gui_pv_zoom_out. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125 gui_pv_zoom_to. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1254Chipware Developer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127 cwd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128 cwd check. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129 cwd create_check. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133 cwd report_check. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .135 hdl_create. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137 hdl_create binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138 hdl_create component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140 hdl_create implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142 hdl_create library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144 hdl_create operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145 hdl_create package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146 hdl_create parameter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148 hdl_create pin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1505Input and Output. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153 decrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155encrypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156 export_critical_endpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159 read_config_file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161 read_cpf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162 read_def. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163 read_dfm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164 read_dft_abstract_model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166 read_encounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167 read_hdl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168 read_io_speclist. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172 read_netlist. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173 read_saif. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175 read_sdc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176 read_spef. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .178 read_tcf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179 read_vcd. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180 restore_design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181 write_atpg. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 write_bsdl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184 write_compression_macro. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .185 write_config_template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186 write_def. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .187 write_design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188 write_dft_abstract_model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .189 write_do_ccd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190 write_do_ccd compare_sdc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191 write_do_ccd generate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .192 write_do_ccd propagate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .193 write_do_ccd validate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195 write_do_clp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .196 write_do_lec. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .198 write_do_verify cdc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200 write_encounter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .202 write_et_atpg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205 write_et_bsv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206 write_et_mbist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207write_et_rrfa. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .208 write_ets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .209 write_ett . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210 write_forward_saif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .211 write_hdl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212 write_io_speclist. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .215 write_saif . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216 write_scandef. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217 write_script. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .218 write_sdc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221 write_sdf. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .224 write_set_load . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227 write_spef. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .228 write_tcf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .229 write_template . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2306Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .233 clock_uncertainty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 create_mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237 define_clock. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240 define_cost_group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245 derive_environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246 external_delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248 generate_constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252 multi_cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .254 path_adjust. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .259 path_delay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263 path_disable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .266 path_group. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269 propagate_constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 specify_paths. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .274 validate_constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2807Elaboration and Synthesis. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283 elaborate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284 remove_assigns_without_optimization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286 remove_inserted_sync_enable_logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 retime. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289 set_remove_assign_options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 synthesize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2948Analysis and Report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .301 all_connected. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304 all des. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305 all des inps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306 all des insts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307 all des outs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308 all des seqs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309 all lib. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .311 all lib bufs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .312 all lib ties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313 analyze_library_corners. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314 check_design. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .316 clock_ports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .321 compare_sdc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .322 fanin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .323 fanout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .326 report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .328 report area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .332 report boundary_opto. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .334 report buskeepers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .335 report cdn_loop_breaker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .336 report cell_delay_calculation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .338 report checks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .339 report clock_gating. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .342。
Memory Compiler使用介绍
Memory Compiler使用介绍在使用Memory Compiler时,请务必确保你的RAM从头到位的规格与设定都相同,否则会造成一些不可避免的错误。
首先在RTL代码阶段,要用到RAM就要用Artisan公司提供的Memory Compile产生的verilog代码,此时不需要着急产生其他后阶段的必要数据,因为RTL代码阶段只需要行为级模型即可。
当进入门级代码后,RAM compiler就要产生其他的相关数据了,同时要考虑RAM版图的位置与方向。
由于一个大的设计不会设计一次就会完成,所以有两个重点,第一个是每次使用RAM compiler时都一定要让它产生特性设置文档,避免忘记自己做过的设定。
第二件事是对应的文件名要定义好,否则RAM的方向不同但是又用到了相同的文件名,就会把原始数据覆盖掉。
下图为SRAM在流程中需要产生的文档RTL阶段在RTL阶段主要只是产生verilog行为级和设置文件。
因为在RTL阶段不需要考虑RAM的位置信息。
Memory Compiler提供4种选择,分别为ra1sh,ra2sh,rf1sh,rf2sh。
前面的ra与rf分别指的是SRAM与registerfile,其中rf在同样的情况下比ra占的面积小,但是rf的大小有限制,其限制大小位4096bits。
而后面1sh与2sh表示位单端口还是双端口,如果SRAM的容量比较大的话,相同设置下,1sh比2sh面积要小,速度也要快,功耗要低。
Memory Compiler运行界面如下图所示instance name:该设置是对RAM的命名,由于ram的特性有地址和位数,所以在命名的时候尽量包含这些信息。
number of words:该设置用来确定RAM的深度,即寻址空间大小。
number of bits:该设置用来确定RAM的宽度。
frequency:该设置用来确定RAM的工作频率,该设置确定后就可以基本确定RAM的功耗,估计的结果位平均电流,通过该数据来设定电源环的宽度。
chap1-3-compiler-example
编译器实现
任务:编译程序1+2+3到栈式计算机 阶段三:代码生成
小结
编译器构造和具体的编译器目标相关, 目前的结构:
思考题
任务:编译程序1+2+3到栈式计算机 阶段四:代码优化(常量折叠优化)
例如:1+2 ==> 3
编译器例子
编译原理
华保健
bjhua@
简单的编译器实例
源语言:加法表 达式语tack
两种语法形式:
整型数字:n 加法 :e1+e2
一个操作数栈 两条指令:
压栈指令:push n 加法 指令:add
源语言Sum
两种语法形式:
整型数字:n 加法 :e1+e2
例子:
栈式计算机Stack
一个操作数栈 两条指令:
压栈指令:push n 加法指令:add
例子:
编译器的阶段
任务:编译程序1+2+3到栈式计算机 阶段一:词法语法分析
编译器实现
任务:编译程序1+2+3到栈式计算机 阶段二:语法树构建
算法导论第三版第二章第一节习题答案
算法导论第三版第⼆章第⼀节习题答案2.1-1:以图2-2为模型,说明INSERTION-SORT在数组A=<31,41,59,26,41,58>上的执⾏过程。
NewImage2.1-2:重写过程INSERTION-SORT,使之按⾮升序(⽽不是按⾮降序)排序。
注意,跟之前升序的写法只有⼀个地⽅不⼀样:NewImage2.1-3:考虑下⾯的查找问题:输⼊:⼀列数A=<a1,a2,…,an >和⼀个值v输出:下标i,使得v=A[i],或者当v不在A中出现时为NIL。
写出针对这个问题的现⾏查找的伪代码,它顺序地扫描整个序列以查找v。
利⽤循环不变式证明算法的正确性。
确保所给出的循环不变式满⾜三个必要的性质。
(2.1-3 Consider the searching problem:Input: A sequence of n numbers A D ha1; a2; : : : ;ani and a value _.Output: An index i such that _ D AOEi_ or the special value NIL if _ does not appear in A.Write pseudocode for linear search, which scans through the sequence, looking for _. Using a loop invariant, prove that your algorithm is correct. Make sure that your loop invariant fulfills the three necessary properties.)LINEAR-SEARCH(A,v)1 for i=1 to A.length2 if v = A[i]3 return i4 return NIL现⾏查找算法正确性的证明。
精品课件-C程序设计(第三版)(荣政)-第8章
第八章 指针
指针类型是对所有类型的指针的总称,指针的类型是指 针所指对象的数据类型。例如,pc是指向字符变量的指针, 简称字符指针。字符指针是基本类型的指针之一,除各种基 本类型之外,允许说明指向数组的指针、指向函数的指针、 指向结构体和共用体的指针以及指向各类指针的指针。在C 语言中只有指针被允许用来存放地址的值,其它类型的变量 只能存放该类型的数据。(很多书中用指针一词来指地址值, 或用指针变量来代表指针,阅读中应注意其具体含义。)
例8.2中指向整型的指针point在定义之后直接使用了,这 两条语句在编译时不会出现语法错误,但在使用时却几乎肯定 会出问题。表面上看,scanf()函数的参数要求给出的是地址, 而point的值就代表的是地址,但是point的值究竟是多少,也 就是说point究竟指向哪里,我们无法得知,在这种情况下就 对point指向的单元进行输入操作,将冲掉point指向的单元的 原有内容,假如这个单元是操作系统的所在处,就破坏了操作 系统,显然是一件危险的事。
为了理解指针的概念,程序员要有关于计算机如何在存储 器中存储信息的基本知识。以下简单地介绍个人计算机中存储 器存储的情况。
第八章 指针
个人计算机中CPU可以直接访问的,用来存储程序和数据 的记忆部件称为内存储器,内存储器由成千上万个顺序存储单 元组成,每个单元由一个惟一的地址标识。给定计算机的存储 器地址范围为从0到所安装的存储器数量的最大值。在计算机 上运行的每一个程序都要使用存储器。例如,操作系统要占用 一些计算机存储空间,每个应用程序也要占用计算机存储空间。 按照面向过程的结构化程序设计方法,程序代码和程序要处理 的数据是分开存储的,所以,一个程序在内存中要占两部分空 间:数据部分和指令代码部分。
第八章 指针
3.5节 语法分析的自动生成-编译原理及实践教程(第3版)-黄贤英-清华大学出版社
%%
• 第二节是文法记号的声明,一般以%start S 的形式说明文法的开始符号,用%token
辅助过程
IF、DO、…、ID、… 的形式说明记号。记 号被YACC赋予了不会与任何字符值冲突的
数字值
• 数据类型、全局变量
等遵循C语言的定义, %{
可包含预处理语句等, 需要用%{和%}括起来
#include<stdio.h> %}
的最受欢迎的语法分析生成器
• Jflex——是一个Java的词法/语法分析生成器
• Jison ——JavaScript解析器。Jison 将一个上下文无关语
法作为输入,输出对应的JavaScript代码,类似Yacc
• Grammatica——C#和Java的语法剖析器生成器。相对于
其它一些类似的工具如yacc和ANTLR有了更好的改进:创 建了更好的注释和易读的源代码/拥有错误自动恢复并能 够详述错误信息/支持语法、词法测试与调试.
– YACC在对源文件进行编译时,将对所有的单词和非终 结符进行编码,并用该编码建立分析表和语法分析器 。单词的编码原则是:字符单词使用其对应的ASCII码 ,有名单词则由分析器进行编码。用户在对有名单词 进行命名时,一定要注意不要和使用该单词名的C源程 序中已有的宏名相同,否则在编译该C模块时是会产生 宏定义冲突的。
由Johnson等人在美国Bell实验室研制开发
• yacc生成的编译器主要是用C语言写成的语法解析
器(Parser),需要与词法分析器Lex一起使用, 再把两部份产生出来的C程序一并编译。
• yacc本来只在Unix系统上才有,GNU 版叫做 Bison。
现在已普遍移植到Windows及其他平台。
精典材料Patran的PCL用户手册V20
MSC.Patran PCL HandbookIn a Nutshell (7)What is PCL? (7)What can PCL be used for? (8)How does PCL work? (9)All you really need to know is on this page! (10)Documentation (10)PCL for Everyone (11)Entering Equations (11)Entering Data (12)Session Files (13)Rebuilding Models (14)PCL for the More Adventurous (17)Parametric Modeling (17)Adding a Graphical User Interface, GUI (21)Exercise 1: Session Files (22)PCL Programming Basics (24)Overview (24)PCL Expressions (26)Expressions, Comments, Syntax Tips (26)Identifiers (28)Naming Conventions (28)Variable / Function Scope (29)Structure of a PCL Function (30)Function Basics (30)Simple PCL function Example (31)Exercise 2: Hello World! (33)Exercise 3: Effective PCL (34)PCL Operators (35)String comparisons (35)PCL Variables and Constants (36)Datatypes (36)Variable Scope (37)Directly Allocated Arrays (38)Virtual arrays (39)Virtual strings (41)Loop Control Statements (42)For Loop (42)While Loop (42)Repeat Loop (43)BREAK (44)CONTINUE (45)Exercise 4: Writing Files (46)Exercise 5: Reading Files (48)Conditional Control Statements (49)IF Statement (49)SWITCH Statement (50)Structure of a PCL Function (51)Compiling and Linking PCL Functions (54)Primary PCL Directives (55)Compiling PCL outside of MSC.Patran (59)Linking Compiled Libraries (60)Other PCL Directives (61)Start Up Files (62)Exercise 6: p3epilog.pcl (63)Debugging (64)Debugging Compile Errors (64)Debugging Runtime Errors (65)Accessing PCL Functions (67)From The Command Line (67)From Any MSC.Patran Form (68)PCL Functions with Field Variables (69)MSC.Patran Built-In Functions (70)Naming Conventions for Applications (71)Naming Conventions for Other Operations (72)Exercise 7: Group Elements By Shape (74)Graphical User Interface (75)The PCL Class Statement (76)PCL Widgets (77)Required Functions for Building/Displaying a Form (78)The init() Function (78)The display() Function (79)Widget Callbacks (82)What Are They? (82)What Are They Used For? (83)Callback Arguments (Widget Function Data) (83)Widget Placement (85)Widget Variables (87)Modifying Widgets (88)Getting Data from Widgets (89)Putting it all Together (Example) (90)Exercise 8: Simple Form (92)The C-Preprocessor and Include Files (93)Make Files (94)Exercise 9: Callbacks (96)Handling Errors and Messaging (98)Errors from Built-In Functions (98)Custom Error Messages (99)Using User Messages Database (99)Without a Messages Database (100)Taking Advantage of the UNDO Feature (102)Select Mechanism (103)Select Mechanism GUI Mechanics (103)Select Databoxes, Select Frames, and Select Menus (103)GUI PCL Example (105)List Processor (106)List Processor Mechanics (106)All You Really Need to Know (107)Exercise 10: Form to Group Elms By Shape (110)Executing Programs Outside of MSC.Patran (112)Spawning Remote Processes (112)Locking a database (114)Using C and Fortran executables to access a MSC.Patran database directly. (115)External Access of an MSC.Patran Database (116)Special Widgets (118)File Widget (118)Spreadsheet Widget (121)Exercise 11: File Widget (122)Adding Help/Description to your PCL (123)Percent Complete (124)Functions (124)Example (124)Event Manager (125)General (125)Functions (126)Example (126)Primitive Graphics (127)Graphic Objects (127)Graphic Segments (128)Example (129)Another Example (130)Exercise 12: Primitive Graphics (131)MSC.Patran Customization (132)Adding Utility Programs to the Main Menu (132)Example (133)Example: p3_user_menu.my_menu.def (134)Customizing the MSC.Patran Toolbar (135)Exercise 13: Pulldown Menu (138)Exercise 14: Toolbar (139)Some Final Thoughts (141)Appendix A (144)Built-in Function Examples (144)Documentation for a typical MSC.Patran built-in function. (145)To get all the nodes and their global coordinates (146)To get the topology of every element (147)To get the shape of every element (148)To get all the element connectivity for all elements (149)To get the elements associated to a particular element property set (150)To get an element property value (shell thickness) for a specific element (151)To get a material property value (153)To get a list of all groups (154)To get the nodes and elements associated to the current group (154)To get result values for specified elements (155)Appendix B (164)Strings & String Functions (164)Declaration (165)Initialization (165)String Comparisons (165)Functions (166)Appendix C (174)Noteworthy Functions (174)sys_mov e_raw(...) (175)mth_array_search(...). (176)mth_sort(...) . (177)mth_sort_row(...).. (178)mth_sort_column(...) . (178)fem_geom_edge_length(...) .. (179)fem_geom_face_area(...). (179)fem_geom_elem_volume(...). (179)fem_geom_elem_location(...) .. (180)Appendix D (181)Form Spacing Parameters (appforms.p) (181)* SPACING (182)Appendix E (205)MSC.Patran Architecture (205)Appendix F (207)Shareware Compiling Functions (207)Appendix G (210)Parametric Patran (210)Appendix H (216)Additional List Processor Notes (216)List Processor Mechanics (217)List Processor Functions (217)List Processor Sublist Functions (219)List Processor Attribute Functions (220)Miscellaneous List Processor Functions (220)List Processor Examples (222)Easy to Use List Processor Functions (226)Appendix I (227)Key Mapping (227)Appendix J (230)Widget Classification (230)Appendix K (233)User Defined AOM (233)In a NutshellWhat is PCL?❑PCL stands for Patran Command Language❑Comprehensive, fully functional computer programming language❑Specifically and uniquely suited for MCAE applications ❑Delivered as a part of MSC.Patran❑Versatile and easy to useWhat can PCL be used for?❑Integrate application or site-specific programs with the MSC.Patran user interface and database❑Generate parametric/variational models for design/optimization ❑Integrate commercial and/or in-house analysis codes with MSC.Patran❑Display custom graphics❑Access the MSC.Patran database❑Create new and/or enhanced MSC.Patran functionality❑Database management for analysis files❑Eliminate tedious, repetitive proceduresHow does PCL work?❑All MSC.Patran commands are first interpreted by the PCL command interpreter❑PCL expressions are interpreted by a C program❑PCL functions can be compiled into libraries (more efficient binary representation) and “linked” with a MSC.Patran session❑“Built-in” PCL functions are written in C or FORTRAN❑MSC.Patran forms and menus can be created via PCL calls to Xlib, the X-window function library❑FORTRAN and C functions can be “linked” with MSC.Patran through PCLAll you really need to know is on this page! Documentation❑PCL and Customization - General programming guide for PCL.How to build forms, compile, manage libraries, access thedatabase, read/write files, etc.❑PCL Reference – Description of functions written to the session file.❑Develop: The MSC.Patran Toolkit – Documentation of additional functions for database access, etc.PCL for Everyone Entering EquationsUse of PCL when creating spatial fields:‘X + ‘X**2 –sinr(‘X)The PCL interpreter interprets anythingimmediately following a ‘ symbo l as afield variable as opposed to a PCLfunction, such as, sinr().Entering DataUse of PCL when entering geometric coordinates: [ `5./16.` 0 0 ]The PCL interpreter “evaluates” expressions enclosed in back tics, “`”.Other examples:[ `radius/length` 0 0 ]< `cosr(theta)` 1 1 >[ `MyFunction(radius)` 0 1 ]Session FilesSession and journal files are comprised entirely of PCL commands. Model changes (dimensions, mesh density, etc.) can be made quickly by editing and then replaying the session or journal files.$# Session file patran.ses.01 started recording at 16-Aug-01 14:33:54$# Recorded by: MSC.Patran 2001STRING asm_create_patch_xy_created_ids[VIRTUAL]asm_const_patch_xyz( "1", "<10 10 0>", "[0 0 0]", "Coord 0", @asm_create_patch_xy_created_ids )$# 1 Patch created: Patch 1STRING sgm_edit_surface_add_h_edit_ids[VIRTUAL]sgm_edit_surface_add_hole( 1, 1., TRUE, "", "[5 5 0]", "", "Surface 1", @sgm_edit_surface_add_h_edit_ids )$# 1 Surface Edited: Surface 1$# Session file patran.ses.01 stopped recording at 16-Aug-01 14:34:52Rebuilding ModelsThe following session file creates a trimmed surface, 10” x10”with a 1” diameter hole at the center. Note that the parameter that controls the diameter of the hole is indicated below.$# Session file patran.ses.01 started recording at 16-Aug-01 14:33:54$# Recorded by: MSC.Patran 2001STRING asm_create_patch_xy_created_ids[VIRTUAL]asm_const_patch_xyz( "1", "<10 10 0>", "[0 0 0]", "Coord 0", @asm_create_patch_xy_created_ids )$# 1 Patch created: Patch 1STRING sgm_edit_surface_add_h_edit_ids[VIRTUAL]sgm_edit_surface_add_hole( 1, 1., TRUE, "", "[5 5 0]", "", "Surface 1", @ sgm_edit_surface_add_h_edit_ids )$# 1 Surface Edited: Surface 1$# Session file patran.ses.01 stopped recording at 16-Aug-01 14:34:52In the session file below, the previous session file is edited to change the hole diameter from 1” to 4”$# Session file patran.ses.01 started recording at 16-Aug-01 14:33:54$# Recorded by: MSC.Patran 2001STRING asm_create_patch_xy_created_ids[VIRTUAL]asm_const_patch_xyz( "1", "<10 10 0>", "[0 0 0]", "Coord 0", @asm_create_patch_xy_created_ids )$# 1 Patch created: Patch 1STRING sgm_edit_surface_add_h_edit_ids[VIRTUAL]sgm_edit_surface_add_hole( 1, 4., TRUE, "", "[5 5 0]", "", "Surface 1", @ sgm_edit_surface_add_h_edit_ids )$# 1 Surface Edited: Surface 1$# Session file patran.ses.01 stopped recording at 16-Aug-01 14:34:52Session files can be executed or “played” by selecting File/Session/Play … from the top menu.PCL for the More Adventurous Parametric Modeling❑Session files can be parameterized by defining and using variables during the MSC.Patran session❑First, variables are declared and initialized via the MSC.Patran command lineSecond, the variables are used as input into the appropriate MSC.Patran forms (note the use of ` `, back tics)Upon application, the PCL interpreter evaluates `radius` (i.e., sets it equal to 1.0 in this example) and creates the curve. Note that the variable is passed to the session file in its unevaluatedBy using variables as parameters during MSC.Patran input, it is very easy to edit and change dimensions, mesh parameters, etc. in the session file.PCL for the more Adventurous Adding a Graphical User Interface, GUIThe next step might be to create a user interface to run the plate session file!Exercise 1: Session FilesUse MSC.Patran to create a parameterized session file that createsa rectangular surface with an arbitrarily located hole.1) Create variables for the dimensions shown below.2) Steps:a) Create variables using MSC.Patran’s command lineb) Create/Surface/XYZ (use variables length and width)c) Edit/Surface/Add Hole (use x_center, y_center, and diameter) Extra credit: Include error checking, i.e., it doesn’t make sensefor the hole to be outside the surface boundary.IF (x_center + diameter/2.0 > length) THEN RETURNExtra credit: Include meshing, boundary conditions, elementproperties, etc.Extra credit: Use ui_read_real(prompt) to enter the variablevalues interactivelyExtra credit: Turn your session file into a PCL FUNCTION.Exercise 1 Below is an image showing an MSC.Patran form allowing the interactive creation of the model for this exercise.NB – See Appendix G for notes about Parametric Patran.1) Variables and macros are defined interactively via a GUI2) Variables and macros are persistent3) Plus, more. See Appendix G for the detailsPCL Programming Basics Overview❑PCL is a full-featured programming language.❑Operators for arithmetic, relational, and string expressions.Examples include:❑Variables with type, scope, and dimension attributes INTEGER i, j, status, NodeIds(1000)LOGICAL flagREAL xyz(1000, 3), pressure(100), timeGLOBAL STRING my_group[32], all_groups[32](100)❑Dynamically allocated virtual strings and arraysINTEGER node_ids(VIRTUAL)STRING groups[32](VIRTUAL), MyString[VIRTUAL]❑Intrinsic functions for math, string manipulation, etc.sinr(angle)cosd(angle)mth_abs(MyVal)mth_sort(MyArray, CompactDuplicates, NumLeft)mth_array_search(MyArray, Look4, Sorted)str_length(MyString)str_substr(MyString, Position, SubStringLength)str_index(StringToSearchIn, StringToSearchFor)str_token(MyString, Delimiter, TokenNumber, [Compress])PCL Programming Basics ❑Loop control features, such as, WHILE, FOR, REPEAT, and LIST❑Conditional control structure, such as, IF-THEN-ELSE and SWITCH-CASE❑Subroutine (procedure) and function (command) calls❑Class grouping of related functions❑Read/write access to external ASCII and/or binary filestext_open(FileName, Options, 0, 0, FileId)text_read_string(FileId, InString, InStringLength)text_write_string(FileId, OutString)text_read(FileId, Format, MyIntegers, MyReals, MyChar)text_write(FileId, Format, MyIntegers, MyReals, MyChar)text_close(FileId, Options)file_exists(FileSpec, Options)file_delete(FileSpec)❑Access to MSC.Patran “built-in” functions that allow for direct access to the MSC.Patran database, geometry creation,drawing graphic primitives,db_count_nodes(NumNodes)db_get_node_ids(NumNodes, NodeIds)asm_const_grid_xyz(output_ids, coordinates_list, coord_frame, @created_ids)PCL Expressions Expressions, Comments, Syntax Tips❑Sample PCL expressions include:theta = 360.0 – MTH_ASIND(MyAngle)IF (radius >= 20.0) THEN radius = 20.0length = str_length(MyString)build_gear_geometry(30., 56., 3)❑PCL comments begin with a “/*” and end with a “*/”/*This is a comment.Look Ma, I’m making comments in PCL!Has anyone seen or heard from Elvis lately?*/a = 2 /* set mysterious factor equal to 2 */❑Alternatively, single line comments may begin with “$”$ Don’t you just hate to comment your programs?❑More than one PCL expression can co-exist on a line using a semi-colon, “;”alpha = 30.0; beta = 120.0❑PCL expressions can be continued on subsequent lines by using the “@” symbolui_wid_set(main_form, @“HEIGHT”, @NewHeight)ui_wid_set( /* widget_id */ main_form, @/* parameter */ “HEIGHT”, @/* value */ NewHeight)PCL Expressions ❑Don’t break expressions in the middle of a keyword, constant, or identifier❑Multiple blanks are the same as a single blank space❑Lines beginning with “!” (bang operator) are echoed to the xterm (UNIX) or command window (NT), but are not executedIn MSC.Patran type: !`i` nodes createdIn the xterm you see: %27 nodes created❑PCL expressions beginning with “>” are echoed to the session file❑PCL expressions can be typed directly into MSC.Patran at the command line❑PCL expressions may also be created with an editor in a text file and directed into MSC.Patran as a session file or by using the PCL directive !!INPUTIdentifiersNaming Conventions❑Function names and/or variable names are called identifiers ❑Can be up to 32 characters long❑Must begin with a non-digit❑Case insensitive (as is all of PCL)❑Cannot be a reserved keyword, i.e., FOR, IF, etc.❑Valid identifierscurrent_groupCurrentGroupMyString❑Invalid identifiersa_very_very_very_very_very_very_very_very_long_name 95abclistIdentifiers Variable / Function Scope❑Global variable names and functions share the same name space❑When two function names or two variable names conflict, the most recent addition supercedes the previous❑When function names and variable names conflict, the variable name takes precedence❑When compiling functions, PCL will indicate if a function name is superceded by writing “Cleared memory function” to thehistory window❑Hint: Use a unique prefix to keep function definitions separate,i.e au_do_this_and_that.pclStructure of a PCL Function Function Basics❑PCL functions begin with a FUNCTION statement and end with an END FUNCTION statement.❑The FUNCTION statement may contain an argument list to be passed in or out of the function.❑An optional RETURN statement can be used to return a calculated value from the function to the calling statement.❑Processing of the function terminates at either the END FUNCTION statement or a RETURN statement.❑There may be multiple RETURN statements within a single function.Simple PCL function Exampleanother_simple_function(29)$#My favorite number is 29$#My least favorite number is 13Sample output. The ui_write functions writetext to the history window, the session file(patran.ses.##), and the journal file(model.db.jou)Exercise 2: Hello World!Write and execute a PCL function that accepts a single real number argument and echoesHello World, my favorite number is ….to the MSC.Patran session file and history window.Your function will use either the ui_write(…),ui_writef(…), or ui_writec(…) functions.If you use the ui_writef(…) and ui_writec(…) functions, refer to the documentation for the correct format specifiers.Extra credit: How would this function change if you wanted to echo your favorite 10 numbers to the session file? Extra credit: How would this function change if you wanted to echo your favorite color to the session file?Exercise 3: Effective PCLWrite an essay on how the effective use of PCL could:a) Help create a lasting world peaceb) Eliminate world hungerc) Conquer the common coldd) Stop global warmingExtra credit: How could PCL be used to find Elvis?PCL OperatorsExamplesDist = mth_sqrt((x2-x1)**2 + (y2-y1)**2 + (z2-z1)**2) MyString3 = MyString2//”hijk”IF (a == b) THEN c = dIF (a == b && a == c) THEN ui_write(“Equilibrium”)x += 1 (this is equivalent to x = x +1)String comparisons❑The string comparison operators are special in that they ignore trailing blanks and uppercase and lowercase. Therefore, all of the following expressions are TRUE“ABC” == “ABC ““ABC” == “abc”❑Leading blanks are compared, i.e., “TEST” != “ TEST”❑To perform case sensitive comparisons use the str_equal() function, i.e.,IF (str_equal(GroupName1, GroupName2)) THEN RETURN 0PCL Variables and Constants Datatypes❑LOGICAL Boolean value: TRUE or FALSELOGICAL done, created31-1)❑INTEGER Value between +/- (2INTEGER i, num_nodes, node_id❑REAL Single precision floating value between 1.0E-30 and1.0E+30 (positive or negative)REAL x, y, z, force, pressure❑STRING Character string surrounded by double quotes, “Have you seen Elvis?”. Size or string length is defined with brackets, [ ]STRING FileName[80], GroupName[32]❑WIDGET Value is assigned by calls toUI_WIDGET_NAME_CREATE(…), used to create andmanipulate forms, etc.WIDGET main_form, MyButton, group_lboxVariable Scope❑GLOBAL Available to all functions during the MSC.Patransession❑LOCAL Default, only visible within the defining function ❑STATIC Same as LOCAL, but retains its value betweencalls❑CLASSWIDE Available to all functions in the CLASS andretains its value during the MSC.Patran sessionDirectly Allocated Arrays❑Directly allocated arrays can have any number of subscripts (dimensions), defined within parentheses ()❑Assigned upper and lower bounds, ArrayName(Lower:Upper)INTEGER MyArray(2:10)❑ Default lower bound is 1 (not 0) ❑ Available for all datatypes❑Row major (unlike Fortran which is column major)INTEGER MyArray(2, 3) = 1, 2, 3, 4, 5, 6❑Array dimensions are inherited from the argument list, i.e., PCL passes by reference❑Declaration ExamplesREAL displacements(6, 200) STRING group_names[32](20) INTEGER ids(0:2, 0:4, 0:10) LOGICAL exists(12)Virtual arrays❑Any variable can be defined as a VIRTUAL array instead of a directly allocated array. Virtual arrays do not have storagelocations assigned to them at program initialization. The size and amount of storage is allocated as requested and can bereused for other virtual arrays.❑To declare a virtual array, use the keyword VIRTUAL in place of the subscripts for the declaration, i.e.,REAL MyVals(VIRTUAL)INTEGER NodeIds(VIRTUAL)❑Storage is allocated using the function, sys_allocate_array(), or sys_allocate_array(MyVals, 1, 300)sys_allocate_array(MyVals, 1, 300, 1, 3)sys_allocate_array(MyVals, 1, 300, 1, 3, 0, 5)etc.❑Storage may be reallocated using the function,sys_reallocate_array(),sys_reallocate_array(MyVals, 1, 300, 1, 3)❑Storage may be freed using the function, sys_free_array(), sys_free_array(MyVals)Virtual array examplePCL Variables and Constants Virtual strings❑Any string variable can be defined as a VIRTUAL length string instead of a fixed length string. Virtual length strings do nothave storage locations assigned to them at programinitialization. The string length is allocated as requested and can be reused.❑To declare a virtual length string, use the keyword in place of the subscripts for the declaration, i.e.,STRING picklist[VIRTUAL]❑The string length is allocated using the sys_allocate_string() functionsys_allocate_string(picklist, 1000)❑The string length may be modified using thesys_reallocate_string() functionsys_reallocate_string(picklist, 2000)❑The string storage may be freed using the sys_free_string() functionsys_free_string(picklist)❑ A virtual length string can also be a virtual array, i.e., STRING picklists[VIRTUAL](VIRTUAL)Loop Control StatementsFor Loop❑SyntaxFOR (var=numeric_expr TO numeric_exprnumeric_expr label statements … END FOR❑ExampleAvgTemp = 0.0FOR (i = 1 TO NumNodes) AvgTemp += NodalTemp(i) END FORAvgTemp = AvgTemp/NumNodesWhile Loop❑SyntaxWHILE (logical_expression ) [label ] statements … END WHILE❑ExampleAvgTemp = 0.0 i = 1WHILE (i <= NumNodes)AvgTemp += NodalTemp(i) i += 1 END WHILEAvgTemp = AvgTemp/NumNodesRepeat LoopThis is similar to a WHILE Loop except that it will always be executed at least once. Only use REPEAT loops if you want to ALWAYS execute the loop at least once, otherwise us a WHILE loop.❑SyntaxREPEAT [label]statements …UNTIL (logical_expression)❑ExampleAvgTemp = 0.0i = 1REPEATAvgTemp += NodalTemp(i)i += 1UNTIL (i > NumNodes)AvgTemp = AvgTemp/NumNodesBREAKThe BREAK statement is used to exit a loop prior to its normal termination. It can be used in any of the loop statements.BREAK [❑END WHILE…❑Example 2 (nested loops, using labels)WHILE (i <= NumNodes) MainLoopWHILE (j <= 100) AnotherLoopWHILE (k <= 200) InnerLoopIF (status != 0) THEN BREAK MainLoopIF (status != 0) THEN BREAK AnotherLoopIF (status != 0) THEN BREAKIF (status != 0) THEN BREAK InnerLoopEND WHILEEND WHILEEND WHILECONTINUEThe CONTINUE statement is used to skip to the end of the loop ❑SyntaxCONTINUE [label]❑Example 1 (reading a text file)INTEGER file_id, lengthSTRING read_str[80]/* read grid information */WHILE (text_read_string(file_id, read_str, length) == 0)END WHILE❑Example 2 (nested loop, using labels)WHILE (i <= NumNodes) MainLoopREPEAT InnerLoopCONTINUE MainLoopBREAK InnerLoopCONTINUECONTINUE InnerLoopUNTIL (j > 1000)END WHILEstatements …Exercise 4: Writing FilesCreate a PCL function to write nodal data to a user-defined file. 1) The function should have a single argument, the filename to becreated, i.e., FUNCTION write_nodes_to_file(FileName)2) The data should be written to the file as a table, i.e.,Node Id x-coordinate y-coordinate z-coordinate3) Use virtual arrays4) Use the following built-in functions:db_count_nodes(NumNodes)db_get_node_ids(NumNodes, NodeIds)db_get_nodes(NumNodes, NodeIds, rcids, acids, NodeXYZ)text_open(FileName, Options, idum, idum, FileId)text_close(FileId, Options)text_write(FileId, Format, Ints, Reals, Chars)text_write_string(FileId, OutString)5) Use the documentation if you have questions about thearguments to the built-in functions.6) Think about your choice for the format argument in thetext_write(…) function. Will your file be comma or spacedelimited? Will it be fixed or free format?7) Sample code outline:a) Declare variablesb) Count nodes in the databasec) Allocate arraysd) Get node Idse) Get node coordinatesf) Open fileg) Write data to the file with a looph) Close filei) Be sure to include a message that the file output is completeWriting Files Extra credit: Include a header line at the top of the file thatincludes the filename and the total number of nodeswritten to the file.Exercise 5: Reading FilesWrite a function to read the file created in Exercise 4.1) The function should accept a single argument, i.e., the filenameto be read.FUNCTION ReadFile(FileName)2) Use the data in the file to create nodes with the following built-in function from the PCL Reference Manual:fem_create_nodes_1(RefCIDList, AnalysisCIDList, GeomFlag, @NodeIDList, XYZList, NodesCreatedList)3) Use the following built-in functions:text_open(FileName, Options, idum, idum, FileId)text_close(FileId, Options)text_read(FileId, Format, Ints, Reals, Chars)4) Sample code outline:a) Declare variablesb) Open the filec) Read the file within a loopd) Create new nodes as the file is read within the loope) Close the fileExtra credit: What if a node ID to be created already exists in the database?Extra credit: What if the file to be read doesn’t exist? Whatfunction can be used to determine if a file exists? Extra credit: Searching the documentation reveals anotherfunction that can be used to create nodes, i.e.,db_create_nodes(num_nodes, rcids, acids, xyz, group_id,node_ids, node_exists). Why might you use thisfunction versus fem_create_nodes_1(…)?Conditional Control Statements IF Statement❑SyntaxIF (logical_expression) THENstatements …ELSE IF (logical_expression) THENstatements …ELSEstatements …END IF❑ExampleIF (MyKeyWord == “CBAR” || MyKeyWord == “CBEAM”) THEN statements …ELSE IF (MyKeyWord == “CTRIA” || MyKeyWord == “CQUAD”) THEN statements …ELSE IF (MyKeyWord == “GRID”) THENstatements …ELSEstatements …END IF。
Lauterbach黑芯调试器TRACE32在线帮助说明书
Blackfin Debugger Release 09.2023Blackfin DebuggerTRACE32 Online HelpTRACE32 DirectoryTRACE32 IndexTRACE32 Documents ......................................................................................................................ICD In-Circuit Debugger ................................................................................................................Processor Architecture Manuals ..............................................................................................Blackfin ....................................................................................................................................Blackfin Debugger (1)Introduction (4)Brief Overview of Documents for New Users4 Demo and Start-up Scripts5 Location of Debug Connector5Warning (5)Quick Start JTAG (6)Troubleshooting (8)SYStem.Up Errors8FAQ (8)Configuration (9)System Overview9Blackfin specific SYStem Commands (10)SYStem.CONFIG Configure debugger according to target topology10 Daisy-Chain Example13 TapStates14 SYStem.CONFIG.CORE Assign core to TRACE32 instance15 SYStem.CPU CPU type selection16 SYStem.JtagClock JTAG clock selection17 SYStem.LOCK Lock and tristate the debug port17 SYStem.MemAccess Real-time memory access (non-intrusive)18 SYStem.Mode System mode selection19 SYStem.Option.IMASKASM Interrupt disable19 SYStem.Option.IMASKHLL Interrupt disable20Breakpoints (21)Software Breakpoints21 On-chip Breakpoints21 Breakpoint in ROM21Example for Breakpoints22 Memory Classes (23)CPU specific TrOnchip Commands (24)JTAG Connector (25)Blackfin DebuggerVersion 10-Oct-2023 IntroductionThis document describes the processor specific settings and features for the Blackfin Embedded Media Processor. TRACE32-ICD supports all Blackfin devices which are equipped with the JT AG debug interface.Please keep in mind that only the Processor Architecture Manual (the document you are reading at the moment) is CPU specific, while all other parts of the online help are generic for all CPUs supported by Lauterbach. So if there are questions related to the CPU, the Processor Architecture Manual should be your first choice.If some of the described functions, options, signals or connections in this Processor Architecture Manual are only valid for a single CPU the name is added in brackets.Brief Overview of Documents for New UsersArchitecture-independent information:•“Training Basic Debugging” (training_debugger.pdf): Get familiar with the basic features of a TRACE32 debugger.•“T32Start” (app_t32start.pdf): T32Start assists you in starting TRACE32 PowerView instances for different configurations of the debugger. T32Start is only available for Windows.•“General Commands” (general_ref_<x>.pdf): Alphabetic list of debug commands.Architecture-specific information:•“Processor Architecture Manuals”: These manuals describe commands that are specific for the processor architecture supported by your Debug Cable. T o access the manual for your processorarchitecture, proceed as follows:-Choose Help menu > Processor Architecture Manual.•“OS Awareness Manuals” (rtos_<os>.pdf): TRACE32 PowerView can be extended for operating system-aware debugging. The appropriate OS Awareness manual informs you how to enable theOS-aware debugging.Demo and Start-up ScriptsLauterbach provides ready-to-run start-up scripts for known Blackfin based hardware.To search for PRACTICE scripts, do one of the following in TRACE32 PowerView:•Type at the command line: WELCOME.SCRIPTS•or choose File menu > Search for Script.Y ou can now search the demo folder and its subdirectories for PRACTICE start-up scripts(*.cmm) and other demo software.Y ou can also manually navigate in the ~~/demo/blackfin/ subfolder of the system directory ofTRACE32.Location of Debug ConnectorLocate the debug connector on your target board as close as possible to the processor to minimize the capacitive influence of the trace length and cross coupling of noise onto the JT AG signals. WarningSignal LevelThe debugger output voltage follows the target voltage level. It supports a voltage range of 0.4…5.2V. ESD ProtectionNOTE:T o prevent debugger and target from damage it is recommended to connect ordisconnect the debug cable only while the target power is OFF.Recommendation for the software start:•Disconnect the debug cable from the target while the target power is off.•Connect the host system, the TRACE32 hardware and the debug cable.•Start the TRACE32 software.•Connect the debug cable to the target.•Switch the target power ON.Power down:•Switch off the target power.•Disconnect the debug cable from the target.Quick Start JTAGStarting up the debugger is done as follows:1.Select the device prompt B: for the ICD Debugger, if the device prompt is not active after the TRACE32 software was started.2.Select the CPU type to load the CPU specific settings.3.Enter debug mode:This command resets the CPU and enters debug mode. After the execution of this command access to the registers and to memory is possible. Before performing the first access to external SDRAM or FLASH the External Bus Interface Unit (EBIU) must be configured.4.The following command sequence is for the BF537 processor and configures the SDRAM controller with default values that were derived for maximum flexibility. They work for a system clock frequency between 54MHz and 133MHz.In the example a ST M29W320DB flash device is used in 16-bit mode. All four memory banks and CLKOUT are enabled.B:SYStem.CPU BF537SYStem.Up; configure SDRAM controllerData.Set 0xFFC00A1sLONG 0x0091998D Data.Set 0xFFC00A14 %WORD 0x0025Data.Set 0xFFC00A1C %WORD 0x03A0; EBIU_SDGCTL ; EBIU_SDBCTL ; EBIU_SDRRC; enable all flash memory banks and clock outData.Set 0xFFC00A00 %WORD 0x00FF; EBIU_AMGCTL; ST M29W320DB flash device in 16-bit modeFLASH.Create 1. 0x20000000--0x20003FFF 0x4000 AM29LV100 Word FLASH.Create 1. 0x20004000--0x20007FFF 0x2000 AM29LV100 Word FLASH.Create 1. 0x20008000--0x2000FFFF 0x8000 AM29LV100 Word FLASH.Create 1. 0x20010000--0x203FFFFF 0x10000 AM29LV100 Word5.Load the program.Data.LOAD.Elf demo.dxe; The file demo.dxe is in ELF format The option of the Data.LOAD command depends on the file format generated by the compiler. A detailed description of the Data.LOAD command is given in the “General Commands Reference”. The start-up sequence can be automated using the programming language PRACTICE. A typical start sequence is shown below. This sequence can be written to a PRACTICE script file (*.cmm, ASCII format) and executed with the command DO<file>.B::; Select the ICD device promptWinClear; Delete all windowsSYStem.CPU BF537; select the processorSYStem.Up; Reset the target and enter debug modeData.Load.Elf sieve.dxe; Load the applicationRegister.Set PC main; Set the PC to function mainList.Mix; Open disassembly window *) Register.view; Open register window *) PER.view; Open window with peripheral register *) Break.Set sieve; Set breakpoint to function sieveBreak.Set 0x1000 /p; Set on-chip breakpoint to address 1000; Refer to the restrictions in; On-chip Breakpoints.*) These commands open windows on the screen. The window position can be specified with the WinPOS command.TroubleshootingSYStem.Up ErrorsThe SYStem.Up command is the first command of a debug session where communication with the target is required. If you receive error messages while executing this command this may have the following reasons.All The target has no power.All There are additional loads or capacities on the JTAG lines.All The JTAG clock is too fast.FAQPlease refer to https:///kb.Configuration System OverviewBlackfin specific SYStem CommandsSYStem.CONFIG Configure debugger according to target topologyThe four parameters IRPRE, IRPOST , DRPRE, DRPOST are required to inform the debugger about the T AP controller position in the JT AG chain, if there is more than one core in the JT AG chain (e.g. ARM + DSP). The information is required before the debugger can be activated e.g. by a SYStem.Up . See Daisy-chain Example .For some CPU selections (SYStem.CPU ) the above setting might be automatically included, since the required system configuration of these CPUs is known.T riState has to be used if several debuggers (“via separate cables”) are connected to a common JT AG port at the same time in order to ensure that always only one debugger drives the signal lines. T APState and TCKLevel define the T AP state and TCK level which is selected when the debugger switches to tristate mode. Please note: nTRST must have a pull-up resistor on the target, TCK can have a pull-up or pull-down resistor, other trigger inputs need to be kept in inactive state.Format:SYStem.CONFIG <parameter> <number_or_address>SYStem.MultiCore <parameter> <number_or_address> (deprecated)<parameter>:CORE <core><parameter>:(JTAG):DRPRE <bits>DRPOST <bits>IRPRE <bits>IRPOST <bits>DAPDRPOST <bits>DAPDRPRE <bits>DAPIRPOST <bits>DAPIRPRE <bits>TAPState <state>TCKLevel <level>TriState [ON | OFF ]Slave [ON | OFF ]DEBUGPORTTYPE [JTAG | SWD ]SWDPIDLEHIGH [ON | OFF ]SWDPTargetSel <value>CORE For multicore debugging one TRACE32 PowerView GUI has to be startedper core. To bundle several cores in one processor as required by thesystem this command has to be used to define core and processorcoordinates within the system topology.Further information can be found in SYStem.CONFIG.CORE.… DRPOST <bits>Defines the TAP position in a JT AG scan chain. Number of TAPs in theJTAG chain between the TDI signal and the TAP you are describing. InBYPASS mode, each TAP contributes one data register bit. See possibleTAP types and example below.Default: 0.… DRPRE <bits>Defines the TAP position in a JT AG scan chain. Number of TAPs in theJTAG chain between the TAP you are describing and the TDO signal. InBYPASS mode, each TAP contributes one data register bit. See possibleTAP types and example below.Default: 0.… IRPOST <bits>Defines the TAP position in a JT AG scan chain. Number of InstructionRegister (IR) bits of all TAPs in the JT AG chain between TDI signal andthe TAP you are describing. See possible T AP types and example below.Default: 0.… IRPRE <bits>Defines the TAP position in a JT AG scan chain. Number of InstructionRegister (IR) bits of all TAPs in the JTAG chain between the T AP you aredescribing and the TDO signal. See possible TAP types and examplebelow.Default: 0.TAPState(default: 7 = Select-DR-Scan) This is the state of the TAP controller whenthe debugger switches to tristate mode. All states of the JTAG T APcontroller are selectable.TCKLevel (default: 0) Level of TCK signal when all debuggers are tristated. TriState(default: OFF) If several debuggers share the same debug port, thisoption is required. The debugger switches to tristate mode after eachdebug port access. Then other debuggers can access the port. JT AG:This option must be used, if the JTAG line of multiple debug boxes areconnected by a JTAG joiner adapter to access a single JTAG chain. Slave(default: OFF) If more than one debugger share the same debug port, allexcept one must have this option active.JTAG: Only one debugger - the “master” - is allowed to control the signalsnTRST and nSRST (nRESET).DEBUGPORTTYPE [JTAG | SWD]It specifies the used debug port type “JT AG”, “SWD”. It assumes the selected type is supported by the target.Default: JT AG.SWDPIdleHigh [ON | OFF]Keep SWDIO line high when idle. Only for Serialwire Debug mode. Usually the debugger will pull the SWDIO data line low, when no operation is in progress, so while the clock on the SWCLK line is stopped (kept low).Y ou can configure the debugger to pull the SWDIO data linehigh, when no operation is in progress by usingSYStem.CONFIG SWDPIdleHigh ONDefault: OFF.SWDPTargetSel<value>Device address in case of a multidrop serial wire debug port.Default: none set (any address accepted).Daisy-Chain ExampleBelow, configuration for core C.Instruction register length of •Core A: 3 bit •Core B: 5 bit •Core D: 6 bitSYStem.CONFIG.IRPRE 6.; IR Core D SYStem.CONFIG.IRPOST 8.; IR Core A + B SYStem.CONFIG.DRPRE 1.; DR Core D SYStem.CONFIG.DRPOST 2.; DR Core A + BSYStem.CONFIG.CORE 0. 1.; Target Core C is Core 0 in Chip 1Core A Core B Core CCore D TDOTDI Chip 0Chip 1TapStates0Exit2-DR1Exit1-DR2Shift-DR3Pause-DR4Select-IR-Scan5Update-DR6Capture-DR7Select-DR-Scan8Exit2-IR9Exit1-IR10Shift-IR11Pause-IR12Run-Test/Idle13Update-IR14Capture-IR15Test-Logic-ResetSYStem.CONFIG.CORE Assign core to TRACE32 instance Format:SYStem.CONFIG.CORE<core_index><chip_index>SYStem.MultiCore.CORE<core_index><chip_index> (deprecated) <chip_index>:1 (i)<core_index>:1…kDefault core_index: depends on the CPU, usually 1. for generic chipsDefault chip_index: derived from CORE= parameter of the configuration file (config.t32). The COREparameter is defined according to the start order of the GUI in T32Start with ascending values.T o provide proper interaction between different parts of the debugger, the systems topology must bemapped to the debugger’s topology model. The debugger model abstracts chips and sub cores of these chips. Every GUI must be connect to one unused core entry in the debugger topology model. Once the SYStem.CPU is selected, a generic chip or non-generic chip is created at the default chip_index.Non-generic ChipsNon-generic chips have a fixed number of sub cores, each with a fixed CPU type.Initially, all GUIs are configured with different chip_index values. Therefore, you have to assign thecore_index and the chip_index for every core. Usually, the debugger does not need further information to access cores in non-generic chips, once the setup is correct.Generic ChipsGeneric chips can accommodate an arbitrary amount of sub-cores. The debugger still needs information how to connect to the individual cores e.g. by setting the JT AG chain coordinates.Start-up ProcessThe debug system must not have an invalid state where a GUI is connected to a wrong core type of a non-generic chip, two GUIs are connected to the same coordinate or a GUI is not connected to a core. The initial state of the system is valid since every new GUI uses a new chip_index according to its CORE= parameter of the configuration file (config.t32). If the system contains fewer chips than initially assumed, the chips must be merged by calling SYStem.CONFIG.CORE.SYStem.CPU CPU type selection Format:SYStem.CPU <cpu><cpu>:BF531 | BF532 | BF533 | BF534…Default selection: BF534.Selects the CPU type.SYStem.JtagClock JT AG clock selection Format:SYStem.JtagClock [<frequency>]SYStem.BdmClock<frequency>(deprecated)Default frequency: 1MHz.Selects the JT AG port frequency (TCK). Any frequency up to 50MHz can be entered, it will be generated by the debuggers internal PLL.For CPUs which come up with very low clock speeds it might be necessary to slow down the JT AGfrequency. After initialization of the CPUs PLL the JT AG clock can be increased.SYStem.LOCK Lock and tristate the debug port Format:SYStem.LOCK [ON | OFF]Default: OFF.If the system is locked, no access to the debug port will be performed by the debugger. While locked, the debug connector of the debugger is tristated. The main intention of the SYStem.LOCK command is to give debug access to another tool.SYStem.MemAccess Real-time memory access (non-intrusive) Format:SYStem.MemAccess Denied | StopAndGo | BTCBTC“BTC” allows a non-intrusive memory access while the core is running, if aBackground T elemetry Channel (BTC) is defined in your application. Anyinformation on how to create such a channel can be found in AnalogDevices’ VisualDSP++ user’s manual. The JT AG clock speed should be asfast as possible to get good performanceDenied Real-time memory access during program execution to target is disabled.StopAndGo Temporarily halts the core(s) to perform the memory access. Each stoptakes some time depending on the speed of the JT AG port, the number ofthe assigned cores, and the operations that should be performed.SYStem.Mode System mode selectionFormat:SYStem.Mode <mode>SYStem.Attach (alias for SYStem.Mode Attach)SYStem.Down (alias for SYStem.Mode Down)SYStem.Up (alias for SYStem.Mode Up)<mode>:DownGoAttachUpDown Disables the debugger.Go Resets the target with debug mode enabled and prepares the CPU fordebug mode entry. After this command the CPU is in the system.upmode and running. Now, the processor can be stopped with the breakcommand or if a break condition occurs.Attach User program remains running (no reset) and the debug interface isinitialized.Up Resets the target and sets the CPU to debug mode. After execution ofthis command the CPU is stopped and prepared for debugging.StandBy Not supported.NoDebug Not supported.SYStem.Option.IMASKASM Interrupt disable Format:SYStem.Option.IMASKASM [ON | OFF]Mask interrupts during assembler single steps. Useful to prevent interrupt disturbance during assembler single stepping.SYStem.Option.IMASKHLL Interrupt disable Format:SYStem.Option.IMASKHLL [ON | OFF]Mask interrupts during HLL single steps. Useful to prevent interrupt disturbance during HLL single stepping.BreakpointsThere are two types of breakpoints available: software breakpoints and on-chip breakpoints. Software BreakpointsSoftware breakpoints are the default breakpoints. A special breakcode is patched to memory so it only can be used in RAM or FLASH areas.There is no restriction in the number of software breakpoints.On-chip BreakpointsThe Blackfin processor has a total of six instruction and two data on-chip breakpoints.A pair of two breakpoints may be further grouped together to form a range breakpoint. A range breakpointcan be including or excluding. In the first case the core is stopped if an address in the range is detected, in the second case the core is stopped when an address outside of the range is observed.Breakpoint in ROMWith the command MAP.BOnchip<range> it is possible to inform the debugger about ROM(FLASH,EPROM) address ranges in target. If a breakpoint is set within the specified address range the debugger uses automatically the available on-chip breakpoints.Example for BreakpointsAssume you have a target with FLASH from 0x20000000 to 0x200FFFFF and RAM from 0x0 to 0x1000000. The command to configure TRACE32 correctly for this configuration is: Map.BOnchip 0x20000000--0x200FFFFFThe following breakpoint combinations are possible.Software breakpoints:Break.Set 0x0 /Program; Software Breakpoint 1Break.Set 0x1000 /Program; Software Breakpoint 2On-chip breakpoints:Break.Set 0x20000100 /Program; On-chip Breakpoint 1Break.Set 0x2000ff00 /Program; On-chip Breakpoint 2Memory ClassesThe following memory classes are available: Memory Class DescriptionP ProgramD DataCPU specific TrOnchip CommandsThe TrOnchip command group is not available for the Blackfin debugger.JTAG ConnectorSignal Pin Pin SignalGND12EMU-N/C34GNDVDDIO56TMSN/C78TCKN/C910TRST-N/C1112TDIGND1314TDOJTAG Connector Signal Description CPU Signal TMS JTAG-TMS,TMSoutput of debuggerTDI TDI JTAG-TDI,output of debuggerTCK TCK JTAG-TCK,output of debugger/TRST /TRST JTAG-TRST,output of debuggerTDO TDO JTAG-TDO,input for debugger/EMU JTAG Emulation Flag /EMUVDDIO VDDIO This pin is used by the debugger to sense the targetI/O voltage and to set the drive levels accordingly. Ifthe sensed voltage level is too low (e.g. target has nopower) the debugger powers down its drivers toprevent the target from damage.。
cmpl_01
原中间代码:
序号 (1) (2) (3) (4) (5) OP := J< * + * 1 100 10 I 10 K K T1 K ARG! ARG2 RESULT K (9) T1 M T2 K:=1 若100<K 转至第(9)个四 元式 T1:=10*K;T1为临时变量 M:=I + T1; T2:=10*K;T2为临时变量 注 释
注
释
(1) := (2) := (3) := (4) j< (5) + (6) + (7) + (8) j (9)
若100<K 转至第(9)个四 元式 M:=M+10 N:+N+10 K:+K+1 转至第 (4)个四元式
源程序
原中间代码
16
5、目标代码生成
任务: 中间代码→依赖于机器的目标代码(汇编语言或机器语言)
10
id3 id2 T3
T1 T2 -
T1 )
T2 ) T3 ) id1) ( * id3 10.0 T2 )
( +
id2
T2
id1 )
29
目标代码生成
sum := first + count * 10 ( ( * + id3 id2 10.0 t1 id3, t1 ) id1 ) R2
MOVF MULF
begin var sum , first , count : real ; sum := first + count * 10 end .
22
赋值语句
标识符 id1 sum :=
id1:=id2+id3*10 的语法树
cc常见编译错误解析(Cccommoncompileerrorresolution)
cc++常见编译错误解析(Cc++ common compile error resolution)争论#参数#名丢失失踪的名字参数表语法错误参数表语法错误数组界限失踪丢失数组界限符在参数参数中有不适当的字符坏字符中文件名格式不正确包含命令中文件名格式不正确非功能调用未定义的函数呼叫调用函数没有原型调用函数时没有函数的说明不能修改const对象不允许修改常量对象开关箱出现在开关外外壳失踪案语句漏掉case语句语法错误的情况下语法错误字符常量太长字符常量太长复合语句漏掉{分程序漏掉“{”类型修饰符冲突不明确的类型说明符要求常量表达式要求常量表达式宣告失踪;说明缺少“;”声明需要类型或存储类说明必须给出类型或存储类声明语法错误说明中出现语法错误开关默认出现在开关语句之外外默认指令必须有一个标识符编译预处理指令定义需要标识符零用零作除数划分语句必须有做而语句中缺少而部分语句缺少(做而语句中漏掉了符号”(“语句缺少;而语句中掉了分号重复的情况情况不唯一枚举的语法错误枚举类型语法错误枚举常量语法错误枚举常数语法错误错误指令:XXX错误的编译预处理命令写输出文件写输出文件错误误差表达式语法错误表达式语法错误额外的参数在调用调用时出现多余参数在调用额外的参数,xxxxxx调用xxxxxxxx函数时出现了多余参数语句丢失)为语名缺少”)”对于语句缺少(对语句缺少”(“for语句的缺失;对语句缺少“;”函数调用缺少)函数调用缺少右括号函数定义的地方函数定义位置错误应该返回一个值函数必需返回一个值语句缺少标签上语句没有标号如果语句缺少(如果语句缺少”(“如果语句缺少)如果语句缺少”)”非法字符“X”非法字符X非法的初始化非法初始化非法八进制非法的8进制数字非法的指针相减非法的指针相减非法的结构体操作非法的结构体操作非法使用浮点非法的浮点运算指针使用非法指针使用非法一个类型定义符号类型定义符号使用不恰当使用不当不兼容的存储类存储类别不相容不兼容的类型转换不相容的类型转换不正确的配置参数:xxxxxx不正确的命令行参数:xxxxxxx不正确的配置文件参数:xxxxxx不正确的配置文件参数:xxxxxxx 不正确的数字格式错误的数据格式默认默认使用不当正确使用初始化语法错误初始化语法错误无效的间接无效的间接运算无效的宏参数分隔符无效的宏参数分隔符无效指针相加指针相加无效不可约表示树无法执行的表达式运算点点使用错使用无效左值必须分配一个值需要逻辑值0或非0值宏参数语法错误宏参数语法错误宏扩展太长宏的扩展太长在定义定义中参数个数不匹配参数个数不匹配错断此处不应出现打破语句错误的继续此处不应出现继续语句小数点错位的此处不应出现小数点xxx还有其他此处不应出现错位错误的指令此处不应出现编译预处理其他其他错位的ENDIF指令此处不应出现编译预处理endif 必须是可寻址的必须是可以编址的必须存储定位必须存储定位的地址地址没有函数xxx没有函数XXX的说明没有文件名结尾无文件终止符未给出文件名未给出文件名没有堆栈缺少堆栈没有类型信息没有类型信息不可移植的指针赋值对不可移动的指针(地址常数)赋值不可移动的指针比较不可移动的指针(地址常数)比较不可移动的指针转换不可移动的指针(地址常数)转换不可移植的返回类型转换不可移植的返回类型转换不合法的表达式格式不合法的表达式格式不允许的类型不允许使用的类型内存不足内存不够用参数xxx没有用参数XXX没有用到指针所需的左边->符号->的左边必须是指针可能使用了xxx之前定义在定义之前就使用了XXX(警告)赋值可能不正确赋值可能不正确重新说明了xxx重复定义了XXX重新定义了xxx xxx的两次定义不一致是不相同的登记分配失败寄存器定址失败重复计数需要重复计数需要逻辑值不知道结构体或数组大小不确定结构或数组的大小语句缺少;语句后缺少“;”结构或联合语法错误结构体或联合体语法错误结构尺寸太大结构体尺寸太大下标下标缺少右方括号失踪]多余的功能或阵列函数或数组中有多余的”&“可疑的指针转换可疑的指针转换开关语句缺少(开关语句缺少”(“开关语句缺少)开关语句缺少”)”在电话函数调用参数太少参数太少太少的参数调用to' xxxxxx”调用”xxxxxx”时参数太少太多的案例太多太多的小数点十进制小数点太多太多的默认情况下默认太多(开关语句中一个)太多的指数阶码太多初始化太多初始化太多太多的错误或警告信息错误或警告信息太多在声明说明中存储类太多存储类太多在声明说明中类型太多类型太多太多的自动记忆功能函数用到的自动存储太多太多的全球数据文件文件中全局数据太多定义两个连续点两个连续的点类型参数#参数”#”类型不匹配在调用的参数# xxxxxxx”调用”xxxxxxx”时参数#类型不匹配类型不匹配参数xxx参数XXX类型不匹配类型不匹配参数xxx类型不匹配的呼叫“YYY”调用'yyy”时参数'xxx”数型不匹配类型重定义xxx xxx重定义的类型不匹配无法创建输出文件xxx无法建立输出文件XXX无法创建turboc.lnk不能创建turboc.lnk无法执行命令的xxxxxxxx”不能执行”xxxxxxxx”命令无法打开包含文件xxx无法打开被包含的文件XXX无法打开输入文件xxx无法打开输入文件XXX未标号xxx没有定义的标号XXX未定义的结构没有定义的结构xxx的xxx未定义的符号没有定义的符号XXX在评论意外结束线源文件在从行开始的注释中意外结束XXX XXX在有条件的意外结束线XXX源文件在#行开始的条件语句中意外结束未知的选项未知的操作未知的操作指令:xxx不认识的预处理命令XXX无法访问的代码无路可达的代码未终结的字符常量未终结的字符常量未结束的字符串未终结的串未终结的串或字符常量字符串或字符常量缺少引号用户突破用户强行中断了程序值所需的赋值请求函数不返回值类型的函数不应有返回值虽然语句缺少(而语句漏掉'('同时声明丢失)而语句漏掉')'在“xxxxxxxx”调用”xxxxxxxx”时参数个数错误参数个数错误xxx不是争论XXX不是参数xxx不是结构XXX不是结构体的一部分部分XXX(XXX语句缺少左括号语句缺少xxx语句丢失)XXX语句缺少右括号XXX XXX缺少分号声明丢失;说明了xxx,但没有使用说明了XXX但没有使用xxx是分配一个值,这是从来没有使用给XXX赋了值但未用过结构长度为零结构体的长度为零。
综合工具-DesignCompiler学习教程
综合⼯具-DesignCompiler学习教程Design Compiler 13讲中的部分内容:1、逻辑综合的概述DC⼯作流程分为三步2、DC的三种启动⽅式GUIdc_shellBatch mode3、DC-Tcl语⾔的基本结构1、⾼层次设计的流程图2、DC在设计流程中的位置3、使⽤DC进⾏基本的逻辑综合的流程图与相应的命令①准备设计⽂件②指定库⽂件③读⼊设计④定义设计环境⑤设置设计约束⑥选择编译策略⑦编译⑧分析及解决设计中存在的问题⑨存储设计数据(1)启动环境配置简述(2).synopsys_dc.setup配置⽂件的书写(3).synopsys_dc.setup的讲解(1)标准单元库①概述⼀个ASIC综合库包括如下信息:·⼀系列单元(包括单元的引脚)。
·每个单元的⾯积(在深亚微⽶中,⼀般⽤平⽅微⽶表⽰,在亚微⽶⼯艺下,⼀般⽤门来称呼,⾄于具体的单位,可以咨询半导体制造商)。
·每个输出引脚的逻辑功能。
·每个输⼊到输出的传递延时,输出到输出的传递延时;inout到输出的传递延时。
②内容与结构Synopsys的⼯艺库是⼀个.lib⽂件,经过LC编译后,产⽣.db⽂件。
⼯艺库⽂件主要包括如下信息:·单元(cell)(的信息):(主要有)功能、时间(包括时序器件的约束,如建⽴和保持)、⾯积(⾯积的单位不在⾥⾯定义,可按照规律理解,⼀般询问半导体⼚商)、功耗、测试等。
·连线负载模型(wire load models):电阻、电容、⾯积。
·⼯作环境/条件(Operating conditions):制程(process)(电压和温度的⽐例因数k,表⽰不同的环境之间,各参数缩放的⽐例)·设计规则约束(Design ):最⼤最⼩电容、最⼤最⼩转换时间、最⼤最⼩扇出。
⼯艺库的结构如下所⽰:(2)DC的设计对象在了解了综合库之后,下⾯介绍⼀下DC的设计对象,虽然这个设计对象相对于综合库没有那么重要,但是还是要了解⼀下的。
Holtek_C_Compiler_V3_FAQ(936)
Rev.1.50
3
2016-12-28
Holtek C Compiler V3 FAQ
5.8 混合语言使用 ROM BP 的注意事项 ........................................................................... 18 5.9 如何使用 CMD 命令编译 C 工程? ............................................................................ 19 5.10 混合语言工程在 asm 文件中使用 table read 的注意事项 ....................................... 19 5.11 中断函数中使用 inline assembly 注意事项 .............................................................. 19 5.12 用其它方式修改 const 变量值 ( 比如烧录时修改 ROM),compiler 执行结果不变, 如何解决 ? ................................................................................................................... 20
Rev.1.50
2
2016-12-28
Holtek C Compiler V3 FAQ
目录
Part I V3 基本介绍 .......................................................................................................5
Design_compiler经典教程
微电子学实验室实验教程ASIC综合器软件——Design Compiler实验2006-7Design Compiler实验前言Design Compiler(简称DC)是synopsys公司的ASIC综合器产品,它可以完成将硬件描述语言所做的RTL级描述自动转换成优化的门级网表。
DC得到全球60多个半导体厂商、380多个工艺库的支持。
Synopsys的逻辑综合工具DC占据91%的市场份额。
DC是工业界标准的逻辑综合工具,也是Synopsys最核心的产品。
它使IC设计者在最短的时间内最佳的利用硅片完成设计。
它根据设计描述和约束条件并针对特定的工艺库将输入的VHDL或者Verilog的RTL描述自动综合出一个优化的门级电路。
它可以接受多种输入格式,如硬件描述语言、原理图和网表等,并产生多种性能报告,在缩短设计时间的同时提高设计性能。
本实验对DC软件的使用进行简单的介绍,熟悉和掌握综合器软件使用中的基本概念和术语,了解如何对数字电路施加约束,掌握同步数字电路设计、约束和优化的方法,了解时钟的概念,理解同步电路静态时序分析(STA)的方法和时序报告。
西安交通大学微电子学实验室实验1setup和synthesis流程实验准备有两种界面可以运行Design Compiler:1)命令行界面,dc_shell-xg-t;2)图形用户界面(GUI),Design Vision。
本次实验主要运用GUI模式。
图1.1给出了RTL逻辑综合的直观概念和简要流程。
图1.1 RTL逻辑综合的直观概念和简要流程。
在DC中,总共有8种设计对象:z设计(Design):一种能完成一定逻辑功能的电路。
设计中可以包含下一层的子设计。
z单元(Cell):设计中包含的子设计的实例。
z参考(Reference):单元的参考对象,即单元是参考的实例。
z端口(Port):设计的基本输入输出口。
z管脚(Pin):单元的输入输出口。
z连线(Net):端口间及管脚间的互连线。
习题参考答案-编译原理及实践教程(第3版)-黄贤英-清华大学出版社
附录部分习题参考答案第1章习题1. 解释下列术语。
翻译程序,编译程序,解释程序,源程序,目标程序,遍,前端,后端解答:略!2. 高级语言程序有哪两种执行方式?阐述其主要异同点。
描述编译方式执行程序的过程。
解答:略!3. 在你所使用的C语言编译器中,观察程序1.1经过预处理、编译、汇编、链接四个过程生成的中间结果。
解答:略!4. 编译程序有哪些主要构成成分?各自的主要功能是什么?解答:略!5. 编译程序的构造需要掌握哪些原理和技术?编译程序构造工具的作用是什么?解答:略!6. 复习C语言,其字母表中有哪些符号?有哪些关键字、运算符和界符?标识符、整数和实数的构成规则是怎样的?各种语句和表达式的结构是什么样的?解答:略!7.编译技术可应用在哪些领域?解答:略!8. 你能解释在Java编译器中,输入某个符号后会提示一些单词、某些单词会变为不同的颜色是如何实现的吗?你能解释在Code Blocks中在输入{后,会自动添加},输入do 会自动添加while()是为什么吗?解答:略!第2章习题1. 判断题,对下面的陈述,正确的在陈述后的括号内画√,否则画×。
(1) 有穷自动机识别的语言是正规语言。
()(2) 若r1和r2是Σ上的正则表达式,则r1|r2也是。
()(3) 设M是一个NFA,并且L(M)={x,y,z},则M的状态数至少为4个。
()(4) 令Σ={a,b},则所有以b开头的字构成的正规集的正则表达式为b*(a|b)*。
()(5) 对任何一个NFA M,都存在一个DFA M',使得L(M')=L(M)。
()1解答:略!2.从供选择的答案中,选出应填入下面叙述中?内的最确切的解答。
有穷自动机可用五元组(Q,V T,δ,q0,Q f)来描述,设有一有穷自动机M定义如下:V T={0,1},Q={q0,q1,q2},Q f={q2},δ的定义为:δ (q0,0)=q1δ (q1,0)=q2δ (q2,1)=q2δ (q2,0)=q2M是一个 A 有穷状态自动机,它所对应的状态转换图为 B ,它所能接受的语言可以用正则表达式表示为 C 。
【华为】C 面试题、笔试题及答案(经典)
(一) 初级题1. 什么是预编译,何时需要预编译:答:(1) 总是使用不经常改动的大型代码体(2) 程序由多个模块组成,所有模块都使用一组标准的包含文件和相同的编译选项。
在这种情况下,可以将所有包含文件预编译为一个预编译头<<预编译又称为预处理,是做些代码文本的替换工作处理#开头的指令,比如拷贝#include包含的文件代码,#define宏定义的替换,条件编译等就是为编译做的预备工作的阶段主要处理#开始的预编译指令预编译指令指示了在程序正式编译前就由编译器进行的操作,可以放在程序中的任何位置。
常见的预编译指令有:>>2. char * const pchar const * pconst char *p上述三个有什么区别?答:char * const p; //常量指针,p的值不可以修改char const * p;//指向常量的指针,指向的常量值不可以改const char *p;//和char const *p3.char str1[] = "abc";char str2[] = "abc";const char str3[] = "abc";const char str4[] = "abc";const char *str5 = "abc";const char *str6 = "abc";char *str7 = "abc";char *str8 = "abc";cout << ( str1 == str2 ) << endl;cout << ( str3 == str4 ) << endl;cout << ( str5 == str6 ) << endl;cout << ( str7 == str8 ) << endl;结果是:0 0 1 1str1,str2,str3,str4是数组变量,它们有各自的内存空间;而str5,str6,str7,str8是指针,它们指向相同的常量区域。
compiler-习题解答-补充习题-自动机-正规式-文法
1. ∑={a, b, c}, 构造NFA ,可以识别a,b,c 组成的串,串中所含 a 的个数不超过1. (即可以含一个a 或不含a)2. ∑={a, b, c}, 构造NFA ,可以识别a,b,c 组成的串,串中只含一个a3. ∑={a, b, c}, 构造NFA ,可以识别a,b,c 组成的串,串中 至少含一个a4. 构造识别标识符的自动机 l (l |d)*5. ∑={a, b} , 构造NFA, 可以识别不以a 开头, 但以aa 结尾的字符串并写出等价的正规式b(a|b)*aa6. ∑={a, b},构造NFA, 可以识别a,b 组成的串, 每个a 后面至少紧随两个b, 并写出等价的正规式(b|abb)*b, cl, d1. 给语言 L={an|n≥0} , 写3型文法,并构造自动机可以构造出L 的自动机如下: 再将自动机转换成3型文法,G: S →aS |ε2. 给语言L={ an b m|n,m≥1},写3型文法,并构造自动机可以构造出L 的自动机如下: 再将自动机转换成3型文法,G: S →aAA →aA|bB B →bB|ε3. 构造自动机 L={ a2n+1b 2m a 2p+1| n≥0,m≥1, p≥0 }4. 给语言 L(G)={ an b m c k|n,m,k≥0} ,写3型文法,并构造自动机a*b*c*G: S →aS|BB →bB|C C →cC|ε 将DF A 1和DF A 2确定化最小化, 得到结果相同:a,b,cb5. 构造自动机,识别能被3整除的二进制数状态0: 被3整除状态1: 被3除余1状态2: 被3除余26. 构造自动机,识别含奇数个0 且 奇数个1 的二进制数串S: 偶数个0, 偶数个1A: 奇数个0, 偶数个1 B: 奇数个0, 奇数个1 C: 偶数个0, 奇数个17. 构造文法, 产生含有偶数个1的二进制数串, ∑={0,1} 解法一:G : S → 0S | 1A | ε A → 0A | 1S解法二:S: 偶数个0, 偶数个1 A: 奇数个0, 偶数个1 B: 奇数个0, 奇数个1 C: 偶数个0, 奇数个1确定化,最小化,则得到解法一中的DFA单元测试28. 构造自动机,识别满足以下条件的符号串:至少含有两个1, 又在任何两个1之间有偶数个09. 写出下图所示自动机所描述的语言100*|100*11*0|111*0化简得: 10*1*0L={10m1n0 | m≥0, n≥0}10. 证明题:正规集的子集不一定是正规集证明如下:a*b* 是正规集, L1={ a n b n |n≥0}是它的子集, 但是L1不是正规集, 因为找不到一个3型文法描述L1, 即只能用2型文法描述L1G: S→aSb|ε。
vivado中systemverilog混合编译
vivado中systemverilog混合编译在Vivado中,SystemVerilog混合编译是指将SystemVerilog代码与Verilog代码一起编译和仿真。
Vivado支持这种混合编译,以便您可以在同一个项目中使用两种语言。
以下是混合编译的一般步骤:1. 创建项目:首先,创建一个新的Vivado项目。
这可以通过打开Vivado软件并创建一个新的项目文件来实现。
2. 添加文件:在项目中添加所需的Verilog和SystemVerilog文件。
您可以将文件直接拖放到项目浏览器中,或者通过菜单栏中的“File”>“Add”>“File”来添加。
3. 编写代码:在Verilog和SystemVerilog文件中编写代码。
请注意,混合编译的代码应该遵循一定的规范,以便Vivado可以正确地识别和处理两种语言。
4. 编译和仿真:在Vivado中编译项目。
可以通过菜单栏中的“Run”>“Compile”来执行编译操作。
编译完成后,您可以使用Vivado提供的仿真工具进行仿真。
5. 分析结果:在仿真过程中,您可以查看波形、报告和其它输出文件,以分析设计的性能和正确性。
以下是一些建议,以确保混合编译的顺利进行:-避免在同一个模块中混合使用Verilog和SystemVerilog代码。
尽量将Verilog代码和SystemVerilog代码分别放在不同的模块中。
-使用Vivado提供的预处理器指令来区分Verilog和SystemVerilog代码。
例如,使用``来声明一个模块为SystemVerilog模块。
-确保SystemVerilog模块中的异常处理和监控功能正确实现,以避免编译错误。
-熟悉Vivado的编译器和仿真器,以便在混合编译环境中正确地使用它们。
总之,在Vivado中进行SystemVerilog混合编译需要遵循一定的规范和技巧。
通过遵循这些规范和技巧,您可以充分利用Verilog和SystemVerilog的优势,提高设计开发效率。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1.1.叙述正规式(00 | 11)*( (01 | 10) (00 | 11)* (01 | 10) (00 | 11)* )*描述的语言。
答案:该正规式所描述的语言是,所有由偶数个0和偶数个1构成的串。
另外,和该正规式等价的正规式有( 00 | 11 | ( (01 | 10) (00 | 11)* (01 | 10) ) )*。
备注:一、如果题目要求转化为NFA,则方法1:按照课本P54-55(或课件compiler –03)的方法转化。
方法2:见题目1.5的方法。
二、如果题目要求转化为DFA,则方法1:先将正规式转化为NFA,再按照课本P49-51(或课件compiler –03)的方法转化。
方法2:如果掌握的非常熟练,而且正规式比较简单,则可参照题目1.6的方法直接转化。
三、如果题目要求化简DFA,或得到最简DFA,则在得到DFA后,按照课本P56-57(或课件compiler-03)的方法化简。
1.2 给出下面的正规表达式:(1)能被五整除的十进制整数(2)包含奇数个1或奇数个0的二进制数串(3)包含偶数个0和奇数个1的二进制数串答案:(1) 以0|5结尾的十进制数→长度为1的十进制数或长度大于1的十进制数→长度为1的正规式为(0|5)→长度大于1的正规式为(1|2|3|4|5|6|7|8|9) (0|1|2|3|4|5|6|7|8|9)* (0|5)→正规式为:(0|5) | (1|2|3|4|5|6|7|8|9) (0|1|2|3|4|5|6|7|8|9)*(0|5)(2) 包含奇数个1或奇数个0的二进制串→包含奇数个1 或包含奇数个0→思考ing:(偶数个1)* 一定是偶数个1构成的串,但是(奇数个1)* 一定是奇数个1构成的串吗?答案是否定的→那么为了得到奇数个1组成的串怎么办?→1(偶数个1)* 肯定是奇数个1组成的串→为了得到奇数个1的二进制串,还需要补上0→得到正规式0*10*(10*10*)*→同理,可以得到奇个数0的二进制串,1*01*(01*01*)→正规式为0*10*(10*10*)* | 1*01*(01*01*)→与之等价的正规式为0*1(0|10*1)*|1*0(1|01*0)*(3) 包含偶数个0和奇数个1的二进制数串→由1.1可知,偶数个1和偶数个0的正规式为(00 | 11)*( (01 | 10) (00 | 11)* (01 | 10) (00 | 11)* )*,先给该正规式起个名字,even_0_even_1→ (00 | 11)*( (01 | 10) (00 | 11)* (01 | 10) (00 | 11)* )*→在此基础上,我们只需将even_0_even_1与奇数个1和偶数个0构成的串连接即可→对于二进制串,起始字符为1或0→如果是1,那么剩下的部分一定是偶数个0和偶数个1,即得到1 even_0_even_1→如果是0,那么经过若干个00或11,一定会出现一个01或10,才能保证0的个数是偶数,1的个数是奇数。
若串还没有结束,剩余部分一定是偶数个0和偶数个1,即得到0 (00 | 11)* (01 |10) even_0_even_1→综上,正规式为1 even_0_even_1 | 0 (00 | 11)* (01 | 10) even_0_even_11.3.构造一个DFA,它接受∑ = {0, 1}上0和1的个数都是偶数的字符串。
答案 见图1.1。
分析(1) 把问题分析一下,这里要接受的是偶数个0和偶数个1的串,和偶数相对的是奇数,因此,对于任意一个0和1的串,不论其0和1的个数有多少,总归不是偶数个就是奇数个。
因此任意一个串属于下面四种情况之一。
情况0:0偶和1偶(作为状态0); 情况1:0偶和1奇(作为状态1); 情况2:0奇和1偶(作为状态2);情况3:0奇和1奇(作为状态3)。
并且不管一个串是处于上面哪一种情况,该串再添加一个0或1后,总是处于上面另一种情况。
由此分析可以知道,DFA 只需四个状态就够了。
(2) 再看四个状态中哪个是初态,哪个是终态。
空串是属于0偶(0个0)和1偶(0个1)的情况,因此状态0是初态。
因为我们接受偶数个0和偶数个1的串,因此状态0也是终态。
1.4.构造一个DFA ,它接受 ∑ = {0, 1}上能被5整除的二进制数。
答案 见图1.2。
分析(1)与上题类似,先找出状态。
即想明白应该有多少个状态,状态之间的转换条件,以及针对该问题的开始状态和接受状态。
(2)对于本题目,任意一个二进制数除以5时,只有余数为0(即整除),1,2,3和4五种情况。
图中的五个状态也是这样起名字的。
一个二进制数的后面添上一个0意味着其值变成原来的两倍,而后面添上一个1意味着其值变成原来的两倍再加1。
不管是哪一种情况,都很容易从原来的余数决定值变化后的余数。
这样,我们很快可以得出所有的状态转换。
例如,我们考虑状态4。
任何一个余4的数,两倍后一定余3,两倍再加1后一定还是余4。
所以,状态4的0转换到状态3,而1转换到本身。
显然,状态0既是开始状态又是接受状态。
1.5 为正规式(a | b)* a (a | b) (a | b)构造NFA 。
答案 该NFA 的状态转换图见图1.3。
3121 1110 0 0 start图1.1 接受偶数个0和偶数个1的的DFA1 2 34start0 00 01 11 11图1.2 接受能被5整除的二进制数的DFA备注:各种教材在介绍有限状态自动机和正规表达式的等价时,都给出了从正规表达式构造等价的NFA的算法。
不同书上的构造算法虽然不一样,但有一个共同的特点,或多或少引入了ε转换,使状态转换图变得复杂。
尤其是,如果题目还要求你画出DFA ,那么状态数的增多,使得手工完成NFA 确定化为DFA 的过程变得更容易出错。
因此,我们要会用两种方法构造NFA :(1) 按照课本P54-55(或课件compiler –03)的方法转化。
(2) 要会手工构造更简一些的NFA ,尽量避免在NFA 中出现ε转换。
这在大多数情况下是可以做到的,本题就是一个例证。
1.6 用状态转换图表示接收(a | b)* aa 的确定的有限自动机。
答案 状态转换图见图1.4。
备注:与上题的区别是,上题是直接构造NFA ,现在需要直接构造DFA 。
此时,仍然需要指明,我们需要会两种方法构造DFA :(1) 先将正规式转化为NFA ,再按照课本P49-51(或课件compiler 03)的方法转化。
(2) 要会手工直接构造DFA 。
我们通过本题和下一题来说明,手工直接构造DFA 也并不太困难。
分析:(1) 该正规式表示的语言是,字母表∑= {a, b}上最后两个字符都是a 的串的集合。
抓住这个特点,我们首先画出构造过程中的第一步,见图1.5。
它表明最简单的句子是aa 。
(2) 然后,因为在第一个a 前可以有若干个a 或b ,因此状态0有到自身的b 转换。
在最后两个字符都是a 的串的末尾添加若干个a ,能够保持串的这个性质,因此状态2有到自身的a 转换。
这样我们有图1.6。
210 3startaaabbab图 1.3 接受正规式(a | b)* a (a | b) (a | b)的NFAa12startaabbb图1.4 接收(a | b)* aa 的DFA12starsaa图1.5 构造过程中的第一步(3)最后,在状态1和状态2碰到b 时,前面刚读过的a ,不管连续有多少个,都不可能作为句子结尾的那两个字符a ,因此状态1和状态2的b 转换回到状态0。
所有状态的a 转换和b 转换都已给出,这就得到最后结果。
如图1.4和1.71.7 用状态转换图表示接收(a | b)* a (a | b) (a | b)的确定的有限自动机。
答案 状态转换图见图1.8。
分析(1) 该正规式表示的语言是,字母表∑= {a, b}上倒数第三个字符是a 的串的集合。
根据1.6题的经验,我们首先画出图1.9。
因为最后两个字符任意,因此有这样的分杈,并有四个接受状态。
(2) 现在考虑这四个接受状态上的转换。
1 02startaaab 图1.6 构造过程中的第二步2134 5 67aabba abbstartb aababab图1.8 接收(a | b)* a (a | b) (a | b)的DFAa12starta abbb图1.7 接收(a | b)* aa 的DFA状态4 该状态表示最后三个字符是aaa ,若再添加一个a ,最后三个字符仍是aaa ,因此状态4的a 转换到本身。
若添加的是b ,那么最后三个字符是aab ,而状态5表示最后三个字符是aab ,因此状态4的b 转换到状态5。
状态5 该状态表示最后三个字符是aab ,若再添加一个a ,最后三个字符成了aba ,而状态6表示最后三个字符是aba ,因此状态5的a 转换到状态6。
若添加的是b ,那么最后三个字符是abb ,而状态7表示最后三个字符是abb ,因此状态5的b 转换到状态7。
状态6 该状态表示最后三个字符是aba ,若再添加一个a ,最后三个字符成了baa ,其由a 开始的后缀是aa ,因此状态6的a 转换到状态2(因为从状态0出发经aa 是到状态2)。
若添加的是b ,那么最后三个字符是bab ,其由a 开始的后缀是ab ,因此状态6的b 转换到状态3。
状态7 该状态表示最后三个字符是abb ,若再添加一个a ,最后三个字符成了bba ,其由a 开始的后缀是a ,因此状态7的a 转换到状态1。
若添加的是b ,那么最后三个字符是bbb ,不存在由a 开始的后缀,因此状态7的b 转换到状态0。
这样,所有状态的a 转换和b 转换都已给出,也就得到了最后结果。
1.8 将1.5 题得到的NFA 变换成DFA 。
答案: 所求的DFA 就是1.7题的结果。
备注:我们之所以选这个题目,是为了比较一下,从正规式到NFA ,再把NFA 确定化,这样得的结果同1.7题直接构造DFA 的结果是否一样。
按照教材上的子集构造法,作为结果的DFA 并不难得到。
另外由于没有 转换,构造过程相对简单了很多。
求解:NFA 的开始状态是0,因此首先从NFA 的状态集合{0}开始,它是DFA 的开始状态,起名叫状态T0。
由于∑={a, b}, 它的a 转换和b 转换所得到的NFA 的状态集合见下面。
根据子集构造法所得的DFA 的所有状态和它们的转换函数都列在下面。
状态T0:{0}move ({0}, a) = {0, 1}=T1move ({0}, b) = {0}=T0状态T1:{0, 1}move (T1, a) = {0, 1, 2}=T2move (T1, b) = {0, 2}=T3状态T2:{0, 1, 2} move (T2, a) = {0, 1, 2, 3}=T4move (T2, b) = {0, 2, 3}=T5 状态T3:{0, 2}move (T3, a) = {0, 1, 3}=T6move (T3, b) = {0, 3} =T72134567aabba a bb start图1.9 构造过程的第一步状态T4:{0, 1, 2, 3} move (T4, a) = {0, 1, 2, 3} =T4move (T4, b) = {0, 2, 3} =T5 状态T5:{0, 2, 3} move (T5, a) = {0, 1, 3} = T6move (T5, b) = {0, 3} = T7 状态T6:{0, 1, 3} move (T6, a) = {0, 1, 2} = T2move (T6, b) = {0, 2} = T3状态T7:{0, 3}move (T7, a) = {0, 1} = T1move (T7, b) = {0} = T0状态T4, T5, T6和T7中都含原NFA 的接受状态3,因此它们都是DFA 的接受状态。