{"id":41,"date":"2024-03-09T14:43:55","date_gmt":"2024-03-09T06:43:55","guid":{"rendered":"http:\/\/104.46.213.183\/?p=41"},"modified":"2024-03-09T14:43:55","modified_gmt":"2024-03-09T06:43:55","slug":"tcl%e8%af%ad%e8%a8%80%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/www.yewpo.top\/index.php\/41\/","title":{"rendered":"TCL\u8bed\u8a00\u57fa\u7840"},"content":{"rendered":"<h1>TCL\u8bed\u8a00\u57fa\u7840<\/h1>\n<blockquote>\n<p><code>Tclsh<\/code>\u662f\u4e00\u4e2a\u4ece\u6807\u51c6\u8f93\u5165\u6d41\u6216\u4ece\u6587\u4ef6\u4e2d\u8bfb\u53d6<code>tcl<\/code>\u547d\u4ee4\u5e76\u6267\u884c\u4ed6\u4eec\u7684\u7c7b<code>shell<\/code>\u5e94\u7528\u3002<\/p>\n<p>\u5728\u6570\u5b57\u96c6\u6210\u7535\u8def\u8bbe\u8ba1\u4e2d\uff0c<code>Tcl<\/code>\u8bed\u8a00\u65e0\u5904\u4e0d\u5728\u4f7f\u7528\uff0c\u4e0b\u9762\u7528\u5f20\u8868\u683c\u6765\u8bf4\u660e\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u529f\u80fd<\/th>\n<th>\u5de5\u5177<\/th>\n<th>\u8bed\u8a00<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u6570\u5b57\u7efc\u5408<\/td>\n<td>DC\/Genus<\/td>\n<td>TCL<\/td>\n<\/tr>\n<tr>\n<td>DFT<\/td>\n<td>Tessent\/Dftmax<\/td>\n<td>TCL<\/td>\n<\/tr>\n<tr>\n<td>\u5e03\u5c40\u5e03\u7ebf<\/td>\n<td>lnnovus\/ICC2<\/td>\n<td>TCL<\/td>\n<\/tr>\n<tr>\n<td>\u9759\u6001\u65f6\u5e8f\u4eff\u771f<\/td>\n<td>PT\/Tempus<\/td>\n<td>TCL<\/td>\n<\/tr>\n<tr>\n<td>\u529f\u8017\u5206\u6790<\/td>\n<td>Redhawk\/Voltus<\/td>\n<td>TCL<\/td>\n<\/tr>\n<tr>\n<td>\u7248\u56fe\u5de5\u5177<\/td>\n<td>Calibredrv<\/td>\n<td>TCL<\/td>\n<\/tr>\n<tr>\n<td>\u7269\u7406\u9a8c\u8bc1<\/td>\n<td>Calibre\/PVS<\/td>\n<td>SVRF\/TCL<\/td>\n<\/tr>\n<tr>\n<td>\u5f62\u5f0f\u9a8c\u8bc1<\/td>\n<td>LEC\/Formality<\/td>\n<td>TCL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53ef\u89c1\uff0c<code>TCL<\/code>\u5728\u8fd9\u65b9\u9762\u4f7f\u7528\u4e4b\u5e7f\u3002<\/p>\n<\/blockquote>\n<h2>\u57fa\u672c\u7c7b\u578b<\/h2>\n<h3>\u7b26\u53f7<\/h3>\n<ul>\n<li><code>$<\/code>\uff1a\u89e3\u6790\u53d8\u91cf\uff0c\u7c7b\u4f3c\u4e8e<code>shell<\/code>\u3002<\/li>\n<li><code>[]<\/code>\uff1a\u5185\u7f6e\u8f6c\u6362\uff0c\u7c7b\u4f3c\u4e8e<code>shell<\/code>\u7684<code>$()<\/code>\u3002<\/li>\n<li><code>\\<\/code>\uff1a\u8f6c\u4e49\u5b57\u7b26\u3002<\/li>\n<li><code>{}<\/code>\uff1a\u5185\u90e8\u90fd\u662f\u666e\u901a\u5b57\u7b26\uff0c\u7c7b\u4f3c\u4e8e<code>shell<\/code>\u7684<code>&quot;&quot;<\/code>\u3002<\/li>\n<\/ul>\n<h3>\u53d8\u91cf<\/h3>\n<pre><code class=\"language-tcl\">set \u53d8\u91cf\u540d \u503c\n\n# \u5982\u679c\u60f3\u5728\u53d8\u91cf\u540e\u9762\u8ffd\u52a0_1\uff0c\u505a\u6cd5\u5982\u4e0b:\nset a 2\nputs ${a}_1\n# output 2_1<\/code><\/pre>\n<h3>\u6570\u7ec4<\/h3>\n<pre><code class=\"language-tcl\">set \u6570\u7ec4\u540d(\u5c5e\u6027\u540d) \u503c\n\n# eg.\nset cell(attr1) &quot;name&quot;\nset cell(attr2) &quot;ref&quot;\n# \u6570\u7ec4\u540d\u4e3acell\uff0c\u6709\u4e24\u4e2a\u5c5e\u6027\uff0c\u4e00\u4e2aattr1\uff0c\u4e00\u4e2aattr2\n\n# array\u547d\u4ee4\u53ef\u4ee5\u83b7\u53d6\u6570\u7ec4\u7684\u76f8\u5173\u4fe1\u606f\narray size cell\n# output 2\narray names cell\n# output attr1 attr2<\/code><\/pre>\n<h3>\u5217\u8868<\/h3>\n<pre><code class=\"language-tcl\">set \u5217\u8868\u540d {\u5143\u7d201 \u5143\u7d202 \u5143\u7d203}\n\n# \u6709\u4ee5\u4e0b\u8fd9\u4e9b\u547d\u4ee4\u53ef\u4ee5\u5bf9\u5217\u8868\u8fdb\u884c\u64cd\u4f5c\n# concat\uff1a\u5408\u5e76\u5217\u8868\n# lindex\uff1a\u9009\u53d6\u5217\u8868\u4e2d\u7684\u67d0\u4e2a\u5143\u7d20\uff0c\u4e0b\u6807\u4ece0\u5f00\u59cb\n# lappend\uff1a\u5728\u5217\u8868\u672b\u7aef\u8ffd\u52a0\u5143\u7d20\n# lsort\uff1a\u5217\u8868\u6392\u5e8f\uff0c-real\u53ef\u4ee5\u6d6e\u70b9\u6570\u6392\u5e8f\uff0c-uniqe\u53ef\u4ee5\u552f\u4e00\u5316<\/code><\/pre>\n<h2>\u63a7\u5236\u8bed\u53e5<\/h2>\n<h3>\u6761\u4ef6\u8bed\u53e5<\/h3>\n<pre><code class=\"language-tcl\">if {condition} {\nstatements\n} elseif {condition} {\nstatements\n} else {\nstatements\n}\n# \u5fc5\u987b\u6309\u7167\u8fd9\u4e2a\u683c\u5f0f<\/code><\/pre>\n<h3>\u5faa\u73af\u8bed\u53e5<\/h3>\n<h4>foreach<\/h4>\n<pre><code class=\"language-tcl\">foreach \u53d8\u91cf \u5217\u8868 \u5faa\u73af\u4f53\n\n# eg.\nset list1 {3 2 1}\nfor i $list1 {\nputs $i\n}\n# output 3\\n2\\n1<\/code><\/pre>\n<p>\u4e5f\u6709<code>break<\/code>\u548c<code>continue<\/code>\uff0c\u548c<code>C<\/code>\u8bed\u8a00\u7c7b\u4f3c\u3002<\/p>\n<h4>while<\/h4>\n<pre><code class=\"language-tcl\">while {condition} {statements}<\/code><\/pre>\n<h4>for<\/h4>\n<pre><code class=\"language-tcl\">for {initialize} {condition} {step length} {statements}\n\n# eg.\nfor {set i 3} {$i &gt; 0} {incr i -1} {\nputs $i\n}\n# 3\n# 2\n# 1<\/code><\/pre>\n<h2>\u51fd\u6570<\/h2>\n<h3>\u8fc7\u7a0b\u51fd\u6570<\/h3>\n<pre><code class=\"language-tcl\">proc \u51fd\u6570\u540d \u53c2\u6570\u5217\u8868 \u51fd\u6570\u4e3b\u4f53\n\n# eg.\nproc add {a b} {\nset sum [expr $a + $b]\nreturn $sum\n}<\/code><\/pre>\n<h3>\u5168\u5c40\u53d8\u91cf<\/h3>\n<p>\u5728\u6240\u6709\u8fc7\u7a0b\u4e4b\u5916\u5b9a\u4e49\u7684\u53d8\u91cf<\/p>\n<h3>\u5c40\u90e8\u53d8\u91cf<\/h3>\n<p>\u5728\u8fc7\u7a0b\u4e2d\u5b9a\u4e49\u7684\u53d8\u91cf<\/p>\n<p>\u5982\u679c\u60f3\u8981\u5728\u8fc7\u7a0b\u4e2d\u4f7f\u7528\u5168\u5c40\u53d8\u91cf\u53ef\u4ee5\u4f7f\u7528<code>global<\/code>\u547d\u4ee4\uff0c\u4f8b\u5982\uff0c<code>global a<\/code>\uff0c\u4f7f\u7528\u5168\u5c40\u53d8\u91cf<code>a<\/code>\u3002<\/p>\n<h3>\u6587\u672c\u5904\u7406<\/h3>\n<h4>\u6253\u5f00\u6587\u4ef6<\/h4>\n<pre><code class=\"language-tcl\">open \u6587\u4ef6\u540d \u6743\u9650\n\n# eg.\nset afile [open a.txt r]<\/code><\/pre>\n<h4>\u8bfb\u53d6\u6587\u4ef6<\/h4>\n<pre><code class=\"language-tcl\">gets \u6587\u4ef6\u53d8\u91cf \u53d8\u91cf\u540d\n# \u4f1a\u4ece\u4e2d\u8bfb\u53d6\u4e00\u884c<\/code><\/pre>\n<h4>\u5173\u95ed\u6587\u4ef6<\/h4>\n<pre><code class=\"language-tcl\">close \u6587\u4ef6\u53d8\u91cf\n\n# eg.\nclose afile<\/code><\/pre>\n<h2>\u7efc\u5408\u8f6f\u4ef6\u5f53\u4e2d\u5e38\u89c1\u7684TCL\u6307\u4ee4<\/h2>\n<ul>\n<li><code>get_ports<\/code>\uff1a\u8fd4\u56de\u8bbe\u8ba1\u4e2d\u5bf9\u5e94\u7684\u7aef\u53e3<\/li>\n<li><code>get_cells<\/code>\uff1a\u8fd4\u56de\u8bbe\u8ba1\u4e2d\u5bf9\u5e94\u7684<code>cell<\/code><\/li>\n<li><code>get_nets<\/code>\uff1a\u8fd4\u56de\u8bbe\u8ba1\u4e2d\u7684\u7f51\u8868<\/li>\n<li><code>get_pins<\/code>\uff1a\u8fd4\u56de\u8bbe\u8ba1\u4e2d\u7684\u9488\u811a<\/li>\n<\/ul>\n<p>\u4f7f\u7528<code>-f<\/code>\u53ef\u4ee5\u7528\u6765\u8fc7\u6ee4\uff1b\u4f7f\u7528<code>-of<\/code>\u5f97\u5230\u6307\u5b9a<code>object<\/code>\u76f8\u8fde\u7684<code>object<\/code>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6570\u5b57\u96c6\u6210\u7535\u8def\u9759\u6001\u65f6\u5e8f\u5206\u6790\u57fa\u7840TCL\u7bc7\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[13],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-cpu","tag-tcl"],"_links":{"self":[{"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yewpo.top\/index.php\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}