add optional "-messages" in "xschem netlist" comand to return ERC messages instead of fail(1)/good(0) code

This commit is contained in:
stefan schippers 2023-08-27 13:04:12 +02:00
parent b521994a08
commit 519fb2fbf2
2 changed files with 29 additions and 11 deletions

View File

@ -497,6 +497,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> abort_operation</kbd></li><pre> <li><kbd> abort_operation</kbd></li><pre>
@ -876,7 +877,7 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
<li><kbd> net_pin_mismatch</kbd></li><pre> <li><kbd> net_pin_mismatch</kbd></li><pre>
Highlight nets attached to selected symbols with Highlight nets attached to selected symbols with
a different name than symbol pin </pre> a different name than symbol pin </pre>
<li><kbd> netlist [filename]</kbd></li><pre> <li><kbd> netlist [-messages] [filename]</kbd></li><pre>
do a netlist of current schematic in currently defined netlist format do a netlist of current schematic in currently defined netlist format
if 'filename'is given use specified name for the netlist if 'filename'is given use specified name for the netlist
if 'filename' contains path components place the file in specified path location. if 'filename' contains path components place the file in specified path location.
@ -884,7 +885,9 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
default netlisting directory. default netlisting directory.
This means that 'xschem netlist test.spice' and 'xschem netlist ./test.spice' This means that 'xschem netlist test.spice' and 'xschem netlist ./test.spice'
will create the netlist in different places. will create the netlist in different places.
netlisting directory is reset to previous setting after completing this command </pre> netlisting directory is reset to previous setting after completing this command
If -messages is given return the ERC messages instead of just a fail (1)
or no fail (0) code. </pre>
<li><kbd> new_process [f]</kbd></li><pre> <li><kbd> new_process [f]</kbd></li><pre>
Start a new xschem process for a schematic. Start a new xschem process for a schematic.
If 'f' is given load specified schematic. </pre> If 'f' is given load specified schematic. </pre>
@ -1263,7 +1266,6 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
</ul> </ul>

View File

@ -2267,7 +2267,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
hilight_net_pin_mismatches(); hilight_net_pin_mismatches();
} }
/* netlist [filename] /* netlist [-messages] [filename]
* do a netlist of current schematic in currently defined netlist format * do a netlist of current schematic in currently defined netlist format
* if 'filename'is given use specified name for the netlist * if 'filename'is given use specified name for the netlist
* if 'filename' contains path components place the file in specified path location. * if 'filename' contains path components place the file in specified path location.
@ -2275,22 +2275,34 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
* default netlisting directory. * default netlisting directory.
* This means that 'xschem netlist test.spice' and 'xschem netlist ./test.spice' * This means that 'xschem netlist test.spice' and 'xschem netlist ./test.spice'
* will create the netlist in different places. * will create the netlist in different places.
* netlisting directory is reset to previous setting after completing this command */ * netlisting directory is reset to previous setting after completing this command
* If -messages is given return the ERC messages instead of just a fail (1)
* or no fail (0) code. */
else if(!strcmp(argv[1], "netlist") ) else if(!strcmp(argv[1], "netlist") )
{ {
int err = 0; int err = 0;
int messages = 0;
char save[PATH_MAX]; char save[PATH_MAX];
const char *fname = NULL;
const char *path; const char *path;
yyparse_error = 0; yyparse_error = 0;
my_strncpy(save, tclgetvar("netlist_dir"), S(save)); my_strncpy(save, tclgetvar("netlist_dir"), S(save));
if(argc > 2) { if(argc > 2) {
my_strncpy(xctx->netlist_name, get_cell_w_ext(argv[2], 0), S(xctx->netlist_name)); if(!strcmp(argv[2], "-messages")) {
tclvareval("file dirname ", argv[2], NULL); messages = 1;
if(argc > 3) fname = argv[3];
} else {
fname = argv[2];
}
if(fname) {
my_strncpy(xctx->netlist_name, get_cell_w_ext(fname, 0), S(xctx->netlist_name));
tclvareval("file dirname ", fname, NULL);
path = tclresult(); path = tclresult();
if(strchr(argv[2], '/')) { if(strchr(fname, '/')) {
set_netlist_dir(1, path); set_netlist_dir(1, path);
} }
} }
}
if(set_netlist_dir(0, NULL) ) { if(set_netlist_dir(0, NULL) ) {
if(xctx->netlist_type == CAD_SPICE_NETLIST) if(xctx->netlist_type == CAD_SPICE_NETLIST)
err = global_spice_netlist(1); /* 1 means global netlist */ err = global_spice_netlist(1); /* 1 means global netlist */
@ -2307,9 +2319,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name)); my_strncpy(xctx->netlist_name, "", S(xctx->netlist_name));
set_netlist_dir(1, save); set_netlist_dir(1, save);
} }
if(messages) {
Tcl_SetResult(interp, (char *)tcleval(".infotext.f1.text get 1.0 end"), TCL_VOLATILE);
} else {
Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE); Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE);
} }
} }
}
/* new_process [f] /* new_process [f]
* Start a new xschem process for a schematic. * Start a new xschem process for a schematic.