xschem annotate_op command: if no OP analysis is found in raw file try to load a DC sweep and use first point for schematic annotation. This is done because Xyce stores OP data as a 1-point DC sweep

This commit is contained in:
stefan schippers 2024-11-28 03:18:32 +01:00
parent f9b341ef98
commit 9c48617e4e
2 changed files with 17 additions and 6 deletions

View File

@ -834,6 +834,10 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type)
}
my_free(_ALLOC_ID_, &line);
} /* while((line = my_fgets(fd, NULL)) */
/* no analysis was found: delete */
if(exit_status != 1) extra_rawfile(3, NULL, NULL, -1.0, -1.0);
read_dataset_done:
if(line) my_free(_ALLOC_ID_, &line);
if(lowerline) my_free(_ALLOC_ID_, &lowerline);

View File

@ -321,6 +321,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1], "annotate_op"))
{
int level = -1;
int res = 0;
char f[PATH_MAX + 100];
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 3) {
@ -340,13 +341,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* clear all raw files */
extra_rawfile(3, NULL, NULL, -1.0, -1.0);
/* free_rawfile(&xctx->raw, 1); */
raw_read(f, &xctx->raw, "op", -1.0, -1.0);
if(level >= 0) {
xctx->raw->level = level;
my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[level]);
res = raw_read(f, &xctx->raw, "op", -1.0, -1.0);
if(res != 1) {
/* Xyce uses a 1-point dc transfer characteristic for operating point data */
res = raw_read(f, &xctx->raw, "dc", -1.0, -1.0);
}
if(res == 1) {
if(level >= 0) {
xctx->raw->level = level;
my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[level]);
}
update_op();
draw();
}
update_op();
draw();
}
/* arc