better swap_windows() function (used when closing a window in multi-window(non-tabbed) interface, resolved_net() recognize global nodes. remove static data from record_global_node(), put in xctx. Remove dead code from translate() (@spice_get_voltage)

This commit is contained in:
stefan schippers 2023-11-12 13:01:11 +01:00
parent 8c29d0e812
commit ecca0ba2be
15 changed files with 198 additions and 136 deletions

View File

@ -1078,7 +1078,6 @@ void draw_crosshair(int del)
int callback(const char *winpath, int event, int mx, int my, KeySym key,
int button, int aux, int state)
{
static char old_winpath[PATH_MAX] = ".drw"; /* previous focused window, used to do context switch */
char str[PATH_MAX + 100];
struct stat buf;
int redraw_only;

View File

@ -184,6 +184,7 @@ int yyparse_error = 0;
char *xschem_executable=NULL;
Tcl_Interp *interp = NULL;
double *character[256]; /* array or per-char coordinates of xschem internal vector font */
char old_winpath[PATH_MAX] = ".drw"; /* previously switched window, used in callback() */
#ifndef __unix__
char win_temp_dir[PATH_MAX]="";
const char fopen_read_mode[] = "rb";

View File

@ -1930,6 +1930,13 @@ char *resolved_net(const char *net)
{
char *rnet = NULL;
Str_hashentry *entry;
/* global node ? return as is */
if(net && record_global_node(3, NULL, net)) {
my_strdup(_ALLOC_ID_, &rnet, net);
return rnet;
}
if(net) {
char *n_s1, *n_s2;
int k, mult;

View File

@ -660,35 +660,36 @@ static void print_wires(void)
/* 1: add entry */
/* 2: delete list only, no print */
/* 3: look if node is a global */
int record_global_node(int what, FILE *fp, char *node)
int record_global_node(int what, FILE *fp, const char *node)
{
static int max_globals=0; /* safe to keep even with multiple schematics, netlist code always resets data */
static int size_globals=0; /* safe to keep even with multiple schematics, netlist code always resets data */
static char **globals=NULL; /* safe to keep even with multiple schematics, netlist code always resets data */
int i;
if( what==1 || what==3) {
if( what == 1 || what == 3) {
if(!node) return 0;
if(!strcmp(node, "0")) return 1;
for(i=0;i<max_globals; ++i) {
if( !strcmp(node, globals[i] )) return 1; /* node is a global */
for(i = 0;i < xctx->max_globals; ++i) {
if( !strcmp(node, xctx->globals[i] )) return 1; /* node is a global */
}
if(what == 3) return 0; /* node is not a global */
if(max_globals>=size_globals) {
size_globals+=CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &globals, size_globals*sizeof(char *) );
if(xctx->max_globals >= xctx->size_globals) {
xctx->size_globals+=CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &xctx->globals, xctx->size_globals*sizeof(char *) );
}
globals[max_globals]=NULL;
my_strdup(_ALLOC_ID_, &globals[max_globals], node);
max_globals++;
} else if(what == 0 || what == 2) {
for(i=0;i<max_globals; ++i) {
if(what == 0 && xctx->netlist_type == CAD_SPICE_NETLIST) fprintf(fp, ".GLOBAL %s\n", globals[i]);
if(what == 0 && xctx->netlist_type == CAD_TEDAX_NETLIST) fprintf(fp, "__GLOBAL__ %s\n", globals[i]);
my_free(_ALLOC_ID_, &globals[i]);
xctx->globals[xctx->max_globals]=NULL;
my_strdup(_ALLOC_ID_, &xctx->globals[xctx->max_globals], node);
xctx->max_globals++;
} else if(what == 0) {
for(i = 0;i < xctx->max_globals; ++i) {
if(xctx->netlist_type == CAD_SPICE_NETLIST) fprintf(fp, ".GLOBAL %s\n", xctx->globals[i]);
if(xctx->netlist_type == CAD_TEDAX_NETLIST) fprintf(fp, "__GLOBAL__ %s\n", xctx->globals[i]);
}
my_free(_ALLOC_ID_, &globals);
size_globals=max_globals=0;
} else if(what == 2) {
for(i=0;i<xctx->max_globals; ++i) {
my_free(_ALLOC_ID_, &xctx->globals[i]);
}
my_free(_ALLOC_ID_, &xctx->globals);
xctx->size_globals = xctx->max_globals=0;
}
return 0;
}

View File

@ -803,9 +803,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
": UNSAVED data: want to exit?\"");
}
if(force || !xctx->modified || !strcmp(tclresult(), "ok")) {
swap_windows();
swap_windows(0);
set_modify(0); /* set modified status to 0 to avoid another confirm in following line */
new_schematic("destroy", xctx->current_win_path, NULL, 1);
new_schematic("destroy", xctx->current_win_path, NULL, 0);
draw();
}
} else {
if(!force && xctx->modified) {
@ -1624,8 +1625,6 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(res, S(res), "sch[%d]=%s\n",i,xctx->sch[i]); Tcl_AppendResult(interp, res, NULL);
}
my_snprintf(res, S(res), "modified=%d\n", xctx->modified); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "areaw=%d\n", xctx->areaw); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "areah=%d\n", xctx->areah); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "color_ps=%d\n", color_ps); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "hilight_nets=%d\n", xctx->hilight_nets); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "semaphore=%d\n", xctx->semaphore); Tcl_AppendResult(interp, res, NULL);
@ -3354,6 +3353,22 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
rebuild_selected_array();
}
/* record_global_node n node
call the record_global_node function (list of netlist global nodes) */
else if(!strcmp(argv[1], "record_global_node"))
{
int ret = 0;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 2) {
int n = atoi(argv[2]);
if(n == 1 && argc > 3) ret = record_global_node(1,NULL, argv[3]); /* insert node */
else if(n == 0) ret = record_global_node(0, stdout, NULL);
else if(n == 2) ret = record_global_node(2, NULL, NULL);
else if(n == 3 && argc > 3) ret = record_global_node(3, NULL, argv[3]); /* look up node */
}
Tcl_SetResult(interp, my_itoa(ret), TCL_VOLATILE);
}
/* rect [x1 y1 x2 y2] [pos] [propstring] [draw]
* if 'x1 y1 x2 y2'is given place recangle on current
* layer (rectcolor) at indicated coordinates.
@ -4544,6 +4559,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp);
}
/* swap_windows
* swap first and second window in window interface (internal command)
*/
else if(!strcmp(argv[1], "swap_windows"))
{
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(!tclgetboolvar("tabbed_interface") && get_window_count()) {
swap_windows(1);
}
}
/* switch [window_path |schematic_name]
* Switch context to indicated window path or schematic name
* returns 0 if switch was successfull or 1 in case of errors

View File

@ -461,7 +461,10 @@ int global_spice_netlist(int global) /* netlister driver */
my_free(_ALLOC_ID_, &stored_flags);
/* print globals nodes found in netlist 28032003 */
if(!split_f) record_global_node(0,fd,NULL);
if(!split_f) {
record_global_node(0,fd,NULL);
/* record_global_node(2, NULL, NULL); */ /* delete list --> do it in xwin_exit() */
}
/* =================================== 20121223 */
first = 0;

View File

@ -259,6 +259,7 @@ int global_tedax_netlist(int global) /* netlister driver */
/* print globals nodes found in netlist 28032003 */
record_global_node(0,fd,NULL);
/* record_global_node(2, NULL, NULL); */ /* delete list --> do it in xwin_exit() */
fprintf(fd, "__HIERSEP__ %s\n", xctx->hiersep);
dbg(1, "global_tedax_netlist(): starting awk on netlist!\n");

View File

@ -3605,12 +3605,7 @@ const char *translate(int inst, const char* s)
double val;
const char *valstr;
if(path) {
int skip = 0;
/* skip path components that are above the level where raw file was loaded */
while(*path && skip < start_level) {
if(*path == '.') skip++;
++path;
}
prepare_netlist_structs(0);
if(xctx->inst[inst].lab) {
my_strdup2(_ALLOC_ID_, &net, expandlabel(xctx->inst[inst].lab, &multip));
@ -3618,16 +3613,10 @@ const char *translate(int inst, const char* s)
if(net == NULL || net[0] == '\0') {
my_strdup2(_ALLOC_ID_, &net, net_name(inst, 0, &multip, 0, 0));
}
if(multip == 1 && net && net[0] && path) {
if(multip == 1 && net && net[0]) {
char *rn;
len = strlen(path) + strlen(net) + 1;
dbg(1, "translate() @spice_get_voltage: inst=%s\n", instname);
dbg(1, " net=%s\n", net);
/*
* fqnet = my_malloc(_ALLOC_ID_, len);
* my_snprintf(fqnet, len, "%s%s", path, net);
*/
rn = resolved_net(net);
if(rn) {
my_strdup2(_ALLOC_ID_, &fqnet, rn);
@ -3685,11 +3674,16 @@ const char *translate(int inst, const char* s)
n = sscanf(token + 19, "%[^)]", net);
expandlabel(net, &multip);
if(n == 1 && multip == 1) {
strtolower(net);
len = strlen(path) + strlen(instname) + strlen(net) + 2;
dbg(1, "net=%s\n", net);
fqnet = my_malloc(_ALLOC_ID_, len);
if(record_global_node(3, NULL, net)) {
strtolower(net);
my_snprintf(fqnet, len, "%s", net);
} else {
strtolower(net);
my_snprintf(fqnet, len, "%s%s.%s", path, instname, net);
}
strtolower(fqnet);
dbg(1, "translate(): net=%s, fqnet=%s start_level=%d\n", net, fqnet, start_level);
idx = get_raw_index(fqnet);

View File

@ -619,6 +619,9 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->save_lw = 0.0; /* used to save linewidth when selecting 'only_probes' view */
xctx->already_selected = 0;
xctx->onetime = 0; /* callback() static var */
xctx->max_globals = 0;
xctx->size_globals = 0;
xctx->globals = NULL;
xctx->save_netlist_type = 0;
xctx->some_nets_added = 0;
xctx->loaded_symbol = 0;
@ -680,6 +683,7 @@ static void delete_schematic_data(int delete_pixmap)
extra_rawfile(3, NULL, NULL);
free_rawfile(&xctx->raw, 0);
statusmsg("", 1); /* clear allocated string */
record_global_node(2, NULL, NULL); /* delete global node array */
free_xschem_data(); /* delete the xctx struct */
}
@ -910,7 +914,6 @@ static void xwin_exit(void)
dbg(1, "xwin_exit(): closed display\n");
my_strncpy(cli_opt_filename, "", S(cli_opt_filename));
my_free(_ALLOC_ID_, &xschem_executable);
record_global_node(2, NULL, NULL); /* delete global node array */
dbg(1, "xwin_exit(): deleted undo buffer\n");
/* delete cmdline stuff */
for(i = 0 ; i < cli_opt_argc; ++i) {
@ -1276,9 +1279,11 @@ void swap_tabs(void)
}
}
/* swap primary view (.drw) with first valid tab (x1.drw, x2.drw, ...)
* used for window close ('xschem exit' command) */
void swap_windows(void)
/* swap primary view (.drw) with first valid window (x1.drw, x2.drw, ...)
* used for window close ('xschem exit' command)
* if dr == 1 do draw and don't move following window onto first. This is used if
* primary windows is about to be deleted */
void swap_windows(int dr)
{
int wc = window_count;
if(tclgetboolvar("tabbed_interface")) return;
@ -1287,10 +1292,7 @@ void swap_windows(void)
char *tmp;
char wp_i[WINDOW_PATH_SIZE], wp_j[WINDOW_PATH_SIZE];
Window window;
Pixmap save_pixmap;
GC gc, *gcptr;
int i = 0;
int j;
int i = 0, j;
Tk_Window tkwin, mainwindow;
char geometry[80];
@ -1336,34 +1338,23 @@ void swap_windows(void)
save_xctx[i] = save_xctx[j];
save_xctx[j] = ctx;
/* swap window paths */
/* re-swap window paths */
SWAP(save_xctx[i]->top_path, save_xctx[j]->top_path, tmp);
SWAP(save_xctx[i]->current_win_path, save_xctx[j]->current_win_path, tmp);
/* swap drawing stuff */
SWAP(save_xctx[i]->save_pixmap, save_xctx[j]->save_pixmap, save_pixmap);
/* re-swap window IDs */
SWAP(save_xctx[i]->window, save_xctx[j]->window, window);
SWAP(save_xctx[i]->gctiled, save_xctx[j]->gctiled, gc);
SWAP(save_xctx[i]->gc, save_xctx[j]->gc, gcptr);
SWAP(save_xctx[i]->gcstipple, save_xctx[j]->gcstipple, gcptr);
/* rebuld colors and pixmaps, redraw swapped schematics */
tclvareval("restore_ctx ", wp_i, NULL);
new_schematic("switch", wp_i, "", 1);
tclvareval("housekeeping_ctx", NULL);
tclvareval("xschem build_colors", NULL);
resetwin(1, 1, 1, 0, 0);
new_schematic("switch", wp_i, "", 0);
/* move primary window to location of deleted window */
tclvareval("wm geometry . ", geometry, NULL);
draw();
/* set context to window that is about to be deleted */
tclvareval("restore_ctx ", wp_j, NULL);
new_schematic("switch", wp_j, "", 1);
tclvareval("housekeeping_ctx", NULL);
tclvareval("xschem build_colors", NULL);
if(!dr) tclvareval("wm geometry . ", geometry, "; update", NULL);
resetwin(1, 1, 1, 0, 0);
/* draw(); */ /* avoid drawing, since usually this will be destroyed soon after */
if(dr) draw();
new_schematic("switch", wp_j, "", 0);
resetwin(1, 1, 1, 0, 0);
my_snprintf(old_winpath, S(old_winpath), "");
if(dr) draw();
}
}

View File

@ -1030,6 +1030,10 @@ typedef struct {
int mx_s, my_s;
int mmx_s, mmy_s;
double xorig_save, yorig_save;
/* record_global_node() */
int max_globals;
int size_globals;
char **globals;
/* load_schematic */
int save_netlist_type;
int loaded_symbol;
@ -1174,6 +1178,7 @@ extern int yyparse_error;
extern char *xschem_executable;
extern Tcl_Interp *interp;
extern double *character[256];
extern char old_winpath[PATH_MAX]; /* previously switched window, used in callback() */
extern const char fopen_read_mode[]; /* "r" on unix, "rb" on windows */
/*********** Cmdline options (used at xinit, and then not used anymore) ***********/
@ -1451,7 +1456,7 @@ extern void mem_clear_undo(void);
extern void load_schematic(int load_symbol, const char *fname, int reset_undo, int alert);
/* check if filename already in an open window/tab */
extern void swap_tabs(void);
extern void swap_windows(void);
extern void swap_windows(int dr);
extern int check_loaded(const char *f, char *win_path);
extern char *get_window_path(int i);
extern int get_window_count(void);
@ -1615,7 +1620,7 @@ extern void select_arc(int c, int i, unsigned short select_mode, int fast);
extern void select_line(int c, int i, unsigned short select_mode, int fast);
extern void select_polygon(int c, int i, unsigned short select_mode, int fast );
extern const char *net_name(int i, int j, int *mult, int hash_prefix_unnamed_net, int erc);
extern int record_global_node(int what, FILE *fp, char *node);
extern int record_global_node(int what, FILE *fp, const char *node);
extern int count_items(const char *s, const char *sep, const char *quote);
extern int get_unnamed_node(int what, int mult, int node);
extern void node_hash_free(void);

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.4 file_version=1.2
v {xschem version=3.4.5 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -32,3 +32,4 @@ L 4 0 -20 0 0 {}
L 4 -10 -20 10 -20 {}
B 5 -2.5 -2.5 2.5 2.5 {name=p dir=inout verilog_type=wire goto=0}
T {@lab} -12.5 -35 0 0 0.2 0.2 {}
T {@spice_get_voltage} 6.875 -16.09375 0 0 0.2 0.2 {layer=15}

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.4 file_version=1.2
v {xschem version=3.4.5 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -32,13 +32,11 @@ N 370 -180 550 -180 { lab=GN1}
N 330 -230 330 -210 { lab=GN1}
N 330 -310 330 -290 { lab=VCC}
N 330 -150 330 -130 { lab=0}
N 510 -240 670 -240 { lab=#net1}
N 590 -240 670 -240 { lab=#net1}
N 590 -240 590 -210 { lab=#net1}
N 510 -340 510 -300 { lab=#net2}
N 670 -340 670 -300 { lab=#net3}
N 550 -410 550 -380 { lab=#net2}
N 510 -380 550 -380 { lab=#net2}
N 510 -380 510 -340 { lab=#net2}
N 510 -380 510 -300 { lab=#net2}
N 510 -460 510 -440 { lab=VCC}
N 800 -460 800 -400 { lab=VCC}
N 670 -370 760 -370 { lab=#net3}
@ -47,35 +45,56 @@ N 370 -210 370 -180 { lab=GN1}
N 670 -460 670 -440 { lab=VCC}
N 550 -410 640 -410 { lab=#net2}
N 800 -150 800 -130 { lab=0}
N 800 -340 800 -210 { lab=#net4}
N 800 -290 800 -210 { lab=#net4}
N 550 -180 550 -170 { lab=GN1}
N 550 -170 660 -170 { lab=GN1}
N 660 -180 660 -170 { lab=GN1}
N 660 -180 760 -180 { lab=GN1}
N 670 -380 670 -340 { lab=#net3}
N 1130 -290 1170 -290 { lab=OUT}
N 800 -290 870 -290 { lab=#net4}
N 670 -370 670 -300 { lab=#net3}
N 1160 -290 1200 -290 { lab=OUT}
N 800 -290 890 -290 { lab=#net4}
N 980 -150 980 -130 { lab=0}
N 980 -420 980 -400 { lab=VCC}
N 940 -370 940 -180 { lab=#net4}
N 980 -340 980 -210 { lab=#net5}
N 870 -290 940 -290 { lab=#net4}
N 1130 -150 1130 -130 { lab=0}
N 1130 -420 1130 -400 { lab=VCC}
N 1090 -370 1090 -180 { lab=#net5}
N 1130 -340 1130 -210 { lab=OUT}
N 980 -290 1090 -290 { lab=#net5}
N 990 -620 990 -510 { lab=#net5}
N 930 -620 930 -510 { lab=#net4}
N 940 -290 940 -180 { lab=#net4}
N 980 -290 980 -210 { lab=#net5}
N 890 -290 940 -290 { lab=#net4}
N 1160 -150 1160 -130 { lab=0}
N 1160 -420 1160 -400 { lab=VCC}
N 1120 -290 1120 -180 { lab=#net5}
N 1160 -290 1160 -210 { lab=OUT}
N 1060 -290 1120 -290 { lab=#net5}
N 990 -560 990 -510 { lab=#net5}
N 930 -560 930 -470 { lab=#net4}
N 890 -560 930 -560 { lab=#net4}
N 890 -560 890 -290 { lab=#net4}
N 990 -560 1010 -560 { lab=#net5}
N 1010 -560 1030 -560 { lab=#net5}
N 1030 -560 1030 -290 { lab=#net5}
N 1060 -560 1060 -290 { lab=#net5}
N 960 -660 990 -660 { lab=#net5}
N 990 -660 990 -620 { lab=#net5}
N 930 -510 930 -470 { lab=#net4}
N 990 -660 990 -560 { lab=#net5}
N 930 -470 960 -470 { lab=#net4}
N 710 -270 740 -270 {
lab=PLUS}
N 440 -270 470 -270 {
lab=MINUS}
N 670 -410 700 -410 {
lab=VCC}
N 480 -410 510 -410 {
lab=VCC}
N 800 -370 830 -370 {
lab=VCC}
N 980 -370 1010 -370 {
lab=VCC}
N 510 -240 590 -240 { lab=#net1}
N 670 -380 670 -370 { lab=#net3}
N 1160 -340 1160 -290 { lab=OUT}
N 800 -340 800 -290 { lab=#net4}
N 940 -370 940 -290 { lab=#net4}
N 980 -340 980 -290 { lab=#net5}
N 1120 -370 1120 -290 { lab=#net5}
N 930 -620 930 -560 { lab=#net4}
N 980 -290 1060 -290 { lab=#net5}
N 990 -560 1060 -560 { lab=#net5}
N 1160 -370 1190 -370 {
lab=VCC}
C {nmos4.sym} 570 -180 0 0 {name=M1 model=nmos w=4u l=0.4u m=1}
C {lab_pin.sym} 590 -180 0 1 {name=p2 lab=0}
C {lab_pin.sym} 590 -130 0 0 {name=p6 lab=0}
@ -91,18 +110,18 @@ C {lab_pin.sym} 670 -270 0 0 {name=p18 lab=0 l=0.2u}
C {pmos4.sym} 530 -410 0 1 {name=M5 model=pmos w=6u l=0.3u m=1}
C {pmos4.sym} 650 -410 0 0 {name=M6 model=pmos w=6u l=0.3u m=1}
C {lab_pin.sym} 670 -460 0 0 {name=p21 lab=VCC}
C {lab_pin.sym} 510 -410 0 0 {name=p23 lab=VCC}
C {lab_pin.sym} 670 -410 0 1 {name=p33 lab=VCC}
C {lab_pin.sym} 480 -410 0 0 {name=p23 lab=VCC}
C {lab_pin.sym} 700 -410 0 1 {name=p33 lab=VCC}
C {lab_wire.sym} 500 -180 0 0 {name=l2 lab=GN1}
C {ipin.sym} 100 -310 0 0 {name=p161 lab=PLUS}
C {ipin.sym} 100 -260 0 0 {name=p1 lab=MINUS}
C {opin.sym} 180 -290 0 0 {name=p20 lab=OUT}
C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"}
C {lab_pin.sym} 710 -270 0 1 {name=p3 lab=PLUS}
C {lab_pin.sym} 470 -270 0 0 {name=p4 lab=MINUS}
C {lab_pin.sym} 1170 -290 0 1 {name=p14 lab=OUT}
C {lab_pin.sym} 740 -270 0 1 {name=p3 lab=PLUS}
C {lab_pin.sym} 440 -270 0 0 {name=p4 lab=MINUS}
C {lab_pin.sym} 1200 -290 0 1 {name=p14 lab=OUT}
C {pmos4.sym} 780 -370 0 0 {name=M14 model=pmos w=6u l=0.3u m=1}
C {lab_pin.sym} 800 -370 0 1 {name=p15 lab=VCC}
C {lab_pin.sym} 830 -370 0 1 {name=p15 lab=VCC}
C {lab_pin.sym} 800 -460 0 0 {name=p22 lab=VCC}
C {spice_probe.sym} 420 -180 0 0 {name=p27 attrs=""}
C {spice_probe.sym} 570 -410 0 0 {name=p28 attrs=""}
@ -113,17 +132,17 @@ C {nmos4.sym} 960 -180 0 0 {name=M8 model=nmos w=1u l=0.4u m=1}
C {lab_pin.sym} 980 -180 0 1 {name=p10 lab=0}
C {lab_pin.sym} 980 -130 0 1 {name=p11 lab=0}
C {pmos4.sym} 960 -370 0 0 {name=M9 model=pmos w=2u l=0.4u m=1}
C {lab_pin.sym} 980 -370 0 1 {name=p12 lab=VCC}
C {lab_pin.sym} 1010 -370 0 1 {name=p12 lab=VCC}
C {lab_pin.sym} 980 -420 0 0 {name=p13 lab=VCC}
C {nmos4.sym} 1110 -180 0 0 {name=M10 model=nmos w=1u l=0.4u m=1}
C {lab_pin.sym} 1130 -180 0 1 {name=p24 lab=0}
C {lab_pin.sym} 1130 -130 0 1 {name=p25 lab=0}
C {pmos4.sym} 1110 -370 0 0 {name=M11 model=pmos w=2u l=0.4u m=1}
C {lab_pin.sym} 1130 -370 0 1 {name=p26 lab=VCC}
C {lab_pin.sym} 1130 -420 0 0 {name=p29 lab=VCC}
C {nmos4.sym} 1140 -180 0 0 {name=M10 model=nmos w=1u l=0.4u m=1}
C {lab_pin.sym} 1160 -180 0 1 {name=p24 lab=0}
C {lab_pin.sym} 1160 -130 0 1 {name=p25 lab=0}
C {pmos4.sym} 1140 -370 0 0 {name=M11 model=pmos w=2u l=0.4u m=1}
C {lab_pin.sym} 1190 -370 0 1 {name=p26 lab=VCC}
C {lab_pin.sym} 1160 -420 0 0 {name=p29 lab=VCC}
C {nmos4.sym} 960 -490 3 0 {name=M13 model=nmos w=2u l=0.1u m=1}
C {lab_pin.sym} 960 -510 3 1 {name=p31 lab=0}
C {spice_probe.sym} 1040 -290 0 0 {name=p35 attrs=""}
C {spice_probe.sym} 1070 -290 0 0 {name=p35 attrs=""}
C {spice_probe.sym} 840 -290 0 0 {name=p36 attrs=""}
C {nmos4.sym} 960 -640 1 0 {name=M12 model=nmos w=2u l=0.1u m=1}
C {lab_pin.sym} 960 -620 1 1 {name=p30 lab=0}

View File

@ -65,7 +65,7 @@ unitx=n
divy=2
digital=1}
P 4 5 700 -480 1680 -480 1680 -90 700 -90 700 -480 {dash=5}
P 5 5 40 -670 970 -670 970 -230 40 -230 40 -670 { dash=5}
P 5 5 40 -670 690 -670 690 -230 40 -230 40 -670 { dash=5}
T {Modulator} 530 -710 0 0 0.6 0.6 { layer=5}
T {Digital Decimator} 1030 -520 0 0 0.6 0.6 {layer=4}
T {D} 190 -530 0 0 1 1 { layer=5 font=Symbol}
@ -169,3 +169,7 @@ C {opamp_65nm.sym} 380 -400 2 1 {name=x41}
C {comp_65nm.sym} 610 -410 0 0 {name=x42}
C {spice_probe.sym} 1470 -430 0 0 {name=p2 attrs=""}
C {or_ngspice.sym} 1110 -320 0 0 {name=x3 ROUT=1000 net_name=true}
C {opamp_65nm.sch} -180 -650 0 0 {name=x10}
C {lab_pin.sym} 100 -930 0 0 {name=p7 lab=FB}
C {lab_pin.sym} 890 -980 0 1 {name=p9 lab=OUT}
C {lab_pin.sym} 100 -1070 0 0 {name=p13 lab=VREF}

View File

@ -111,8 +111,11 @@ value="
.measure tran avg2 AVG v(x1.qn) from=4u to=6u
.measure tran avg3 AVG v(x1.qn) from=7u to=9u
.control
* save all
tran 0.2n 9u uic
tran 0.2n .9u uic
write delta_sigma.raw
set appendwrite
save all
op
write delta_sigma.raw
quit 0
.endc

View File

@ -1,4 +1,4 @@
v {xschem version=3.4.4 file_version=1.2
v {xschem version=3.4.5 file_version=1.2
*
* This file is part of XSCHEM,
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
@ -20,41 +20,47 @@ v {xschem version=3.4.4 file_version=1.2
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
}
G {}
K {}
K {type=subcircuit
format="@name @pinlist @symname"
template="name=x1"
}
V {}
S {}
E {}
T {( @#0:resolved_net )} 100 -335 0 1 0.2 0.2 {name=p161 layer=15}
T {( @#0:resolved_net )} 100 -285 0 1 0.2 0.2 {name=p1 layer=15}
T {( @#0:resolved_net )} 240 -315 0 1 0.2 0.2 {name=p20 layer=15}
P 4 5 280 -580 1070 -580 1070 -130 280 -130 280 -580 {dash=3}
T {( @#0:resolved_net )} 280 -445 0 1 0.2 0.2 {name=p161 layer=15}
T {( @#0:resolved_net )} 280 -305 0 1 0.2 0.2 {name=p1 layer=15}
T {( @#0:resolved_net )} 1130 -355 0 1 0.2 0.2 {name=p20 layer=15}
T {@name} 320 -640 0 0 0.8 0.8 {}
T {@symname} 1000 -640 0 1 0.8 0.8 {}
N 660 -190 660 -170 { lab=0}
N 440 -220 620 -220 { lab=GN1}
N 400 -270 400 -250 { lab=GN1}
N 400 -350 400 -330 { lab=VCC}
N 400 -190 400 -170 { lab=0}
N 580 -280 740 -280 { lab=#net1}
N 660 -280 660 -250 { lab=#net1}
N 580 -380 580 -340 { lab=#net2}
N 740 -380 740 -340 { lab=#net3}
N 620 -450 620 -420 { lab=#net2}
N 580 -420 620 -420 { lab=#net2}
N 580 -420 580 -380 { lab=#net2}
N 580 -280 740 -280 { lab=S}
N 660 -280 660 -250 { lab=S}
N 580 -380 580 -340 { lab=#net1}
N 740 -380 740 -340 { lab=G}
N 620 -450 620 -420 { lab=#net1}
N 580 -420 620 -420 { lab=#net1}
N 580 -420 580 -380 { lab=#net1}
N 580 -500 580 -480 { lab=VCC}
N 940 -330 1060 -330 { lab=OUT}
N 940 -330 1070 -330 { lab=OUT}
N 940 -500 940 -440 { lab=VCC}
N 740 -410 900 -410 { lab=#net3}
N 740 -410 900 -410 { lab=G}
N 400 -250 440 -250 { lab=GN1}
N 440 -250 440 -220 { lab=GN1}
N 740 -500 740 -480 { lab=VCC}
N 620 -450 710 -450 { lab=#net2}
N 620 -450 710 -450 { lab=#net1}
N 940 -190 940 -170 { lab=0}
N 940 -380 940 -250 { lab=OUT}
N 620 -220 620 -210 { lab=GN1}
N 620 -210 730 -210 { lab=GN1}
N 730 -220 730 -210 { lab=GN1}
N 730 -220 900 -220 { lab=GN1}
N 740 -420 740 -380 { lab=#net3}
N 790 -410 790 -340 { lab=#net3}
N 740 -420 740 -380 { lab=G}
N 790 -410 790 -340 { lab=G}
N 910 -340 940 -340 { lab=OUT}
C {nmos4.sym} 640 -220 0 0 {name=M1 model=nmos w=4u l=0.4u m=1}
C {lab_pin.sym} 660 -220 0 1 {name=p2 lab=0}
@ -67,7 +73,7 @@ C {lab_pin.sym} 400 -170 0 0 {name=p16 lab=0}
C {nmos4.sym} 560 -310 0 0 {name=M3 model=nmos w=1.5u l=0.2u m=1}
C {lab_pin.sym} 580 -310 0 1 {name=p17 lab=0}
C {nmos4.sym} 760 -310 0 1 {name=M4 model=nmos w=1.5u l=0.2u m=1}
C {lab_pin.sym} 740 -310 0 0 {name=p18 lab=0 l=0.2u}
C {lab_pin.sym} 740 -310 0 0 {name=p18 lab=0}
C {pmos4.sym} 600 -450 0 1 {name=M5 model=pmos w=6u l=0.3u m=1}
C {lab_pin.sym} 580 -500 0 0 {name=p19 lab=VCC}
C {pmos4.sym} 720 -450 0 0 {name=M6 model=pmos w=6u l=0.3u m=1}
@ -75,13 +81,12 @@ C {lab_pin.sym} 740 -500 0 0 {name=p21 lab=VCC}
C {lab_pin.sym} 580 -450 0 0 {name=p23 lab=VCC}
C {lab_pin.sym} 740 -450 0 1 {name=p33 lab=VCC}
C {lab_wire.sym} 570 -220 0 0 {name=l2 lab=GN1}
C {ipin.sym} 100 -310 0 0 {name=p161 lab=PLUS}
C {ipin.sym} 100 -260 0 0 {name=p1 lab=MINUS}
C {opin.sym} 180 -290 0 0 {name=p20 lab=OUT}
C {ipin.sym} 280 -420 0 0 {name=p161 lab=PLUS}
C {ipin.sym} 280 -280 0 0 {name=p1 lab=MINUS}
C {opin.sym} 1070 -330 0 0 {name=p20 lab=OUT}
C {title.sym} 160 -30 0 0 {name=l1 author="Stefan Schippers"}
C {lab_pin.sym} 780 -310 0 1 {name=p3 lab=PLUS}
C {lab_pin.sym} 540 -310 0 0 {name=p4 lab=MINUS}
C {lab_pin.sym} 1060 -330 0 1 {name=p14 lab=OUT}
C {pmos4.sym} 920 -410 0 0 {name=M8 model=pmos w=6u l=0.4u m=1}
C {lab_pin.sym} 940 -410 0 1 {name=p15 lab=VCC}
C {lab_pin.sym} 940 -500 0 0 {name=p22 lab=VCC}
@ -102,3 +107,5 @@ footprint=1206
device="ceramic capacitor"}
C {parax_cap.sym} 460 -210 0 0 {name=C2 gnd=0 value=200f m=1}
C {spice_probe.sym} 630 -280 0 0 {name=p10 attrs=""}
C {lab_pin.sym} 660 -260 0 0 {name=p11 lab=S}
C {lab_pin.sym} 740 -380 0 0 {name=p12 lab=G}