NanDigits中国

位置:文档/GOF用户手册/第三章 脚本模式

上一章 网表ECO流程

3 Script Mode Detail Features

3.1 GofCall Script
3.1.1 Get Help
3.1.2 Feature list
3.1.3 API list
3.1.4 API grouping
3.1.5 API usage
3.2 String Handling In Script Mode
3.2.1 Single quote and double quote
3.2.2 Instance and net with backslash
3.3 Run and debug GofCall script
3.3.1 Command line
3.3.2 GOF Shell
3.3.3 Run in GUI mode
3.3.4 Fast schematic launch
3.3.5 Break points for debug
3.4 Typical Manual ECO operations
3.4.1 Insert gate to port
3.4.2 Insert gate to register instance pin
3.4.3 Change flops to other type
3.4.4 Insert gate to hierarchical instance pin

3.1 GofCall Script

GofCall is the Perl Script Interface which can access internal exported APIs.

3.1.1 Get Help

3.1.2 Feature list

3.1.3 API list

buffer: ECO command. Buffer high fanout ECO nets
change_gate: ECO command. Modify an instance in ECO
change_net: ECO command. Change a existing net's driver
change_pin: ECO command. Modify pin connection in ECO
change_port: ECO command. Change an output port's driver
check_design: Check if the netlist status
compare: Logic equivalence check on output port and register input pins
compare_nets: Check equivalence of two nets in the reference and implementation netlist
convert_gated_clocks: ECO command. Convert gated clocks to MUX logic
current_design: Set the current top level module
current_instance: Set the current instance
del_gate: ECO command. Delete gate
del_net: ECO command. Delete net
del_port: ECO command. Delete port
exist_inst: Check if an instance exists
exist_wire: Check if a wire exists
fix_design: ECO command. Fix the whole design in global mode
fix_hold: ECO command. Fix hold time violations.
fix_logic: ECO command. Fix listed points
fix_modules: ECO command. Fix modules listed in the arguments
fix_setup: ECO command. Fix Setup time violations.
flatten_modules: Flatten hierarchical modules in reference netlist
get_cell_info: Get information of a module or instance
get_cells: Get all cells in the current module or sub-modules
get_conns: Get connections of net or pin in the top level module
get_coord: Get an instance's coordination
get_definition: Get instantiation of instance
get_driver: Get the driver of a net or pin
get_drivers: Get the drivers of a net or pin
get_instance: Get instance in the top level module
get_instances: Get all hierarchical instances in the top level module
get_leaf_pin_dir: Get leaf cell pin's direction input/output/inout
get_leafs_count: Get all leaf cells name and count in the top level module
get_lib_cells: Get leaf gates in libraries
get_loads: Get loads of net or pin in the top level module
get_logic_cone: Get logic cone of nets or pins
get_match_nets: Get logic equivalent nets in implementation netlist
get_modules: Get all hierarchical modules under current module
get_net_of: Get net name connecting to a pin
get_nets: Get nets that matching pattern
get_path: Get current hierarchical path
get_pins: Get pins of instance or module
get_ports: Get all ports in the current top level module
get_ref: Get the reference of the instance
get_resolved: Resolve the relative path to module and leaf item
get_roots: Get root designs name
get_spare_cells: ECO command. Get spare cells
gexit: Exit the GofCall interactive mode
gprint: Print out the message and save to log file
is_leaf: Check if a module or instance is leaf cell
is_seq: Check if a leaf module is a specific sequential cell
lv_search: Search instances in LayoutViewer window
map_spare_cells: ECO command. Map all new created cells to spare cells
new_gate: ECO command. Create new gate
new_net: ECO command. Create a new net
new_port: ECO command. Create a new port for the current top level module
place_gate: ECO command. Place gate position
place_port: ECO command. Place port position
pop_top: Pop out the saved top level module from the stack and discard the current setting
push_top: Set the current top level module and push the previous setting to stack
read_def: Read DEF file
read_design: Read verilog netlist
read_file: Read timing violation report file
read_lef: Read LEF file
read_library: Read standard library or verilog library files
rename_net: ECO command. Rename a net name
report_eco: Report ECO
report_spares: Report Spare cells
run: Run GofCall script
sch: Launch schematic to verify ECO
set_auto_fix_floating: ECO setting. Enable automatic fixing floating input ports after fix_modules
set_bfix: Enable or disable BFIX features
set_bound_opti: Enable or disable boundary optimization check. Enabled by default
set_buffer: Set buffer type. The tool automatically picks one if the command is not called
set_buffer_distance: Set distance limit for inserting buffer
set_constraints: Set constraints for map_spare_cells command
set_cutpoint_en: Enable or disable CutPoint Method
set_cutpoint_thresh: Set Cutpoint Threshold
set_cutpoint_ultra: Enable or disable CutPoint Ultra Effort
set_dont_use: Set dont use list
set_eco_effort: ECO setting. Set ECO effort
set_equal_net: ECO setting. Set two nets to be equivalent in Reference and Implementation netlists
set_exit_on_error: Whether the tool should exit when the script runs into an error
set_exit_on_warning: Whether the tool should exit when the script runs into a warning
set_ignore_instance: ECO setting. Set ignored sequential or blackbox instances in ECO
set_ignore_network: ECO setting. Set ignore network in ECO
set_ignore_output: ECO setting. Set ignore output ports
set_inside_mod: Set fix scope inside the current module
set_inst: Set the current instance
set_inv_net: ECO setting. Set two nets to be inverted in Reference and Implementation netlists
set_invert: Set invert type. The tool automatically picks one if the command is not called
set_keep_format: Set keep format of the original verilog when ECO is done
set_keep_tree: Set keeping buffer tree
set_leaf: Set a hierarchical module to be leaf. Useful to stub hierarchical instances
set_log_file: Set log file name
set_max_lines: Set max output lines
set_max_loop: Setup max loop
set_mod2mod: Set reference module mapping to implementation module
set_mu: MU configuration
set_noexact_pin_match: ECO setting. Don't match some special pins
set_pin_constant: Set pin to a constant value
set_power: Set power pins connections for leaf cell
set_preserve: Set preserve property on instances. The tool does not remove them in ECO
set_quiet: Run script in quiet mode
set_recovery_distance: Set distance limit for gates recovery in ECO
set_tiehi_net: Set tiehi net name
set_tielo_net: Set tielo net name
set_top: Set the current top level module
set_tree: Set the current tree
set_user_match: Set match between multi-bit flops to multi-bit flops
set_verbose: Run script in verbose mode
setup_eco: ECO command. Setup ECO
source: Run GofCall script
start_gui: Start GUI windows
stitch_scan_chain: ECO command. Stitch scan chain
suppress_warnings: Suppress warning messages
swap_inst: ECO command. Swap two instances with same input/output pins.
undo_eco: ECO command. Undo eco operations
write_dcsh: ECO command. Write ECO result in Design Compiler dcsh script format
write_perl: ECO command. Write GofCall ECO script compatible with Perl
write_soce: ECO command. Write ECO result in Cadence SOC Encounter script format
write_spare_file: ECO command. Write spare cells list to a file
write_tcl: ECO command. Write ECO result in Design Compiler tcl script format
write_verilog: ECO command. Write ECOed netlist to a verilog file

3.1.4 API grouping

3.1.4.1 Netlist Browse APIs

One key element to do efficient manual ECO is to isolate the ECO spots quickly. The following APIs are for fast Netlist Browsing.

get_cells: Get all cells in the current module or sub-modules
get_conns: Get connections of net or pin in the top level module
get_driver: Get the driver of a net or pin
get_drivers: Get the drivers of a net or pin
get_instance: Get instance in the top level module
get_instances: Get all hierarchical instances in the top level module
get_leaf_pin_dir: Get leaf cell pin's direction input/output/inout
get_lib_cells: Get leaf gates in libraries
get_loads: Get loads of net or pin in the top level module
get_match_nets: Get logic equivalent nets in implementation netlist
get_modules: Get all hierarchical modules under current module
get_net_of: Get the net name connecting to the pin
get_nets: Get nets that matching pattern
get_pins: Get pins of instance or module
get_ports: Get all ports in the current top level module
get_ref: Get the reference of the instance

For example, to get all flops' data pins in one module. The script can use these browse APIs

my @flop_data_pins;
set_top("module_name");
my @flops = get_cells("-type", "ff");
foreach my $flop (@flops){
  my @dpins = get_pins("-data", $flop);
  push @flop_data_pins, @dpins;
}

After the script is run, @flop_data_pins have all data pins of all flops in the module.

3.1.4.2 Automatic ECO APIs

These APIs are for Automatic ECO

fix_design: ECO command. Fix top level module and its sub-modules
fix_modules: ECO command. Fix modules listed
map_spare_cells: ECO command. Map all new created cells to spare cells
fix_logic: ECO command. Fix listed points

Combining netlist browsing APIs, users can come up a short script to do complicated changes.

For example, to fix all modules named "txmachine*"

my @modules = get_modules("-hier", "tx_machine_*");
fix_modules(@modules);

3.1.4.3 File IO APIs

These APIs are for reading/writing files.

read_def: Read DEF file
read_design: Read verilog netlist
read_file: Read timing violation report file
read_lef: Read LEF file
read_library: Read standard library or verilog library files
write_dcsh: ECO command. Write out ECO result in Design Compiler dcsh script format
write_perl: ECO command. Write out GofCall ECO script compatible with Perl.
write_soce: ECO command. Write out ECO result in Cadence SOC Encounter script format
write_spare_file: ECO command. Write out spare cells list file
write_tcl: ECO command. Write out ECO result in Design Compiler tcl script format
write_verilog: ECO command. Write out ECOed netlist to a file

3.1.4.4 Manual ECO APIs

These are APIs for Manual ECO.

buffer: ECO command. Buffer high fanout ECO nets
change_gate: ECO command. Modify an instance in ECO.
change_net: ECO command. Change a existing net's driver
change_pin: ECO command. Modify pin connection in ECO.
change_port: ECO command. Change an output port's driver
del_gate: ECO command. Delete gate
del_net: ECO command. Delete net
del_port: ECO command. Delete port
new_gate: ECO command. Create new gate
new_net: ECO command. Create a new net
new_port: ECO command. Create a new port for the current top level module

Combining netlist browsing APIs, a short GofCall script can do very efficient ECOs.

For example, to add isolation cells for all output ports of a module.

set_top("module_name");
my @out_ports = get_ports("-output");
foreach my $out (@out_ports){
  change_port($out, "AND2X2", "", "-,net_iso_enable");
}

3.1.5 API usage

For detail of APIs visit https://nandigits.com/apis_gof.htm

For individual API, type '#' followed by API_name.

For example, to check usage of 'change_pin'

https://nandigits.com/apis_gof.htm#change_pin

3.2 String Handling In Script Mode

3.2.1 Single quote and double quote

Any string in GofCall script for module/instance/wire/pin/port should be enclosed by single quote or double quote. When a Perl variable is used, double quote should be used

my $inst = "state_reg_0";
change_pin("$inst/D","1'b0");

3.2.2 Instance and net with backslash

Instance with backslash should be either put in single quote and with a space in the end, or removed the backslash and let the tool to figure out the real name.

'\u_abc/u_def/state_reg[0] ' can be written as 'u_abc/u_def/reg_state_0[0]'

Net name with backslash should always keep the backslash. One good way to avoid write net name directly is to use 'instance/pin' format. For example

DFFQ_X4M \u_abc/u_def/state_reg[0] (.D(\u_abc/u_def/net123 ), .Q(\u_abc/u_def/state[0] ));

The net '\u_abc/u_def/net123 ' can be replaced by 'u_abc/u_def/state_reg[0]/D' and

The net '\u_abc/u_def/state[0] ' can be replaced by 'u_abc/u_def/state_reg[0]/Q'

3.3 Run and debug GofCall script

3.3.1 Command line

In command line, the GofCall Script can be run by "-run" option.

gof -run run_example.pl

3.3.2 GOF Shell

If '-run' option is present in the command line, and 'gexit' is not in the script, or GOF meets error when executing the script, GOF goes to interactive mode with GOF shell 'GOF >'.

GofCall, Netlist Processing Script APIs, Interactive Mode
Run 'start_gui' to launch GUI window
Run 'help' to list API calls
GOF >

Individual command can be executed in GOF shell. The command can be in nested mode

GOF > set_top(get_ref("u_rxbuf"))

3.3.3 Run in GUI mode

GofCall scripts can be run in GUI window. In GofViewer, click Menu Commands->'Launch GofCall Script Interface' to launch GofCall GUI window.

Type 'help' in the shell entry for help information. Scripts can be run by 'run' command in the shell entry

img

Figure 14: GofCall window

3.3.4 Fast schematic launch

In GOF shell, GUI windows can be launched by 'start_gui' or 'sch' commands.

'start_gui' launches netlist view window first and user can bring up schematic window from netlist view window.

'sch' command only launches schematic window, and it doesn't enable netlist view window. So it has fast turnaround in GUI interactive debug.

For example,

After the following command is done,

change_pin("u_top/u_core/u_regmod/state_reg/D", "XOR2X2", "", "-,new_enable");

Run 'sch' in 'GOF >'

GOF > sch("u_top/u_core/u_regmod/state_reg")

The instance is loaded into a schematic and user can click on the instance's pins to trace fanin/fanout on the schematic to see if the ECO is done as expected.

3.3.5 Break points for debug

'sch' fast schematic launch command can be used as break points for debug. For example, 'sch' commands are inserted in GofCall script, when the tool runs to the point, a schematic is launched.

...
setup_eco("sanity75");
set_log_file("t_sanity75.log");
read_library("libdr/art.m.simple.lib");
read_design('-imp', "cdir/imp_name.v");
change_pin("state_reg_0_/D", "MX2X4", "", ".A(-),.B(next_state[7]),.S0(sel_mode)");
sch("state_reg_0_", "-set", 1);
...

On the schematic, user can use mouse-middle-button clicking on the pin 'D' to see if the ECO is done as expected.

img

Figure 15: Launch schematic at break point

Note: 'ECO' check-button is enabled automatically, since there is ECO having been done.

To compare with the logic before ECO, launch a new schematic by menu Schematic->'New Schematic'. On the new schematic, press 'ctrl-g' or by menu Schematic->'Load Gate' to load in the flop under ECO.

img

Figure 16: Launch schematic before ECO

Note: 'ECO' check-button is un-checked.

3.4 Typical Manual ECO operations

3.4.1 Insert gate to port

Both input port and output port have the same operation

3.4.1.1 Insert an invert to input port

# Insert to input port 'in_enable'
change_port("in_enable", "INVX1", "inst_name", "-"); # 'inst_name' can be empty

3.4.1.2 Insert to output port

# Insert AND2X1 to output port 'out_enable', one pin connects to the original driver,
# the other pin is driven by 'scan_mode'
change_port("out_enable", "AND2X1", "", "scan_mode,-");

3.4.1.3 Insert inverts to multiple ports

# Find all ports matching string "abcde" and insert invert to each port
my @ports = get_ports("*abcde*");
foreach my port (@ports){
 change_port($port, "INVX1", "", "-");
}

3.4.2 Insert gate to register instance pin

3.4.2.1 Insert invert to flop data pin

# Insert an invert to 'D' pin of flop 'abc_reg'
change_pin("abc_reg/D", "INVX1", "", "-");

3.4.2.2 Insert invert to flop output pin

# Insert an invert to 'Q' pin of flop 'abc_reg'
change_pin("abc_reg'Q", "INVX1", "", "-");

3.4.2.3 Insert MUX to data pin of multiple flops

# Find all flops matching string "cnt_reg" and insert MUX to 'D' pin of each flop,
# so that each flop is preset to 'preset_val' when 'preset_enable' is high
my @flops = get_cells("*cnt_reg*");
foreach my $flop (@flops){
 change_pin("$flop/D", "MUX2X2", "", ".A(-),.B(preset_val),.S(preset_enable)");
}

3.4.3 Change flops to other type

3.4.3.1 Change non-reset flop type to resettable flop

# Find all flops matching string "cnt_reg" and change each flop to resettable flop
my @flops = get_cells("*cnt_reg*");
foreach my $flop (@flops){
  change_gate($flop, "DFFRQX2", ".RD(reset_n)");
}

3.4.4 Insert gate to hierarchical instance pin

3.4.4.1 Insert invertsto hierarchical instance pins

# Find all instances matching "tx_mac" in module "abc_mod" and insert invert to 'loop_en' pin
set_top("abc_mod");
my @insts = get_instances("*tx_mac*");
foreach my $inst (@insts){
  change_pin("$inst/loop_en", "INVX1", "", "-");
}

3.4.4.2 Insert AND to hierarchical instance pins

# Find all instances matching "tx_mac" in module "abc_mod" and
# AND all output pins with "power_on" signal.
set_top("abc_mod");
my @insts = get_instances("*tx_mac*");
foreach my $inst (@insts){
  my @pins = get_pins("-output", $inst);
  foreach my $pin (@pins){
    my $net = get_net_of($pin); # Only add AND to those out pins driving nets
    if($net){
      change_pin($pin, "AND2X2", "", ".A(-),.B(power_on)");
    }
  }
}

下一章 GUI模式

位置:文档/GOF用户手册/第三章 脚本模式

更多文档:文档目录


微信公众号

LinkedIn

Nandigits.com 美国官网 | Nandigits.cn 中国官网
© 2021 Nandigits Design Automation. 版权所有。