current_frame - 2020.2 English

Vivado Design Suite Tcl Command Reference Guide (UG835)

Document ID
UG835
Release Date
2020-11-18
Version
2020.2 English

Get index of the selected subprogram frame (default, top i.e. most recent subprogram call) in the call-stack of the HDL process scope (current_scope). Sets current stack frame for the subprogram call-stack of the current_scope.

Syntax

current_frame [‑up] [‑down] [‑set <arg>] [‑quiet] [‑verbose]

Returns

Returns index of the selected subprogram frame in the call stack of the current_scope.

Usage

Name Description
[-up] Selects stack frame of the caller subprogram/process as the current frame.
[-down] Selects stack frame of the callee subprogram as the current frame.
[-set] Selects stack frame with given index as the current frame of the call stack of current HDL process scope. Default: 0
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution

Categories

Simulation

Description

Returns the index of the frame which is selected as the "current" frame in sub-program call-stack of the current HDL process-scope, or current_scope. By default, the most recently called subprogram-frame is the current frame, i.e. with frame-index "0" (zero) and marked with (->).

Switches like -up,-down, and -set let you select other frames in the call-stack, rather than the current frame.

Important: The current_frame strictly follows the current_scope. If current_scope is not an HDL process scope waiting inside a sub-program, the current_frame command reports that the current process does not have an associated sub-program stack.

Arguments

-up - (Optional) Set stack-frame of the CALLER process/subprogram "1" stack frame(hop) away from current subprogram frame, as the current frame.

-down - (Optional) Set stack-frame of the CALLEE sub-program "1" stack frame (hop) away from current process/subprogram-frame, as the current frame.

-set <num> - (Optional) Set frame with index <num> of the current selected call stack as the current frame. -set 0 will set the frame stack back to the deepest level of the selected call-stack.

-quiet - (Optional) Execute the command quietly, returning no messages from the command. The command also returns TCL_OK regardless of any errors encountered during execution.
Note: Any errors encountered on the command-line, while launching the command, will be returned. Only errors occurring inside the command will be trapped.
-verbose - (Optional) Temporarily override any message limits and return all messages from this command.
Note: Message limits can be defined with the set_msg_config command.

Examples

Example design:
   module top; 
 
       int i; 
 
       function void f(input int in1); 
           automatic int a; 
           a = in1 + 7; 
           $display($time, " in f :: a %d in1 %d ", a, in1); 
       endfunction 
 
       task automatic t(input int in2); 
           int b; 
           b = in2 + 10; 
           $display($time, " in t :: in2 %d b %d ", in2, b); 
           #5; 
           f(b);    // Case C 
           $display($time, " Back in t : after wait and f(%d) ", b); 
       endtask 
 
       initial begin                         // "/top/Initial18_0" 
           $display($time, " in initial 1 "); 
           i = 200; 
           t(i);        // Case B 
           $display($time, " Back in initial 1 after t(%d) ", i); 
       end 
 
       initial begin                         // "/top/Initial25_1" 
           $display($time, " in initial 2 "); 
           #2; 
           f(50);       // Case A 
           $display($time, " Back in initial 2 after f(50) "); 
       end 
   endmodule

When simulation is stopped inside function "f" for its call at 'Case C', function "f" is called from task "t" at 'Case C' which itself is called from process "/top/Initial18_0" at 'Case B'

   > current_scope 
       /top/Initial18_0 
   > report_frames 
      -> 0 : f 
           1 : t 
           2: /top/Initial18_0 
   1. > current_frame 
      0 
   2. > current_frame -up 
      1 
      > report_frames  
           0 : f 
      -> 1 : t 
           2 : /top/Initial18_0 
    3. > current_frame -down 
       0 
       > report_frames 
      -> 0 : f 
           1 : t 
           2: /top/Initial18_0 
   4. > current_frame -set 1 
       1 
      > report_frames  
           0 : f 
      -> 1 : t 
           2 : /top/Initial18_0 
    5. > current_frame -verbose 
        -> 0 : f @top.v:6 
          1 : t @top.v:15 
          2: /top/Initial18_0 @top.v:21