From a820cc2e3f904b33a3f73e2943622c5d78ff9664 Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 12 Oct 2022 13:14:48 +0200 Subject: [PATCH] removed (now) duplicated inst_hash_lookup: use int_hash_lookup. Search function does not highlight nets if searching for something that is not "lab" --- src/actions.c | 4 +- src/editprop.c | 2 +- src/hilight.c | 2 +- src/move.c | 2 +- src/paste.c | 2 +- src/scheduler.c | 4 +- src/spice_netlist.c | 4 +- src/token.c | 120 +++----------------- src/xinit.c | 3 +- src/xschem.h | 6 +- xschem_library/examples/mos_power_ampli.sch | 64 +++++------ xschem_library/ngspice/solar_panel.sch | 16 +-- 12 files changed, 71 insertions(+), 158 deletions(-) diff --git a/src/actions.c b/src/actions.c index f16586d8..8e54a980 100644 --- a/src/actions.c +++ b/src/actions.c @@ -673,7 +673,7 @@ void clear_drawing(void) xctx->polygons[i] = 0; } dbg(1, "clear drawing(): deleted data structures, now deleting hash\n"); - clear_instance_hash(); + int_hash_free(&xctx->inst_table); } void enable_layers(void) @@ -1043,7 +1043,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot xctx->inst[n].node=NULL; xctx->inst[n].prop_ptr=NULL; dbg(1, "place_symbol() :all inst_ptr members set\n"); /* 03-02-2000 */ - if(first_call) hash_all_names(n); + if(first_call) hash_all_names(); if(inst_props) { new_prop_string(n, inst_props,!first_call, tclgetboolvar("disable_unique_names")); /* 20171214 first_call */ } diff --git a/src/editprop.c b/src/editprop.c index ba882b0f..70f5f510 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -1186,7 +1186,7 @@ static void update_symbol(const char *result, int x) my_strdup(89, &ptr,subst_token(xctx->inst[*ii].prop_ptr, "name", name) ); /* set name of current inst */ if(!pushed) { xctx->push_undo(); pushed=1;} - if(!k) hash_all_names(*ii); + if(!k) hash_all_names(); new_prop_string(*ii, ptr, k, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ } else { my_strdup2(367, &xctx->inst[*ii].instname, ""); diff --git a/src/hilight.c b/src/hilight.c index d88259f2..36a574ed 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -646,7 +646,7 @@ int search(const char *tok, const char *val, int sub, int sel) { if(!sel) { type = (xctx->inst[i].ptr+ xctx->sym)->type; - if( type && xctx->inst[i].node && IS_LABEL_SH_OR_PIN(type) ) { + if( !strcmp(tok, "lab") && type && xctx->inst[i].node && IS_LABEL_SH_OR_PIN(type) ) { bus_hilight_hash_lookup(xctx->inst[i].node[0], col, XINSERT_NOREPLACE); /* sets xctx->hilight_nets=1; */ } else { dbg(1, "search(): setting hilight flag on inst %d\n",i); diff --git a/src/move.c b/src/move.c index 210f250f..1d6fc605 100644 --- a/src/move.c +++ b/src/move.c @@ -995,7 +995,7 @@ void copy_objects(int what) xctx->inst[xctx->instances].flip = (xctx->move_flip? !xctx->inst[n].flip:xctx->inst[n].flip); /* the newpropcnt argument is zero for the 1st call and used in */ /* new_prop_string() for cleaning some internal caches. */ - if(!newpropcnt) hash_all_names(xctx->instances); + if(!newpropcnt) hash_all_names(); new_prop_string(xctx->instances, xctx->inst[n].prop_ptr,newpropcnt++, tclgetboolvar("disable_unique_names")); xctx->instances++; diff --git a/src/paste.c b/src/paste.c index 518db67d..d934518b 100644 --- a/src/paste.c +++ b/src/paste.c @@ -294,7 +294,7 @@ static void merge_inst(int k,FILE *fd) xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */ xctx->inst[i].node=NULL; load_ascii_string(&prop_ptr,fd); - if(!k) hash_all_names(i); + if(!k) hash_all_names(); new_prop_string(i, prop_ptr, k, tclgetboolvar("disable_unique_names")); /* will also assign .instname */ /* the final tmp argument is zero for the 1st call and used in */ /* new_prop_string() for cleaning some internal caches. */ diff --git a/src/scheduler.c b/src/scheduler.c index 57cf4c90..1221e74f 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -2289,7 +2289,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg /* 20110325 only modify prefix if prefix not NUL */ if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */ my_strdup(371, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) ); - hash_all_names(inst); + hash_all_names(); new_prop_string(inst, ptr,0, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ type=xctx->sym[xctx->inst[inst].ptr].type; cond= !type || !IS_LABEL_SH_OR_PIN(type); @@ -2620,7 +2620,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg xctx->prep_hash_inst=0; xctx->prep_net_structs=0; xctx->prep_hi_structs=0; - if(!strcmp(argv[4], "name")) hash_all_names(inst); + if(!strcmp(argv[4], "name")) hash_all_names(); if(argc > 5) { new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5]),fast, tclgetboolvar("disable_unique_names")); diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 6b2d3607..a6d7bd86 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -648,7 +648,7 @@ void str_hash_free(Str_hashtable *hashtable) str_hash_free_entry( table[i] ); table[i] = NULL; } - my_free(1384, &(hashtable->table)); + if(hashtable->table) my_free(1384, &(hashtable->table)); hashtable->size = 0; } } @@ -746,7 +746,7 @@ void int_hash_free(Int_hashtable *hashtable) int_hash_free_entry( table[i] ); table[i] = NULL; } - my_free(1575, &(hashtable->table)); + if(hashtable->table) my_free(1575, &(hashtable->table)); hashtable->size = 0; } } diff --git a/src/token.c b/src/token.c index aad0dd34..28b7181d 100644 --- a/src/token.c +++ b/src/token.c @@ -42,100 +42,19 @@ static char *find_bracket(char *s) return s; } -/* 20180926 added token_size */ -/* what: - * 0,XINSERT : lookup token and insert xctx->inst[value].instname in hash table - * When inserting token must be set to xctx->inst[value].instname - * (return NULL if token was not found). If token was found update value - * as the table stores only the pointer to xctx->inst[value].instname - * 3,XINSERT_NOREPLACE : same as XINSERT but do not replace existing value if token found. - * 1,XDELETE : delete token entry, return NULL - * 2,XLOOKUP : lookup only - */ -static Inst_hashentry *inst_hash_lookup(char *token, int value, int what) -{ - unsigned int hashcode; - unsigned int idx; - Inst_hashentry *entry, *saveptr, **preventry; - int s; - char *token_base = NULL; - - if(token==NULL) return NULL; - my_strdup(1519, &token_base, token); - *(find_bracket(token_base)) = '\0'; - hashcode=str_hash(token_base); - idx=hashcode % HASHSIZE; - entry=xctx->inst_table[idx]; - preventry=&xctx->inst_table[idx]; - while(1) { - if( !entry ) { /* empty slot */ - if(what == XINSERT || what == XINSERT_NOREPLACE) { /* insert data */ - s=sizeof( Inst_hashentry ); - entry=(Inst_hashentry *) my_malloc(425, s); - *preventry=entry; - entry->next=NULL; - entry->token = NULL; - my_strdup(1248, &entry->token, token_base); - entry->hash=hashcode; - entry->value = value; - } - my_free(1386, &token_base); - return NULL; /* token was not in hash */ - } - if( entry->hash==hashcode && !strcmp(token_base, entry->token) ) { /* found a matching token */ - if(what == XDELETE) { /* remove token from the hash table ... */ - saveptr=entry->next; - my_free(1249, &entry->token); - my_free(969, &entry); - *preventry=saveptr; - my_free(1388, &token_base); - return NULL; - } else if(what == XINSERT) { - entry->value = value; - } - /* dbg(1, "inst_hash_lookup(): returning: %s , %d\n", entry->token, entry->value); */ - my_free(1577, &token_base); - return entry; /* found matching entry, return the address */ - } - preventry=&entry->next; /* descend into the list. */ - entry = entry->next; - } -} - -static void inst_hash_free_entry(Inst_hashentry *entry) -{ - Inst_hashentry *tmp; - while( entry ) { - tmp = entry -> next; - my_free(1545, &entry->token); - my_free(971, &entry); - entry = tmp; - } -} - -static void inst_hash_free(void) /* remove the whole hash table */ -{ - int i; - - dbg(1, "inst_hash_free(): removing hash table\n"); - for(i=0;iinst_table[i] ); - xctx->inst_table[i] = NULL; - } -} - -void hash_all_names(int n) +void hash_all_names(void) { int i; char *upinst = NULL, *type = NULL; - inst_hash_free(); + int_hash_free(&xctx->inst_table); + int_hash_init(&xctx->inst_table, HASHSIZE); for(i=0; iinstances; i++) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { my_strdup(1526, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(!type) continue; my_strdup(1254, &upinst, xctx->inst[i].instname); strtoupper(upinst); - inst_hash_lookup(upinst, i, XINSERT); + int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT); } } my_free(1255, &upinst); @@ -162,11 +81,6 @@ const char *tcl_hook2(char **res) } } -void clear_instance_hash() -{ - inst_hash_free(); -} - /* Missing: * if one instance is named R1[3:0] and another is named R1[2] * the name collision is not detected nor corrected @@ -176,7 +90,7 @@ void check_unique_names(int rename) int i, first = 1; int newpropcnt = 0; char *tmp = NULL; - Inst_hashentry *entry; + Int_hashentry *entry; int big = xctx->wires> 2000 || xctx->instances > 2000; char *upinst = NULL, *type = NULL; @@ -193,7 +107,8 @@ void check_unique_names(int rename) draw(); if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } - inst_hash_free(); + int_hash_free(&xctx->inst_table); + int_hash_init(&xctx->inst_table, HASHSIZE); first = 1; for(i=0;iinstances;i++) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { @@ -201,7 +116,8 @@ void check_unique_names(int rename) if(!type) continue; my_strdup(1246, &upinst, xctx->inst[i].instname); strtoupper(upinst); - if( (entry = inst_hash_lookup(upinst, i, XINSERT_NOREPLACE) ) && entry->value != i) { + if( (entry = int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT_NOREPLACE) ) && entry->value != i) { + dbg(1, "check_unique_names(): found duplicate: i=%d name=%s\n", i, xctx->inst[i].instname); xctx->inst[i].color = -PINLAYER; inst_hilight_hash_lookup(xctx->inst[i].instname, -PINLAYER, XINSERT_NOREPLACE); if(rename == 1) { @@ -221,7 +137,7 @@ void check_unique_names(int rename) new_prop_string(i, tmp, newpropcnt++, 0); my_strdup(1259, &upinst, xctx->inst[i].instname); strtoupper(upinst); - inst_hash_lookup(upinst, i, XINSERT); + int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT); symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2); my_free(972, &tmp); @@ -236,6 +152,7 @@ void check_unique_names(int rename) bbox(END,0.0,0.0,0.0,0.0); } redraw_hilights(0); + int_hash_free(&xctx->inst_table); } @@ -654,7 +571,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) size_t old_name_len; int n; char *old_name_base = NULL; - Inst_hashentry *entry; + Int_hashentry *entry; char *up_old_name = NULL; char *up_new_name = NULL; @@ -681,12 +598,13 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) } xctx->prefix=old_name[0]; /* don't change old_prop if name does not conflict. */ - if(dis_uniq_names || (entry = inst_hash_lookup(up_old_name, i, XLOOKUP))==NULL || + /* if no hash_all_names() is done and inst_table uninitialized --> use old_prop */ + if(dis_uniq_names || (entry = int_hash_lookup(&xctx->inst_table, up_old_name, i, XLOOKUP))==NULL || entry->value == i) { my_strdup(447, &xctx->inst[i].prop_ptr, old_prop); my_strdup2(90, &xctx->inst[i].instname, old_name); - inst_hash_lookup(up_old_name, i, XINSERT); + int_hash_lookup(&xctx->inst_table, up_old_name, i, XINSERT); my_free(985, &old_name); my_free(1578, &up_old_name); return; @@ -705,7 +623,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) } my_strdup(1258, &up_new_name, new_name); strtoupper(up_new_name); - if((entry = inst_hash_lookup(up_new_name, i, XLOOKUP)) == NULL || entry->value == i) + if((entry = int_hash_lookup(&xctx->inst_table, up_new_name, i, XLOOKUP)) == NULL || entry->value == i) { last[(int)xctx->prefix]=q+1; break; @@ -716,7 +634,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names) if(strcmp(tmp2, old_prop) ) { my_strdup(449, &xctx->inst[i].prop_ptr, tmp2); my_strdup2(235, &xctx->inst[i].instname, new_name); - inst_hash_lookup(up_new_name, i, XINSERT); /* reinsert in hash */ + int_hash_lookup(&xctx->inst_table, up_new_name, i, XINSERT); /* reinsert in hash */ } my_free(987, &old_name); my_free(1257, &up_old_name); @@ -771,7 +689,6 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 size_t token_pos=0; int escape=0; int no_of_pins=0; - /* Inst_hashentry *ptr; */ char *fmt_attr = NULL; my_strdup(513, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); @@ -2038,7 +1955,6 @@ void print_tedax_element(FILE *fd, int inst) int escape=0; int no_of_pins=0; int subcircuit = 0; - /* Inst_hashentry *ptr; */ my_strdup(489, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"extra",0)); my_strdup(41, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0)); @@ -2348,7 +2264,6 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level int escape=0; int no_of_pins=0; int symbol = xctx->inst[inst].ptr; - /* Inst_hashentry *ptr; */ const char *fmt_attr = NULL; my_strdup(519, &template, @@ -2864,7 +2779,6 @@ const char *translate(int inst, const char* s) const char *tmp_sym_name; size_t sizetok=0; size_t result_pos=0, token_pos=0; - /* Inst_hashentry *ptr; */ struct stat time_buf; struct tm *tm; char file_name[PATH_MAX]; diff --git a/src/xinit.c b/src/xinit.c index 9c3c8998..fdaf12b3 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -496,7 +496,8 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) } } xctx->node_table = my_calloc(517, HASHSIZE, sizeof(Node_hashentry *)); - xctx->inst_table = my_calloc(1382, HASHSIZE, sizeof(Inst_hashentry *)); + xctx->inst_table.table = NULL; + xctx->inst_table.size = 0; xctx->hilight_table = my_calloc(1383, HASHSIZE, sizeof(Hilight_hashentry *)); xctx->inst_redraw_table = NULL; diff --git a/src/xschem.h b/src/xschem.h index 70e66710..93f8827b 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -832,7 +832,7 @@ typedef struct { int cur_undo_ptr; int tail_undo_ptr; int head_undo_ptr; - Inst_hashentry **inst_table; + Int_hashtable inst_table; Node_hashentry **node_table; Hilight_hashentry **hilight_table; @@ -1305,8 +1305,6 @@ extern void init_wire_iterator(Iterator_ctx *ctx, double x1, double y1, double x extern Wireentry *wire_iterator_next(Iterator_ctx *ctx); extern void check_unique_names(int rename); -extern void clear_instance_hash(); - extern unsigned int str_hash(const char *tok); extern void str_hash_free(Str_hashtable *hashtable); extern Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, @@ -1363,7 +1361,7 @@ extern double ceil_to_n_digits(double x, int n); extern const char *subst_token(const char *s, const char *tok, const char *new_val); extern void new_prop_string(int i, const char *old_prop,int fast, int dis_uniq_names); extern void hash_name(char *token, int remove); -extern void hash_all_names(int n); +extern void hash_all_names(void); extern void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2); /* extern char *escape_chars(char *dest, const char *source, int size); */ diff --git a/xschem_library/examples/mos_power_ampli.sch b/xschem_library/examples/mos_power_ampli.sch index b889a85d..b9c4fd50 100644 --- a/xschem_library/examples/mos_power_ampli.sch +++ b/xschem_library/examples/mos_power_ampli.sch @@ -311,126 +311,126 @@ C {ngspice_get_expr.sym} 800 -1000 0 1 {name=r8 node="[format %.4g [expr [ngspice::get_voltage e4] - [ngspice::get_voltage c7]]]" descr = veb } -C {ngspice_get_expr.sym} 860 -980 0 0 {name=r9 +C {ngspice_get_expr.sym} 860 -980 0 0 {name=r16 node="[format %.4g [expr [ngspice::get_current \{q4[ic]\}] / [ngspice::get_current \{q4[ib]\}] ] ]" descr = beta } -C {ngspice_get_expr.sym} 860 -920 0 0 {name=r15 +C {ngspice_get_expr.sym} 860 -920 0 0 {name=r17 node="[format %.4g [expr ([ngspice::get_voltage e4] - [ngspice::get_voltage e11]) * [ngspice::get_current \{q4[ic]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 330 -900 0 1 {name=r17 +C {ngspice_get_expr.sym} 330 -900 0 1 {name=r19 node="[ngspice::get_current v2]" descr = current } -C {ngspice_get_expr.sym} 380 -1030 0 0 {name=r18 +C {ngspice_get_expr.sym} 380 -1030 0 0 {name=r20 node="[ngspice::get_current \{r2[i]\}]" descr = current } -C {ngspice_get_expr.sym} 860 -1040 0 0 {name=r19 +C {ngspice_get_expr.sym} 860 -1040 0 0 {name=r21 node="[ngspice::get_current \{r9[i]\}]" descr = current } -C {ngspice_get_expr.sym} 820 -890 0 1 {name=r2 +C {ngspice_get_expr.sym} 820 -890 0 1 {name=r22 node="[ngspice::get_current \{q4[ic]\}]" descr = current } -C {ngspice_get_expr.sym} 800 -970 0 1 {name=r1 +C {ngspice_get_expr.sym} 800 -970 0 1 {name=r23 node="[ngspice::get_current \{q4[ib]\}]" descr = Ib } -C {ngspice_get_expr.sym} 580 -460 0 0 {name=r11 +C {ngspice_get_expr.sym} 580 -460 0 0 {name=r24 node="[format %.4g [expr ([ngspice::get_voltage e8] - [ngspice::get_voltage c8]) * [ngspice::get_current \{q8[ic]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 190 -860 0 0 {name=r12 +C {ngspice_get_expr.sym} 190 -860 0 0 {name=r25 node="[ngspice::get_current v6]" descr = current } -C {ngspice_get_expr.sym} 240 -210 0 1 {name=r6 +C {ngspice_get_expr.sym} 240 -210 0 1 {name=r26 node="[format %.4g [expr [ngspice::get_current \{q3[ic]\}] / [ngspice::get_current \{q3[ib]\}] ] ]" descr = beta } -C {ngspice_get_expr.sym} 860 -780 0 0 {name=r16 +C {ngspice_get_expr.sym} 860 -780 0 0 {name=r27 node="[format %.4g [expr ([ngspice::get_voltage e11] - [ngspice::get_voltage ga]) * [ngspice::get_current \{q11[ic]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 1000 -710 0 0 {name=r20 +C {ngspice_get_expr.sym} 1000 -710 0 0 {name=r28 node="[to_eng [ngspice::get_current \{r0[i]\}]]" descr = current } -C {ngspice_get_expr.sym} 280 -200 2 1 {name=r3 +C {ngspice_get_expr.sym} 280 -200 2 1 {name=r29 node="[format %.4g [expr ([ngspice::get_voltage c3] - [ngspice::get_voltage e3]) * [ngspice::get_current \{q3[ic]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 240 -190 2 0 {name=r21 +C {ngspice_get_expr.sym} 240 -190 2 0 {name=r30 node="[format %.4g [expr [ngspice::get_voltage b3] - [ngspice::get_voltage e3]]]" descr = vbe } -C {ngspice_get_expr.sym} 340 -390 0 0 {name=r7 +C {ngspice_get_expr.sym} 340 -390 0 0 {name=r31 node="[format %.4g [expr ([ngspice::get_voltage e9] - [ngspice::get_voltage c3]) * [ngspice::get_current \{r5[i]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 570 -760 0 0 {name=r10 +C {ngspice_get_expr.sym} 570 -760 0 0 {name=r32 node="[format %.4g [expr ([ngspice::get_voltage e6] - [ngspice::get_voltage c6]) * [ngspice::get_current \{q6[ic]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 210 -650 0 0 {name=r14 +C {ngspice_get_expr.sym} 210 -650 0 0 {name=r33 node="[format %.4g [expr ([ngspice::get_voltage c7] - [ngspice::get_voltage c5]) * [ngspice::get_current \{q7[ic]\}]]]" descr = power } -C {ngspice_get_expr.sym} 200 -500 0 0 {name=r13 +C {ngspice_get_expr.sym} 200 -500 0 0 {name=r34 node="[format %.4g [expr ([ngspice::get_voltage c5] - [ngspice::get_voltage e9]) * [ngspice::get_current \{q5[ic]\}]]]" descr = power } -C {ngspice_get_expr.sym} 320 -500 0 1 {name=r22 +C {ngspice_get_expr.sym} 320 -500 0 1 {name=r35 node="[format %.4g [expr ([ngspice::get_voltage c9] - [ngspice::get_voltage e9]) * [ngspice::get_current \{q9[ic]\}]]]" descr = power } -C {ngspice_get_expr.sym} 330 -760 0 1 {name=r23 +C {ngspice_get_expr.sym} 330 -760 0 1 {name=r36 node="[format %.4g [expr [ngspice::get_current \{q2[ic]\}] / [ngspice::get_current \{q2[ib]\}] ] ]" descr = beta } -C {ngspice_get_expr.sym} 1090 -640 0 1 {name=r24 +C {ngspice_get_expr.sym} 1090 -640 0 1 {name=r37 node="[ngspice::get_current vu]" descr = current } -C {ngspice_get_expr.sym} 1090 -530 0 1 {name=r25 +C {ngspice_get_expr.sym} 1090 -530 0 1 {name=r38 node="[ngspice::get_current vd]" descr = current } -C {ngspice_get_expr.sym} 1210 -1140 0 1 {name=r5 +C {ngspice_get_expr.sym} 1210 -1140 0 1 {name=r39 node="[ngspice::get_current \{d0[id]\}]" descr = current } -C {ngspice_get_expr.sym} 1370 -1150 0 1 {name=r26 +C {ngspice_get_expr.sym} 1370 -1150 0 1 {name=r40 node="[ngspice::get_current \{d1[id]\}]" descr = current } -C {ngspice_get_value.sym} 1130 -460 0 0 {name=r27 node=i(@r.$\{path\}xm2.rd[i]) +C {ngspice_get_value.sym} 1130 -460 0 0 {name=r41 node=i(@r.$\{path\}xm2.rd[i]) descr="Id="} -C {ngspice_get_expr.sym} 160 -230 0 0 {name=r28 +C {ngspice_get_expr.sym} 160 -230 0 0 {name=r42 node="[format %.4g [expr ([ngspice::get_node v(vpp)] - [ngspice::get_voltage b3]) * [ngspice::get_current \{r1[i]\}]]] W" descr = power } -C {ngspice_get_expr.sym} 1130 -740 2 1 {name=r29 +C {ngspice_get_expr.sym} 1130 -740 2 1 {name=r43 node="[format %.4g [expr \{([ngspice::get_node v(vpp)] - [ngspice::get_voltage outi]) * [ngspice::get_current vu]\}]] W" descr = power } C {lab_wire.sym} 910 -600 0 1 {name=l40 lab=OUTI} -C {ngspice_get_expr.sym} 980 -400 0 0 {name=r30 +C {ngspice_get_expr.sym} 980 -400 0 0 {name=r44 node="[ngspice::get_current \{r7[i]\}]" descr = current } -C {ngspice_get_expr.sym} 700 -440 2 0 {name=r31 +C {ngspice_get_expr.sym} 700 -440 2 0 {name=r45 node="[ngspice::get_current \{v4\}]" descr = current } -C {ngspice_get_expr.sym} 1130 -420 2 1 {name=r32 +C {ngspice_get_expr.sym} 1130 -420 2 1 {name=r46 node="[format %.4g [expr \{([ngspice::get_voltage outi] - [ngspice::get_node v(vnn)]) * [ngspice::get_current vd]\}]] W" descr = power } -C {ngspice_get_expr.sym} 150 -160 2 0 {name=r33 +C {ngspice_get_expr.sym} 150 -160 2 0 {name=r47 node="[format %.4g [expr -[ngspice::get_voltage b3] * [ngspice::get_current \{d2[id]\}]]] W" descr = power } @@ -462,7 +462,7 @@ descr="View Raw file" tclcommand="textwindow $netlist_dir/[file tail [file rootname [ xschem get schname 0 ] ] ].raw" } C {spice_probe.sym} 790 -600 0 0 {name=p60 analysis=tran voltage=-0.1364} -C {ngspice_get_expr.sym} 1300 -550 0 1 {name=r25 +C {ngspice_get_expr.sym} 1300 -550 0 1 {name=r48 node="[ngspice::get_current v8]" descr = current } diff --git a/xschem_library/ngspice/solar_panel.sch b/xschem_library/ngspice/solar_panel.sch index ffbfe310..31df7895 100644 --- a/xschem_library/ngspice/solar_panel.sch +++ b/xschem_library/ngspice/solar_panel.sch @@ -232,7 +232,7 @@ C {code.sym} 20 -190 0 0 {name=MODELS value=".MODEL DIODE D(IS=1.139e-08 RS=0.99 C {lab_pin.sym} 660 -440 0 1 {name=l4 lab=PANEL } C {lab_pin.sym} 630 -160 0 0 {name=l6 lab=0 } C {ammeter.sym} 1070 -390 3 0 {name=Vled net_name=true} -C {ind.sym} 890 -560 3 1 {name=L1 +C {ind.sym} 890 -560 3 1 {name=L2 m=1 value=40u footprint=1206 @@ -245,7 +245,7 @@ value=500n footprint=1206 device="ceramic capacitor" net_name=true} C {lab_pin.sym} 1010 -350 0 1 {name=l10 lab=VO } -C {lab_pin.sym} 530 -560 0 0 {name=l2 lab=PANEL } +C {lab_pin.sym} 530 -560 0 0 {name=l3 lab=PANEL } C {ammeter.sym} 970 -560 3 0 {name=Vind net_name=true} C {isource_table.sym} 1100 -280 0 0 {name=G2[9..0] CTRL="V(LED)" TABLE=" + (0, 0) @@ -285,11 +285,11 @@ C {lab_pin.sym} 510 -280 0 0 {name=l90 lab=0 } C {ammeter.sym} 440 -440 3 1 {name=Vpanel net_name=true} C {diode_ngspice.sym} 820 -410 2 0 {name=X2 m=1 Roff=1e9 Ron=0.1} C {switch_ngspice.sym} 760 -560 1 0 {name=S1 model=swmod} -C {lab_pin.sym} 740 -600 0 0 {name=l3 lab=0 } +C {lab_pin.sym} 740 -600 0 0 {name=l5 lab=0 } C {ammeter.sym} 570 -440 3 1 {name=Vpanel1 net_name=true} C {ammeter.sym} 510 -330 0 0 {name=Vcap net_name=true} C {vsource.sym} 170 -300 0 0 {name=Vfade value="pwl 0 1 1m 0"} -C {lab_pin.sym} 170 -250 0 0 {name=l5 lab=0 } +C {lab_pin.sym} 170 -250 0 0 {name=l8 lab=0 } C {ngspice_get_expr.sym} 1120 -320 0 0 {name=r29 node="[format %.4g [expr \{[ngspice::get_voltage led] * [ngspice::get_current vled]\}]] W" descr = power @@ -300,12 +300,12 @@ C {lab_pin.sym} 770 -1080 0 1 {name=l14 lab=TRIANG } C {vsource.sym} 550 -770 0 0 {name=Vref value=7} C {lab_pin.sym} 550 -740 0 0 {name=l17 lab=0 } -C {lab_pin.sym} 760 -670 0 0 {name=l8 lab=CTRL1 } +C {lab_pin.sym} 760 -670 0 0 {name=l13 lab=CTRL1 } C {comp_ngspice.sym} 660 -870 0 0 {name=x3 OFFSET=0.5 AMPLITUDE=1 ROUT=7k COUT=1n} C {lab_pin.sym} 550 -840 0 0 {name=l16 lab=REF} -C {lab_pin.sym} 550 -900 0 0 {name=l7 lab=LED } +C {lab_pin.sym} 550 -900 0 0 {name=l15 lab=LED } C {lab_pin.sym} 830 -870 0 1 {name=l18 lab=LEVEL} C {comp_ngspice.sym} 950 -1000 0 0 {name=x4 OFFSET=0.5 AMPLITUDE=1 ROUT=1 COUT=1p} -C {lab_pin.sym} 1060 -1000 0 1 {name=l8 lab=CTRL1 } -C {lab_pin.sym} 170 -360 0 0 {name=l4 lab=SUN } +C {lab_pin.sym} 1060 -1000 0 1 {name=l19 lab=CTRL1 } +C {lab_pin.sym} 170 -360 0 0 {name=l20 lab=SUN }