Home > database >  redirect command output to a file
redirect command output to a file

Time:05-30

   set fp_results [open "connectivity.txt" a ]
   set my_nets [get_nets *user given nets*]
   foreach_in_collection net $my_nets {
   set my_net [get_object_name $net]
   set cmd "check_lvs -nets $my_net -checks open -open_reporting bounding_box -max_errors 0"
   puts $fp_results "checking for: $my_net"
   puts $fp_results "eval $cmd"
}
close $fp_results

Here, a block of tcl code is given which checks whether the given nets are open or not in ICcompiler2(ICC2) shell. the eval command returns either 1/0 depending on open status of net. so the value of 0/1 is redirected to file. evaluating "eval $cmd" alone in icc2 shell reports all the details(co-ordinates etc). how to redirect the complete details of "eval $cmd" to file? the above line (puts $fp_results "eval $cmd") just redirects 1/0 to file.

CodePudding user response:

This is ICC2, which means you can use the redirect command that Synopsys includes with their tools.

fc_shell> man redirect
2.  Synopsys Commands                                        Command Reference
                                   redirect

NAME
       redirect
              Redirects the output of a command to a file.

SYNTAX
       string redirect
       [-append] [-tee] [-file | -variable | -channel] [-compress]
       [-bg]
       [-max_cores number_of_cores]
       target
       {command_string}

   Data Types
       number_of_cores  integer
       target           string
       command_string   string

Instead of using puts $fp, you can redirect the stdout to a filename.

set my_nets [get_nets *user given nets*]

redirect -file "connectivity.txt" {
  foreach_in_collection net $my_nets {
   set my_net [get_object_name $net]
   set cmd "check_lvs -nets $my_net -checks open -open_reporting bounding_box -max_errors 0"
   puts "checking for: $my_net"
   eval $cmd
  }
}
  • Related