removed (now) duplicated inst_hash_lookup: use int_hash_lookup. Search function does not highlight nets if searching for something that is not "lab"

This commit is contained in:
Stefan Frederik 2022-10-12 13:14:48 +02:00
parent 7a1fbb4809
commit a820cc2e3f
12 changed files with 71 additions and 158 deletions

View File

@ -673,7 +673,7 @@ void clear_drawing(void)
xctx->polygons[i] = 0; xctx->polygons[i] = 0;
} }
dbg(1, "clear drawing(): deleted data structures, now deleting hash\n"); dbg(1, "clear drawing(): deleted data structures, now deleting hash\n");
clear_instance_hash(); int_hash_free(&xctx->inst_table);
} }
void enable_layers(void) 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].node=NULL;
xctx->inst[n].prop_ptr=NULL; xctx->inst[n].prop_ptr=NULL;
dbg(1, "place_symbol() :all inst_ptr members set\n"); /* 03-02-2000 */ 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) { if(inst_props) {
new_prop_string(n, inst_props,!first_call, tclgetboolvar("disable_unique_names")); /* 20171214 first_call */ new_prop_string(n, inst_props,!first_call, tclgetboolvar("disable_unique_names")); /* 20171214 first_call */
} }

View File

@ -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) ); my_strdup(89, &ptr,subst_token(xctx->inst[*ii].prop_ptr, "name", name) );
/* set name of current inst */ /* set name of current inst */
if(!pushed) { xctx->push_undo(); pushed=1;} 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 */ new_prop_string(*ii, ptr, k, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */
} else { } else {
my_strdup2(367, &xctx->inst[*ii].instname, ""); my_strdup2(367, &xctx->inst[*ii].instname, "");

View File

@ -646,7 +646,7 @@ int search(const char *tok, const char *val, int sub, int sel)
{ {
if(!sel) { if(!sel) {
type = (xctx->inst[i].ptr+ xctx->sym)->type; 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; */ bus_hilight_hash_lookup(xctx->inst[i].node[0], col, XINSERT_NOREPLACE); /* sets xctx->hilight_nets=1; */
} else { } else {
dbg(1, "search(): setting hilight flag on inst %d\n",i); dbg(1, "search(): setting hilight flag on inst %d\n",i);

View File

@ -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); 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 */ /* the newpropcnt argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */ /* 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++, new_prop_string(xctx->instances, xctx->inst[n].prop_ptr,newpropcnt++,
tclgetboolvar("disable_unique_names")); tclgetboolvar("disable_unique_names"));
xctx->instances++; xctx->instances++;

View File

@ -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].lab=NULL; /* assigned in link_symbols_to_instances */
xctx->inst[i].node=NULL; xctx->inst[i].node=NULL;
load_ascii_string(&prop_ptr,fd); 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 */ 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 */ /* the final tmp argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */ /* new_prop_string() for cleaning some internal caches. */

View File

@ -2289,7 +2289,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* 20110325 only modify prefix if prefix not NUL */ /* 20110325 only modify prefix if prefix not NUL */
if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */ 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) ); 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 */ new_prop_string(inst, ptr,0, tclgetboolvar("disable_unique_names")); /* set new prop_ptr */
type=xctx->sym[xctx->inst[inst].ptr].type; type=xctx->sym[xctx->inst[inst].ptr].type;
cond= !type || !IS_LABEL_SH_OR_PIN(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_hash_inst=0;
xctx->prep_net_structs=0; xctx->prep_net_structs=0;
xctx->prep_hi_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) { if(argc > 5) {
new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5]),fast, new_prop_string(inst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5]),fast,
tclgetboolvar("disable_unique_names")); tclgetboolvar("disable_unique_names"));

View File

@ -648,7 +648,7 @@ void str_hash_free(Str_hashtable *hashtable)
str_hash_free_entry( table[i] ); str_hash_free_entry( table[i] );
table[i] = NULL; table[i] = NULL;
} }
my_free(1384, &(hashtable->table)); if(hashtable->table) my_free(1384, &(hashtable->table));
hashtable->size = 0; hashtable->size = 0;
} }
} }
@ -746,7 +746,7 @@ void int_hash_free(Int_hashtable *hashtable)
int_hash_free_entry( table[i] ); int_hash_free_entry( table[i] );
table[i] = NULL; table[i] = NULL;
} }
my_free(1575, &(hashtable->table)); if(hashtable->table) my_free(1575, &(hashtable->table));
hashtable->size = 0; hashtable->size = 0;
} }
} }

View File

@ -42,100 +42,19 @@ static char *find_bracket(char *s)
return s; return s;
} }
/* 20180926 added token_size */ void hash_all_names(void)
/* 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;i<HASHSIZE;i++) {
inst_hash_free_entry( xctx->inst_table[i] );
xctx->inst_table[i] = NULL;
}
}
void hash_all_names(int n)
{ {
int i; int i;
char *upinst = NULL, *type = NULL; char *upinst = NULL, *type = NULL;
inst_hash_free(); int_hash_free(&xctx->inst_table);
int_hash_init(&xctx->inst_table, HASHSIZE);
for(i=0; i<xctx->instances; i++) { for(i=0; i<xctx->instances; i++) {
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
my_strdup(1526, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1526, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(!type) continue; if(!type) continue;
my_strdup(1254, &upinst, xctx->inst[i].instname); my_strdup(1254, &upinst, xctx->inst[i].instname);
strtoupper(upinst); strtoupper(upinst);
inst_hash_lookup(upinst, i, XINSERT); int_hash_lookup(&xctx->inst_table, upinst, i, XINSERT);
} }
} }
my_free(1255, &upinst); my_free(1255, &upinst);
@ -162,11 +81,6 @@ const char *tcl_hook2(char **res)
} }
} }
void clear_instance_hash()
{
inst_hash_free();
}
/* Missing: /* Missing:
* if one instance is named R1[3:0] and another is named R1[2] * if one instance is named R1[3:0] and another is named R1[2]
* the name collision is not detected nor corrected * the name collision is not detected nor corrected
@ -176,7 +90,7 @@ void check_unique_names(int rename)
int i, first = 1; int i, first = 1;
int newpropcnt = 0; int newpropcnt = 0;
char *tmp = NULL; char *tmp = NULL;
Inst_hashentry *entry; Int_hashentry *entry;
int big = xctx->wires> 2000 || xctx->instances > 2000; int big = xctx->wires> 2000 || xctx->instances > 2000;
char *upinst = NULL, *type = NULL; char *upinst = NULL, *type = NULL;
@ -193,7 +107,8 @@ void check_unique_names(int rename)
draw(); draw();
if(!big) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); 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; first = 1;
for(i=0;i<xctx->instances;i++) { for(i=0;i<xctx->instances;i++) {
if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) {
@ -201,7 +116,8 @@ void check_unique_names(int rename)
if(!type) continue; if(!type) continue;
my_strdup(1246, &upinst, xctx->inst[i].instname); my_strdup(1246, &upinst, xctx->inst[i].instname);
strtoupper(upinst); 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; xctx->inst[i].color = -PINLAYER;
inst_hilight_hash_lookup(xctx->inst[i].instname, -PINLAYER, XINSERT_NOREPLACE); inst_hilight_hash_lookup(xctx->inst[i].instname, -PINLAYER, XINSERT_NOREPLACE);
if(rename == 1) { if(rename == 1) {
@ -221,7 +137,7 @@ void check_unique_names(int rename)
new_prop_string(i, tmp, newpropcnt++, 0); new_prop_string(i, tmp, newpropcnt++, 0);
my_strdup(1259, &upinst, xctx->inst[i].instname); my_strdup(1259, &upinst, xctx->inst[i].instname);
strtoupper(upinst); 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); 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); bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2);
my_free(972, &tmp); my_free(972, &tmp);
@ -236,6 +152,7 @@ void check_unique_names(int rename)
bbox(END,0.0,0.0,0.0,0.0); bbox(END,0.0,0.0,0.0,0.0);
} }
redraw_hilights(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; size_t old_name_len;
int n; int n;
char *old_name_base = NULL; char *old_name_base = NULL;
Inst_hashentry *entry; Int_hashentry *entry;
char *up_old_name = NULL; char *up_old_name = NULL;
char *up_new_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]; xctx->prefix=old_name[0];
/* don't change old_prop if name does not conflict. */ /* 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) entry->value == i)
{ {
my_strdup(447, &xctx->inst[i].prop_ptr, old_prop); my_strdup(447, &xctx->inst[i].prop_ptr, old_prop);
my_strdup2(90, &xctx->inst[i].instname, old_name); 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(985, &old_name);
my_free(1578, &up_old_name); my_free(1578, &up_old_name);
return; 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); my_strdup(1258, &up_new_name, new_name);
strtoupper(up_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; last[(int)xctx->prefix]=q+1;
break; 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) ) { if(strcmp(tmp2, old_prop) ) {
my_strdup(449, &xctx->inst[i].prop_ptr, tmp2); my_strdup(449, &xctx->inst[i].prop_ptr, tmp2);
my_strdup2(235, &xctx->inst[i].instname, new_name); 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(987, &old_name);
my_free(1257, &up_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; size_t token_pos=0;
int escape=0; int escape=0;
int no_of_pins=0; int no_of_pins=0;
/* Inst_hashentry *ptr; */
char *fmt_attr = NULL; char *fmt_attr = NULL;
my_strdup(513, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); 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 escape=0;
int no_of_pins=0; int no_of_pins=0;
int subcircuit = 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(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)); 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 escape=0;
int no_of_pins=0; int no_of_pins=0;
int symbol = xctx->inst[inst].ptr; int symbol = xctx->inst[inst].ptr;
/* Inst_hashentry *ptr; */
const char *fmt_attr = NULL; const char *fmt_attr = NULL;
my_strdup(519, &template, my_strdup(519, &template,
@ -2864,7 +2779,6 @@ const char *translate(int inst, const char* s)
const char *tmp_sym_name; const char *tmp_sym_name;
size_t sizetok=0; size_t sizetok=0;
size_t result_pos=0, token_pos=0; size_t result_pos=0, token_pos=0;
/* Inst_hashentry *ptr; */
struct stat time_buf; struct stat time_buf;
struct tm *tm; struct tm *tm;
char file_name[PATH_MAX]; char file_name[PATH_MAX];

View File

@ -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->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->hilight_table = my_calloc(1383, HASHSIZE, sizeof(Hilight_hashentry *));
xctx->inst_redraw_table = NULL; xctx->inst_redraw_table = NULL;

View File

@ -832,7 +832,7 @@ typedef struct {
int cur_undo_ptr; int cur_undo_ptr;
int tail_undo_ptr; int tail_undo_ptr;
int head_undo_ptr; int head_undo_ptr;
Inst_hashentry **inst_table; Int_hashtable inst_table;
Node_hashentry **node_table; Node_hashentry **node_table;
Hilight_hashentry **hilight_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 Wireentry *wire_iterator_next(Iterator_ctx *ctx);
extern void check_unique_names(int rename); extern void check_unique_names(int rename);
extern void clear_instance_hash();
extern unsigned int str_hash(const char *tok); extern unsigned int str_hash(const char *tok);
extern void str_hash_free(Str_hashtable *hashtable); extern void str_hash_free(Str_hashtable *hashtable);
extern Str_hashentry *str_hash_lookup(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 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 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_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 void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2);
/* extern char *escape_chars(char *dest, const char *source, int size); */ /* extern char *escape_chars(char *dest, const char *source, int size); */

View File

@ -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]]]" node="[format %.4g [expr [ngspice::get_voltage e4] - [ngspice::get_voltage c7]]]"
descr = veb 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]\}] ] ]" node="[format %.4g [expr [ngspice::get_current \{q4[ic]\}] / [ngspice::get_current \{q4[ib]\}] ] ]"
descr = beta 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" node="[format %.4g [expr ([ngspice::get_voltage e4] - [ngspice::get_voltage e11]) * [ngspice::get_current \{q4[ic]\}]]] W"
descr = power 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]" node="[ngspice::get_current v2]"
descr = current 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]\}]" node="[ngspice::get_current \{r2[i]\}]"
descr = current 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]\}]" node="[ngspice::get_current \{r9[i]\}]"
descr = current 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]\}]" node="[ngspice::get_current \{q4[ic]\}]"
descr = current 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]\}]" node="[ngspice::get_current \{q4[ib]\}]"
descr = 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" node="[format %.4g [expr ([ngspice::get_voltage e8] - [ngspice::get_voltage c8]) * [ngspice::get_current \{q8[ic]\}]]] W"
descr = power 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]" node="[ngspice::get_current v6]"
descr = current 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]\}] ] ]" node="[format %.4g [expr [ngspice::get_current \{q3[ic]\}] / [ngspice::get_current \{q3[ib]\}] ] ]"
descr = beta 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" node="[format %.4g [expr ([ngspice::get_voltage e11] - [ngspice::get_voltage ga]) * [ngspice::get_current \{q11[ic]\}]]] W"
descr = power 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]\}]]" node="[to_eng [ngspice::get_current \{r0[i]\}]]"
descr = current 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" node="[format %.4g [expr ([ngspice::get_voltage c3] - [ngspice::get_voltage e3]) * [ngspice::get_current \{q3[ic]\}]]] W"
descr = power 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]]]" node="[format %.4g [expr [ngspice::get_voltage b3] - [ngspice::get_voltage e3]]]"
descr = vbe 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" node="[format %.4g [expr ([ngspice::get_voltage e9] - [ngspice::get_voltage c3]) * [ngspice::get_current \{r5[i]\}]]] W"
descr = power 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" node="[format %.4g [expr ([ngspice::get_voltage e6] - [ngspice::get_voltage c6]) * [ngspice::get_current \{q6[ic]\}]]] W"
descr = power 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]\}]]]" node="[format %.4g [expr ([ngspice::get_voltage c7] - [ngspice::get_voltage c5]) * [ngspice::get_current \{q7[ic]\}]]]"
descr = power 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]\}]]]" node="[format %.4g [expr ([ngspice::get_voltage c5] - [ngspice::get_voltage e9]) * [ngspice::get_current \{q5[ic]\}]]]"
descr = power 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]\}]]]" node="[format %.4g [expr ([ngspice::get_voltage c9] - [ngspice::get_voltage e9]) * [ngspice::get_current \{q9[ic]\}]]]"
descr = power 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]\}] ] ]" node="[format %.4g [expr [ngspice::get_current \{q2[ic]\}] / [ngspice::get_current \{q2[ib]\}] ] ]"
descr = beta 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]" node="[ngspice::get_current vu]"
descr = current 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]" node="[ngspice::get_current vd]"
descr = current 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]\}]" node="[ngspice::get_current \{d0[id]\}]"
descr = current 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]\}]" node="[ngspice::get_current \{d1[id]\}]"
descr = current 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="} 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" node="[format %.4g [expr ([ngspice::get_node v(vpp)] - [ngspice::get_voltage b3]) * [ngspice::get_current \{r1[i]\}]]] W"
descr = power 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" node="[format %.4g [expr \{([ngspice::get_node v(vpp)] - [ngspice::get_voltage outi]) * [ngspice::get_current vu]\}]] W"
descr = power descr = power
} }
C {lab_wire.sym} 910 -600 0 1 {name=l40 lab=OUTI} 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]\}]" node="[ngspice::get_current \{r7[i]\}]"
descr = current 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\}]" node="[ngspice::get_current \{v4\}]"
descr = current 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" node="[format %.4g [expr \{([ngspice::get_voltage outi] - [ngspice::get_node v(vnn)]) * [ngspice::get_current vd]\}]] W"
descr = power 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" node="[format %.4g [expr -[ngspice::get_voltage b3] * [ngspice::get_current \{d2[id]\}]]] W"
descr = power descr = power
} }
@ -462,7 +462,7 @@ descr="View Raw file"
tclcommand="textwindow $netlist_dir/[file tail [file rootname [ xschem get schname 0 ] ] ].raw" 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 {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]" node="[ngspice::get_current v8]"
descr = current descr = current
} }

View File

@ -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} 660 -440 0 1 {name=l4 lab=PANEL }
C {lab_pin.sym} 630 -160 0 0 {name=l6 lab=0 } 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 {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 m=1
value=40u value=40u
footprint=1206 footprint=1206
@ -245,7 +245,7 @@ value=500n
footprint=1206 footprint=1206
device="ceramic capacitor" net_name=true} device="ceramic capacitor" net_name=true}
C {lab_pin.sym} 1010 -350 0 1 {name=l10 lab=VO } 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 {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=" C {isource_table.sym} 1100 -280 0 0 {name=G2[9..0] CTRL="V(LED)" TABLE="
+ (0, 0) + (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 {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 {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 {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} 570 -440 3 1 {name=Vpanel1 net_name=true}
C {ammeter.sym} 510 -330 0 0 {name=Vcap 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 {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 C {ngspice_get_expr.sym} 1120 -320 0 0 {name=r29
node="[format %.4g [expr \{[ngspice::get_voltage led] * [ngspice::get_current vled]\}]] W" node="[format %.4g [expr \{[ngspice::get_voltage led] * [ngspice::get_current vled]\}]] W"
descr = power descr = power
@ -300,12 +300,12 @@ C {lab_pin.sym} 770 -1080 0 1 {name=l14
lab=TRIANG } lab=TRIANG }
C {vsource.sym} 550 -770 0 0 {name=Vref value=7} 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} 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 {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 C {lab_pin.sym} 550 -840 0 0 {name=l16
lab=REF} 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 {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 {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} 1060 -1000 0 1 {name=l19 lab=CTRL1 }
C {lab_pin.sym} 170 -360 0 0 {name=l4 lab=SUN } C {lab_pin.sym} 170 -360 0 0 {name=l20 lab=SUN }