• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Digital Implementation
  3. Need guidance to develop a script to get the number of logic...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 94
  • Views 17998
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Need guidance to develop a script to get the number of logic levels from an encounter timing report..!

NAADHAN
NAADHAN over 16 years ago

Hi all,

                   I need to develop a script for finding the number of logic levels in a timing report from encounter.I should give a timing report as an input and i need to get the number of logic levels(Combinational) as an output.Can anyone Pls guide me in developing  it?

Thanks and Regards,
NAADHAN

 

  • Cancel
  • maven7783
    maven7783 over 16 years ago

     Hi NAADHAN,

    You can use the awk command to get it 

    awk '{print $4}' filename

    $4 is the cell column the timing report.Direct the output of the above command to file where use numbering commmand of vi and find out the logic levels.

    OR

    Before you output timing report change the global report_timing_format to only cells....which will give only cells...

    Hope this helps

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • BobD
    BobD over 16 years ago

    On thing that may also be useful here is the ability for the report_timing command to return a *collection* instead of a textual report.  The collection can then be programmatically queried for all sorts of information, including the number of timing points.  Here's how that would work:

    1. First, add the "-collection" switch to the report_timing command, and capture it as a variable called "c":
      encounter 39> set c [report_timing -collection]                
      0xdd
    2. Next, you can query which properties are present for the collection. You should see all kinds of fields present, but "timing_points" is the one we can use to determine the number of levels of logic:
      required_time                       | 4.646
      setup                               | 1.104
      slack                               | -0.503
      slackPercentile                     |
      slackSensitivity                    |
      slackStdDeviation                   |
      timing_points                       |  <--
    3. We can get the timing_points field with the "get_property" command:
      encounter 41> get_property $c timing_points                    
      0xe5
    4. Each of the instances in the timing path has 2 "points".  These can be iterated through and queried, but if you wanted to get the number of logic levels rather than the number of timing points, you could roughly divide by 2. This path has 10 instances:
      encounter 42> sizeof_collection [get_property $c timing_points]
      20

    Hope this is helpful,
    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • NAADHAN
    NAADHAN over 16 years ago

    Hi Bob ,,,,thanks a lot for your suggestion... i will start working on this from today onwards ;D.... Could you elaborate on querying for properties ??? am not clear on that...


    Thanks & Regards,
    NAADHAN ;D

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • VedGupta
    VedGupta over 10 years ago
    Hi Bob , can you describe , how can i query for properties for collection ?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • BobD
    BobD over 10 years ago

    Use "report_property" and "get_property".

    There is a Rapid Adoption Kit for this:

    Usage of collections in EDI & ETS, version 11.1 and above 

    Hope this helps!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • kazad
    kazad over 10 years ago

    Hi Naadhan

    You can try the following 'getLogicLevel' procedure which is used in the 'generateSlackReport' procedure.

    Please let me know if you see any issues.

    Thanks

    Khandaker

    ################################################################################
    # Procedure to get logic level from a given collection of timing points
    ################################################################################
    proc getLogicLevel {timingPointsColl} {

    set currentInst ""
    set pathInstList {}


    foreach_in_collection timingPointObj $timingPointsColl {

    set pinObj [get_property $timingPointObj pin]
    set objType [get_property $pinObj object_type]

    if {$objType == "pin"} {
    set instObj [get_cell -of_objects $pinObj]
    set instName [get_property $instObj hierarchical_name]
    } else {
    set instName [get_property $pinObj hierarchical_name]
    }

    if {$instName != $currentInst} {
    lappend pathInstList $instName
    set currentInst $instName
    }
    }
    set logicLevel [llength $pathInstList]

    return $logicLevel
    }

    ################################################################################
    # Procedure to generate timing slack file
    # Usage: generateSlackReport -mode <setup | hold> -slackTarget <slack_target> -file <report_file>
    ################################################################################
    proc generateSlackReport {args} {


    # Defaults
    set slackTarget 0.0


    # Get setup/hold
    if {[regexp {\-mode} $args]} {
    set analysisMode [lindex $args [expr [lsearch $args -mode] + 1]]
    }


    # Get slack target
    if {[regexp {\-slackTarget} $args]} {
    set slackTarget [lindex $args [expr [lsearch $args -slackTarget] + 1]]
    }


    # Get slack file name
    if {[regexp {\-file} $args]} {
    set slackFile [lindex $args [expr [lsearch $args -file] + 1]]
    }

    # Help
    set helpString "Usage : generateSlackReport \
    \-mode <setup | hold > \
    \-slackTarget <slack_target> \
    \-file <slack_file_name> \
    \-help"


    if {[regexp {\-help} $args] || $args == ""} {
    puts $helpString
    return 0
    }


    # Main code
    ############################################################


    # Open slack report file
    set f [open $slackFile w]


    # Set command set for setup/hold analysis
    if {$analysisMode == "setup"} {

    set rptTimingCmd {report_timing -from [all_registers -clock_pins] -to [all_registers -data_pins] -max_slack $slackTarget -late -collection}

    } elseif {$analysisMode == "hold"} {

    set rptTimingCmd {report_timing -from [all_registers -clock_pins] -to [all_registers -data_pins] -max_slack $slackTarget -early -collection}

    } else {

    puts "ERROR: Unsupported analysis mode!"
    return 0
    }


    # Report header
    puts $f [genLine -width 100 -char "="]
    puts $f [format "%-10s %-30s %-8s %-8s %-25s %-50s %80s" "Slack" "View Name" "Level" "Skew" "Clock Domain" "Launch Point" "Capture Point"]
    puts $f [genLine -width 100 -char "="]

    # Create a collection of timing paths
    set timingPaths [eval $rptTimingCmd]

    if {[sizeof_collection $timingPaths] > 0} {

    # Iterate over the set of paths, and process them one at-a-time
    foreach_in_collection path [sort_collection $timingPaths {slack}] {

    set timingPointsColl [get_property $path timing_points]
    set logicDepth [getLogicLevel $timingPointsColl]

    set startPoint [get_property [get_property $path launching_point] hierarchical_name]
    set endPoint [get_property [get_property $path capturing_point] hierarchical_name]
    set launchClock [get_property [get_property $path launching_clock] hierarchical_name]
    set captureClock [get_property [get_property $path capturing_clock] hierarchical_name]
    set launchClkEdge [lindex [split [get_property $path launching_clock_open_edge_type] {}] 0]
    set captureClkEdge [lindex [split [get_property $path capturing_clock_close_edge_type] {}] 0]
    set launchClockTime [expr [get_property $path launching_clock_latency] + [get_property $path launching_clock_open_edge_time]]
    set captureClockTime [expr [get_property $path capturing_clock_latency] + [get_property $path capturing_clock_close_edge_time]]
    set skew [expr abs($captureClockTime - $launchClockTime)]
    set slack [get_property $path slack]
    set viewName [get_property $path view_name]


    puts $f [format "%-10s %-30s %-8s %-8.2f %-25s %-50s %-80s" $slack $viewName $logicDepth $skew "${launchClock}(${launchClkEdge})->${captureClock}(${captureClkEdge})" $startPoint $endPoint]

    }
    }

    close $f
    }

    ################################################################################
    # Procedure to generate line seperator
    # Usage: genLine -width <width_size> -char <character_name>
    # Example: genLine -width 20 -char "#"
    ################################################################################
    proc genLine {args} {

    # Default
    set char "-"

    # Get width
    if {[regexp {\-width} $args]} {
    set width [lindex $args [expr [lsearch $args -width] + 1]]
    }

    # Get char
    if {[regexp {\-char} $args]} {
    set char [lindex $args [expr [lsearch $args -char] + 1]]
    }


    # Help
    set helpString "Usage : genLine -width <width> -char <character>"

    if {[regexp {\-help} $args] || $args == ""} {
    puts $helpString
    return 0
    }

    # Main code
    #########################################################################


    for {set i 0} {$i <= $width} {incr i} {
    lappend print_list $char
    }

    return "[join $print_list $char]"
    }

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information