Go back to perl script feature top.

Perl APIs:   

  • get_full_path: Get full path from supported three path formats.
  • get_fanouts: Get fanouts of $net in $path
  • get_conns: Get connections of $net in $path
  • get_leaf_type: Get leaf cell type
  • get_driver: Get the driver of the net
  • get_net_of: Get the net name connecting to the pin
  • get_cell_info: Get the cell connections
  • get_leaf_pin_dir: Get leaf cell pin's direction input/output/inout
  • get_cells: Get all cells in $path
  • is_leaf: Check if the module is leaf cell
  • get_modules: Get all hierarchical modules in $path
  • get_instances: Get all hierarchical instances in $path
  • get_top: Get top design name
  • get_ref: Get reference of instance
  • get_ports: Get all ports matching the direction in $path
  • get_module_name: Get the module name from the path
  • get_instance_name: Get the instance name from the path
  • print: Print out message on a text window
  • sch_create_schematic: Create a schematic window
  • sch_get_canvas: Get the schematic canvas
  • sch_draw_gate: Draw the gate on the schematic window ID
  • sch_move_gate: Move gate position on the schematic
  • sch_get_current_position: Get current schematic position
  • sch_set_current_position: Set current schematic position
  • sch_get_pin_tag_with_net: Get pin tag with net name
  • eco_save_to_file: Eco save to file
  • eco_setup: Setup session
  • eco_rename_port: Rename Port
  • exists: Check if exists
  • list_library: List library
  • get_lib_of_ref: Get the lib name of the reference (leaf cell name)
  • list_cell_in_lib: List leaf cell information in library
  • get_full_path

       Get full path from supported three path formats.
       GOF supports three path formats
          1. Slash format: u_abc/u_def/u_ghi
          2. Dot format:  u_abc.u_def.u_ghi 
          3. Full path:  Top(top_module).u_abc(abc_module).u_def(def_module).u_ghi(ghi_module)
       Note: Mixed dot and / is considered as a dot format path E.G. u_abc.u_def/u_ghi
           Back slash will be ignored and removed in the path. 
    
       Usage: my $full_path = &get_full_path($path);
       $path: Input path for converting to full_path
       $full_path: If input path is in format 3, the same value returns.
       

    get_fanouts

       Get fanouts of $net in $path, return the leafs without hier connectors
       Usage: my $result = &get_fanouts($net, $path);
       $path: The path net name is in, check get_full_path API for all supported formats.
       $net: The net name that needs to get connections.
       $result: A point to a two dimension array
       driver_path, instance, gate_name, driver_pin, driver_line_in_module, driver_cell_instance
       $result = [
                  [path_0, instance_0, gate_name_0, pin_0, line_num_0, cell_instance_line_0],
                  [path_1, instance_1, gate_name_0, pin_1, line_num_1, cell_instance_line_1],
                  [path_2, instance_2, gate_name_0, pin_2, line_num_2, cell_instance_line_2],
                  ...
                 ]
       
       

    get_conns

       Get connections of $net in $path, return the leafs and hier connectors
       Usage: my $result = &get_conns($net_name, $path);
       $path: The path net name is in, check get_full_path API for all supported formats.
       $net_name: The net name that needs to get connections.
       $result: A point to a two dimension array
       driver_path, instance, gate_name, driver_pin, driver_line_in_module, driver_cell_instance
       $result = [[path_0, instance_0, gate_name_0, pin_0, line_num_0, cell_instance_line_0],
                  [path_1, instance_1, gate_name_0, pin_1, line_num_1, cell_instance_line_1],
                  [path_2, instance_2, gate_name_0, pin_2, line_num_2, cell_instance_line_2],
                  ...
                 ]
       

    get_leaf_type

       Get leaf cell type, return an array reference
       Usage: my @type = &get_leaf_type($leaf_cell_name);
       $leaf_cell_name: Leaf cell name E.G. OAI32X2
       $type: return array reference, ['nand','or']
              ['ff'] if it's flipflop (-synlib synthesis_library option should be used in command line)
       

    get_driver

       Get the driver of the net
       Usage: my $driver = &get_driver($point, $path, $mode);
       $point: net name or pin name, 'n12345' or 'U12345/A1'
       $path: Path the net is in. Check get_full_path API for all supported formats.
              
       $mode: this pinput is optional, by default 0 which means get the leaf gate driving the net
              if it is 1, the return value can be the input port in the same path
       $driver: [driver_path, instance, gate_name, driver_pin, driver_line_in_module, driver_cell_instance]
       
       E.G. my $driver = &get_driver("net12345", "u_instance");
       $driver = ["Top",
                  "U1247",
                  "NAND2X2",
                  "Y" ,
                  123,
                  "NAND2X2 U1247(.A(hpos[0]),.B(n288),.Y(n331));"
                  ]
       
       

    get_net_of

       Get the net name connecting to the pin
       Usage: my $net = get_net_of($pin, $path);
       $pin: A pin of a instance, 'U1234/A1'
       $path: Check get_full_path API for all supported formats.
       $net: The net name connecting to the pin
       
       

    get_cell_info

       Get the cell connections, a hash returns
       Usage:
       
       my &hash = &get_leaf_info($leaf_inst, $path);
       $path: The path of the leaf instance. Check get_full_path API for all supported formats. 
       $leaf_inst: the leaf instance.
       $hash: Returned data in hash format. It has the following data structure
       my $module = $hash->{module};
       my $instance: $hash->{instance};
       foreach my $port (keys %{$hash->{ports}}){
           my $direction = $hash->{ports}{$port};
       }
       foreach my $port (keys %{$hash->{connections}}){
           my $net = $hash->{connections}{$port};
       }
       
       

    get_leaf_pin_dir

       Get leaf cell pin's direction input/output/inout
       Usage: my $dir = &get_leaf_pin_dir($pin, $leaf_name);
       $pin: pin name, E.G.  A or B or Y
       $leaf: Leaf cell name, E.G. NAND2X2
       $dir: return direction, input/output/inout
       
       

    get_cells

       Get all cells in $path 
       Usage: my $cells = &get_cells($path);
       $path: Check get_full_path API for all supported formats.
       $cells: Reference of an array with all instances in "sub_module"
       
       

    is_leaf

       Check if the module is leaf cell
       Usage: my $leaf = &is_leaf($module);
       $module: The module under check
       $leaf: 0, it's a hierarchical module, (Or the module is not defined)
              1, it's leaf cell. Like, NAND4X8
       
       

    get_modules

       Get all hierarchical modules in $path
       Usage: my $modules = &get_modules($path);
       $path: Check get_full_path API for all supported formats.
       $modules: Array reference ['module0', 'module1']
       
       

    get_instances

       Get all hierarchical instances in $path
       Usage: my $modules = &get_modules($path);
       $path: Check get_full_path API for all supported formats.
       $modules: Array reference ['instance0', 'instance1']
       
       

    get_top

       Get top design name
       Usage: my $topdesign = &get_top($top);
       $top: By default "Top", Can be "Top_1" or "Top_2" if multiple trees present
       $topdesign: returned top design name
       
       

    get_ref

       Get reference of instance
       Usage: my $reference = &get_ref($instance, $path);
       $instance: Instance name, "U123"
       $path: The path that the instance is in. Check get_full_path API for all supported formats.
       $reference: Return reference name, "NAND2X4" 
       
       

    get_ports

       Get all ports matching the direction in $path
       Usage: my $matching_ports = &get_ports($direction, $path);
       $direction: direction, "input", "output"
       $path: In the path where the ports will be extracted. Check get_full_path API for all supported formats.
       $matching_ports: Arrary reference, return ports matching the direciton in sub_module
       
       
       

    get_module_name

       Get the module name from the path,
       Usage: my $module = &get_module_name($path);
       $path: Has format of "Top(top_module).u_abc(module_abc)", full path format.
       $module: The return value of this call will be "module_abc"
       
       

    get_instance_name

       Get the instance name from the path,
       Usage: my $instance = &get_instance_name($path);
       $path: Has format of "Top(top_module).u_abc(module_abc)", full path format.
       $instance: The return value of this call will be "u_abc"
       
       

    print

       Print out message on a text window
       if the text window does not exist yet, create one automaticly
       Usage: &print($info);
       $info: message to be printed.
       If window is closed in the middle of the perl script, the perl script would be aborted. 
       
       

    sch_create_schematic

       Create a schematic window 
       Usage: my $win_id = &sch_create_schematic;
       $win_id: the schematic window ID.
       
       

    sch_get_canvas

       Get the schematic canvas
       Usage: my $canvas = &sch_get_canvas($win_id);
       $win_id: the schematic window ID created by sch_create_schematic
       $canvas: the schematic handler returned.
       
       

    sch_draw_gate

       Draw the gate on the schematic window ID
       Usage: my $gate_id = &sch_draw_gate($instance, $path, $win_id);
       $instance: instance name of the gate, U1234
       $path: The path of the instace. Check get_full_path API for all supported formats. 
       $gate_id: The gate ID drawn on the schematic. It would be '', if not drawn
       
       

    sch_move_gate

       Move gate position on the schematic
       Usage: &sch_move_gate($dx, $dy, $gate_id, $win_id);
       $dx,$dy: position adjusted.
       $gate_id: the gate needed to be moved, $gate_id is returned value of sch_draw_gate
       $win_id: the schematich window ID
       
       

    sch_get_current_position

       Get current schematic position, gate will be drawn at this position
       Usage: my ($x, $y) = &sch_get_current_position($win_id);
       $x,$y: current position returned.
       $win_id: The schematic ID
       
       

    sch_set_current_position

       Set current schematic position, gate will be drawn at this position
       Usage: &sch_set_current_position($x,$y,$win_id);
       $x,$y: The position to be set.
       $win_id: The schematic ID
       
       

    sch_get_pin_tag_with_net

       Get pin tag with net name
       Usage: my $pin_tag = &sch_get_pin_tag_with_net($net, $gate_id, $win_id);
       $net: The net name connecting to the pin.
       $gate_id: The gate ID.
       $win_id: The schematic win ID
       $pin_tag: Returned pin ID matching net. If nothing matchs return ""
       
       

    eco_save_to_file

       Eco save to file
       
       

    eco_setup

       Setup session, provide prefix for new ECO net and cell, ECO name, library
       Usage:my $session = &eco_setup($prefix, $eco_name, $library_name);
       $prefix: like xyz/abc/def/
       $eco_name : ECO name, like eco01234
       $library_name : will appear in TCL script when adding cell, lib_name/NAND2X2
       Retrun: $session, handle for the ECO session
       
       

    eco_rename_port

       Rename Port
       Port can be input/ouput ports
       Usage: &eco_rename_port($port_old, $port_new, $path, $eco_session);
       
       

    exists

       Check if exists, $type $name $path
       my $ret = &exists($type, $name, $path);
       $type: type, "inst" or "net"
       $name: the item to be checked.
       $path: Check get_full_path API for all supported formats. 
       
       

    list_library

       List library, 
       Usage: my $info = &list_library($detail);
       $detail: 0, List library name and corresponding file.
                1, List library name and leaf cells it contains.
       
       

    get_lib_of_ref

       Get the lib name of the reference (leaf cell name)
       Usage: my $library_name = &get_lib_of_ref($cell);
       $cell: The reference name. E.G. AND2X4
       $library_name: The name of the library where the cell is defined.
       Note: -synlib synthesis_library option should be used in command line. 
       
       

    list_cell_in_lib

       List leaf cell information in library, area, timing, function...
       Usage: my $info = &list_cell_in_lib($cell);
       $cell: The leaf cell name. E.G. NAND4X8
       $info: The leaf cell parameters in synthesis library.
       
       
     


    Follow us:
    © 2024 NanDigits Design Automation. All rights reserved.