add menu option Simulation->LVS->Upper case .SUBCKT and .ENDS

This commit is contained in:
stefan schippers 2025-03-13 11:57:09 +01:00
parent ac1f618030
commit 84ca35e6f5
3 changed files with 29 additions and 13 deletions

View File

@ -275,7 +275,7 @@ function process( i,j, iprefix, saveinstr, savetype, saveanalysis)
} else if( $1 ~ /^\*\.(ipin|opin|iopin)/ ) {
num=split($2,name,",")
for(i=1;i<=num;i++) print $1 " " name[i]
} else if( $1 ~ /\.subckt/) {
} else if( tolower($1) ~ /\.subckt/) {
# remove m=.. from subcircuit definition since m= is a multiplier not a param
sub(/ m=[0-9]+/," ",$0)
gsub(","," ",$0)

View File

@ -173,10 +173,9 @@ static int spice_netlist(FILE *fd, int spice_stop )
int err = 0;
int i, flag = 0;
const char *type;
int top_sub;
int top_sub = tclgetboolvar("lvs_netlist") || tclgetboolvar("top_is_subckt");
int lvs_ignore = tclgetboolvar("lvs_ignore");
top_sub = tclgetboolvar("lvs_netlist") || tclgetboolvar("top_is_subckt");
if(!spice_stop) {
dbg(1, "spice_netlist(): invoke prepare_netlist_structs for %s\n", xctx->current_name);
xctx->prep_net_structs = 0;
@ -278,6 +277,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
int found_top_symbol = 0;
int npins = 0; /* top schematic number of i/o ports */
Sch_pin_record *pinnumber_list = NULL; /* list of top sch i/o ports ordered wrt sim_pinnumber attr */
int uppercase_subckt = tclgetboolvar("uppercase_subckt");
exit_code = 0; /* reset exit code */
split_f = tclgetboolvar("split_files");
@ -341,7 +341,10 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
}
top_sub = tclgetboolvar("lvs_netlist") || tclgetboolvar("top_is_subckt");
if(!top_sub) fprintf(fd,"**");
fprintf(fd,".subckt %s", get_cell(xctx->sch[xctx->currsch], 0));
if(uppercase_subckt)
fprintf(fd,".SUBCKT %s", get_cell(xctx->sch[xctx->currsch], 0));
else
fprintf(fd,".subckt %s", get_cell(xctx->sch[xctx->currsch], 0));
pinnumber_list = sort_schematic_pins(&npins); /* sort pins according to sim_pinnumber attr */
/* print top subckt ipin/opins */
@ -405,7 +408,10 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
/* /20100217 */
if(!top_sub) fprintf(fd,"**");
fprintf(fd, ".ends\n");
if(uppercase_subckt)
fprintf(fd, ".ENDS\n");
else
fprintf(fd, ".ends\n");
if(split_f) {
@ -572,7 +578,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */
/* 20150922 added split_files check */
if(!split_f) fprintf(fd, ".end\n");
if( !top_sub && !split_f) fprintf(fd, ".end\n");
dbg(1, "global_spice_netlist(): starting awk on netlist!\n");
@ -612,7 +618,8 @@ int spice_block_netlist(FILE *fd, int i, int alert)
char *sym_def = NULL;
char *name = NULL;
const char *default_schematic;
int uppercase_subckt = tclgetboolvar("uppercase_subckt");
split_f = tclgetboolvar("split_files");
if(!strboolcmp( get_tok_value(xctx->sym[i].prop_ptr,"spice_stop",0),"true") )
@ -657,7 +664,10 @@ int spice_block_netlist(FILE *fd, int i, int alert)
} else {
const char *s = get_cell(sanitize(name), 0);
fprintf(fd, "** sch_path: %s\n", sanitized_abs_sym_path(filename, ""));
fprintf(fd, ".subckt %s ", s);
if(uppercase_subckt)
fprintf(fd, ".SUBCKT %s ", s);
else
fprintf(fd, ".subckt %s ", s);
print_spice_subckt_nodes(fd, i);
my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) );
@ -680,7 +690,10 @@ int spice_block_netlist(FILE *fd, int i, int alert)
fprintf(fd, "%s\n", xctx->schprop);
fprintf(fd,"**** end user architecture code\n");
}
fprintf(fd, ".ends\n\n");
if(uppercase_subckt)
fprintf(fd, ".ENDS\n\n");
else
fprintf(fd, ".ends\n\n");
}
if(split_f) {
int save;

View File

@ -8146,8 +8146,9 @@ set tctx::global_list {
svg_font_name sym_txt symbol symbol_width tabstop tclcmd_txt tclstop tctx::colors tctx::hsize
tctx::rcode tctx::vsize text_line_default_geometry text_replace_selection text_tabs_setting
textwindow_fileid textwindow_filename textwindow_w toolbar_horiz toolbar_list toolbar_visible
top_is_subckt transparent_svg undo_type unselect_partial_sel_wires use_cursor_for_selection
use_lab_wire use_label_prefix use_tclreadline user_wants_copy_cell verilog_2001 verilog_bitblast
top_is_subckt transparent_svg undo_type unselect_partial_sel_wires uppercase_subckt
use_cursor_for_selection use_lab_wire use_label_prefix use_tclreadline user_wants_copy_cell
verilog_2001 verilog_bitblast
viewdata_fileid viewdata_filename viewdata_w xschem_libs xschem_listen_port zoom_full_center
}
@ -9144,7 +9145,8 @@ tclcommand=\"xschem raw_read \$netlist_dir/[file tail [file rootname [xschem get
xschem set format {}
}
}
$topwin.menubar.simulation.lvs add checkbutton -label "Upper case .SUBCKT and .ENDS" \
-selectcolor $selectcolor -variable uppercase_subckt
$topwin.menubar.simulation.lvs add checkbutton -label "Top level is a .subckt" \
-selectcolor $selectcolor -variable top_is_subckt
@ -9582,6 +9584,7 @@ set_ne local_netlist_dir 0 ;# if set use <sch_dir>/simulation for netlist and si
set_ne bus_replacement_char {} ;# use {<>} to replace [] with <> in bussed signals
set_ne lvs_netlist 0
set_ne top_is_subckt 0
set_ne uppercase_subckt 0
set_ne lvs_ignore 0
set_ne hide_empty_graphs 0 ;# if set to 1 waveform boxes will be hidden if no raw file loaded
set_ne graph_use_ctrl_key 0;# if set forces to use Control key to operate on graphs