zoukankan      html  css  js  c++  java
  • Tcl之Lab1

    Task 1.  Use help

     1) What is the default switch for the redirect command?  -file

    help -v redirect  # or redirect -help

     2) Use the very last example in the man page, can you use the -append switch when redirecting to a variable? Yes.

    man  redirect

     

    Task 2.  Count library cells

      Count the number of muxes and xor gates available in the technology library core_slow.db. Given that:

      - Library cells can be reported using the following command: report_lib core_slow.db

      - All mux cells begin with the letters mx (eg mx2a1)

      - All xor gates begin with the letters xor (eg xor3b15)

     1)  First method

    1 # Redirect library report to a variable and use regexp
    2 redirect  -variable  rptstring  {report_lib  core_slow.db}
    3 
    4 regexp  -all  mx  $rptstring
    5 -> 36
    6 regexp  -all  cor  $rptstring
    7 -> 24

     2)  Second method

     1 # Redirect the library report to a file and use the unix command grep
     2 # This is the less desirable method due to the potentially large memory 
     3 # footprint required for the exec command
     4 redirect   tmp1212  {report_lib  core_slow.db}
     5 exec  grep  -c  mx  tmp1212
     6 -> 36
     7 exec  grep  -c  xor  tmp1212
     8 -> 24
     9 
    10 # Use grep without options to print each line containing a pattern
    11 exec  grep  xor  tmp1212
    12 # Delete the file if desired
    13 file delete tmp1212

    Task 3.  Analyze an unfamiliar script

     1 proc clock_domain {args} {
     2 
     3 # This Tcl procedure identifies the clocks constraining input ports
     4  foreach_in_collection each_port [get_ports -quiet $args] {
     5 
     6   set paths [get_timing_paths -from $each_port]
     7   foreach_in_collection each_path $paths {
     8      lappend port_array([get_object_name $each_port]) 
     9                    [get_object_name [get_attribute $each_path endpoint_clock]]
    10   }
    11  }
    12 
    13  foreach item [array names port_array] {
    14      echo "$item    $port_array($item)"
    15  }
    16 }

     1)  How many commands are in this script?  12 commands

        Use the aquare brackets to help identify the embeddd commands.

     2)  How many occurrences of variable substitution are there?  8 occurrences

        Use the $ to help identify the variable names. This procedure is using a type of variable called arrays.

     3)  How many arguments are required for the proc command (recall that {} are used to identify a single argument)?

        3 argumets.  proc clock_domain {args} {body}

     4)  What symbol designates a comment in a script?  #

     5)  What symbol will continute a command over several lines?  

        

  • 相关阅读:
    NLP Best Practices
    Bert模型精简方法
    delphi:对象的创建(create)与释放(free/destory)(转载)
    delphi:Format格式化函数(转载)
    delphi:destroy, free, freeAndNil, release用法和区别(转载)
    delphi:function ParamStr(i:LongInt):string
    jquery:上传文件
    bootstrapValidator中用ajax校验
    jquery中实时监控文本框的变化
    jquery判断checkbox是否选中
  • 原文地址:https://www.cnblogs.com/mengdie/p/4611696.html
Copyright © 2011-2022 走看看