added command "xschem get netlist_name fallback" that returns user set netlist name or fallback name derived from circuit filename. simulate and waves procedures handle user netlist name if set

This commit is contained in:
Stefan Frederik 2022-09-09 12:02:56 +02:00
parent d05926e0ca
commit d4e29db770
2 changed files with 45 additions and 4 deletions

View File

@ -826,7 +826,33 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, xctx->sch_path[x], TCL_VOLATILE);
}
}
else if(argc >= 4 && !strcmp(argv[1],"get") && !strcmp(argv[2],"netlist_name") &&
!strcmp(argv[3], "fallback")) {
char f[PATH_MAX];
cmd_found = 1;
if(xctx->netlist_type == CAD_SPICE_NETLIST) {
my_snprintf(f, S(f), "%s.spice", skip_dir(xctx->current_name));
}
else if(xctx->netlist_type == CAD_VHDL_NETLIST) {
my_snprintf(f, S(f), "%s.vhdl", skip_dir(xctx->current_name));
}
else if(xctx->netlist_type == CAD_VERILOG_NETLIST) {
my_snprintf(f, S(f), "%s.v", skip_dir(xctx->current_name));
}
else if(xctx->netlist_type == CAD_TEDAX_NETLIST) {
my_snprintf(f, S(f), "%s.tdx", skip_dir(xctx->current_name));
}
else {
my_snprintf(f, S(f), "%s.unknown", skip_dir(xctx->current_name));
}
if(xctx->netlist_name[0] == '\0') {
Tcl_SetResult(interp, f, TCL_VOLATILE);
} else {
Tcl_SetResult(interp, xctx->netlist_name, TCL_VOLATILE);
}
}
else if(!strcmp(argv[1],"get") && argc==3)
{
cmd_found = 1;

View File

@ -1173,7 +1173,12 @@ proc simulate {{callback {}}} {
set d ${netlist_dir}
set tool $netlist_type
set S [xschem get schname]
set s [file tail [file rootname $S]]
set custom_netlist_file [xschem get netlist_name]
if {$custom_netlist_file ne {}} {
set s [file rootname $custom_netlist_file]
} else {
set s [file tail [file rootname $S]]
}
set n ${netlist_dir}/${s}
if {$tool eq {verilog}} {
set N ${n}.v
@ -1227,8 +1232,12 @@ proc setup_tcp_gaw {} {
if { [info exists gaw_fd] } { return 1; }
simuldir
set s [file tail [file rootname [xschem get schname 0]]]
set custom_netlist_file [xschem get netlist_name]
if {$custom_netlist_file ne {}} {
set s [file rootname $custom_netlist_file]
} else {
set s [file tail [file rootname [xschem get schname 0]]]
}
if { ![info exists gaw_fd] && [catch {eval socket $gaw_tcp_address} gaw_fd] } {
puts "Problems opening socket to gaw on address $gaw_tcp_address"
unset gaw_fd
@ -1301,7 +1310,13 @@ proc waves {} {
set d ${netlist_dir}
set tool ${netlist_type}
set S [xschem get schname]
set s [file tail [file rootname $S]]
set custom_netlist_file [xschem get netlist_name]
if {$custom_netlist_file ne {}} {
set s [file rootname $custom_netlist_file]
} else {
set s [file tail [file rootname $S]]
}
set n ${netlist_dir}/${s}
if {$tool eq {verilog}} {
set N ${n}.v