Merge branch 'StefanSchippers:master' into master
This commit is contained in:
commit
8b6f5c1b9d
|
|
@ -568,7 +568,10 @@ verilog_format="xnor #(@risedel , @falldel ) @name ( @@Z , @@A , @@B );"
|
|||
<p> This expands to the net that connect to symbol pin named <kbd>pin</kbd>. This substitution
|
||||
takes place only when producing a netlist (Spice, Verilog, VHDL, tEDAx) so it is allowed to use this
|
||||
value only in <kbd>format</kbd>,<kbd>vhdl_format</kbd>, <kbd>tedax_format</kbd> or <kbd>verilog_format</kbd>
|
||||
attributes (see <a href="netlisting.html">Netlisting slide)</a></p>
|
||||
attributes (see <a href="netlisting.html">Netlisting slide)</a><br>
|
||||
The @#pin attribute is expanded to <kbd>?m net</kbd> where <kbd>m</kbd> is the pin multiplicity and
|
||||
<kbd>net</kbd> is the name of the net attached to the symbol <kbd>pin</kbd>. This information is needed
|
||||
by the xschem netlister.</p>
|
||||
<li><kbd>@#n</kbd></li>
|
||||
<p>
|
||||
This expands to the net that connect to symbol pin at position <kbd>n</kbd> in the XSCHEM internal storage. This substitution
|
||||
|
|
@ -577,6 +580,10 @@ verilog_format="xnor #(@risedel , @falldel ) @name ( @@Z , @@A , @@B );"
|
|||
attributes (see <a href="netlisting.html">Netlisting slide)</a><br>
|
||||
This method of accessing a net that connects to a pin is much faster than previous one since XSCHEM does not need to
|
||||
loop through symbol pin names looking for a match.<br>
|
||||
The @#n attribute is expanded to <kbd>?m net</kbd> where <kbd>m</kbd> is the <kbd>n-th</kbd> pin multiplicity and
|
||||
<kbd>net</kbd> is the name of the net attached to the symbol <kbd>cwn-thpin</kbd> pin. This information is needed
|
||||
by the xschem netlister.</p>
|
||||
|
||||
Example: <kbd>@#2</kbd>: return net name that connects to the third pin of the symbol (position 2).
|
||||
</p>
|
||||
<li><kbd>@#n:pin_attribute</kbd></li>
|
||||
|
|
@ -612,6 +619,27 @@ verilog_format="xnor #(@risedel , @falldel ) @name ( @@Z , @@A , @@B );"
|
|||
sequence number <kbd>n</kbd>, extracted from simulation raw file (operating point or
|
||||
cursor <kbd>b</kbd> position)</p>
|
||||
|
||||
<li><kbd>@spice_get_node spice_node </kbd></li>
|
||||
<p>
|
||||
<kbd>spice_node</kbd> Will be replaced with the Spice simulated value for that node.<br>
|
||||
Examples:<br>
|
||||
<kbd>Id=@spice_get_node i(\@m.@path@spiceprefix@name\.msky130_fd_pr__@model\[id])</kbd><br>
|
||||
will translate to: <br>
|
||||
<kbd>Id=6.6177u</kbd><br>
|
||||
and:<br>
|
||||
<kbd>Id=@spice_get_node i(\@m.@path@spiceprefix@name\.msky130_fd_pr__@model\[id]) A</kbd><br>
|
||||
will translate to: <br>
|
||||
<kbd>Id=6.6177uA</kbd><br>
|
||||
note the required separator spaces around the spice node. Spaces are used here as
|
||||
separators since spice nodes don't allow spaces.
|
||||
escapes are used for 2 reasons:
|
||||
mark a @ as a literal character instead of a the start of a @var token to be substituted
|
||||
mark the end of a @var, like for example @var\iable. In this case @var will
|
||||
be substituted by xschem instead of @variable.<br>
|
||||
Caveats: only one @spice_get_node is allowed in a string for now.
|
||||
</p>
|
||||
|
||||
|
||||
<li><kbd>@sch_last_modified</kbd></li>
|
||||
<p>
|
||||
this indicates the last modification time of the <kbd>.sch</kbd> file of the symbol.
|
||||
|
|
|
|||
|
|
@ -253,12 +253,12 @@ int hook_detect_target()
|
|||
append("cc/cflags", " ");
|
||||
append("cc/cflags", get("cc/argstd/Wall"));
|
||||
}
|
||||
/*
|
||||
* if (require("cc/argstd/std_c89", 0, 0) == 0) {
|
||||
* append("cc/cflags", " ");
|
||||
* append("cc/cflags", get("cc/argstd/std_c89"));
|
||||
* }
|
||||
*/
|
||||
|
||||
if (require("cc/argstd/std_c89", 0, 0) == 0) {
|
||||
append("cc/cflags", " ");
|
||||
append("cc/cflags", get("cc/argstd/std_c89"));
|
||||
}
|
||||
|
||||
if (require("cc/argstd/pedantic", 0, 0) == 0) {
|
||||
append("cc/cflags", " ");
|
||||
append("cc/cflags", get("cc/argstd/pedantic"));
|
||||
|
|
|
|||
|
|
@ -1787,7 +1787,7 @@ const char *get_sym_name(int inst, int ndir, int ext, int abs_path)
|
|||
const char *sym, *sch;
|
||||
|
||||
/* instance based symbol selection */
|
||||
sch = tcl_hook2(str_replace(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 2), "@symname",
|
||||
sch = tcl_hook2(str_replace(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), "@symname",
|
||||
get_cell(xctx->inst[inst].name, 0), '\\', -1));
|
||||
|
||||
if(xctx->tok_size) { /* token exists */
|
||||
|
|
@ -1966,10 +1966,10 @@ void get_additional_symbols(int what)
|
|||
my_strdup(_ALLOC_ID_, &verilog_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"verilog_sym_def",4));
|
||||
my_strdup(_ALLOC_ID_, &vhdl_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"vhdl_sym_def",4));
|
||||
|
||||
dbg(1, "schematic=%s\n", get_tok_value(xctx->inst[i].prop_ptr,"schematic",2));
|
||||
dbg(1, "schematic=%s\n", get_tok_value(xctx->inst[i].prop_ptr,"schematic",6));
|
||||
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
|
||||
my_strdup2(_ALLOC_ID_, &sch,
|
||||
translate3(get_tok_value(xctx->inst[i].prop_ptr,"schematic",2), 1,
|
||||
translate3(get_tok_value(xctx->inst[i].prop_ptr,"schematic", 6), 1,
|
||||
xctx->inst[i].prop_ptr, NULL, NULL));
|
||||
dbg(1, "sch=%s\n", sch);
|
||||
|
||||
|
|
@ -2092,11 +2092,11 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
|
|||
dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url);
|
||||
if(inst >= 0) {
|
||||
/* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */
|
||||
my_strdup2(_ALLOC_ID_, &str_tmp,
|
||||
translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic",2), 1,
|
||||
my_strdup(_ALLOC_ID_, &str_tmp,
|
||||
translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), 1,
|
||||
xctx->inst[inst].prop_ptr, NULL, NULL));
|
||||
}
|
||||
if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 2));
|
||||
if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6));
|
||||
if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */
|
||||
/* @symname in schematic attribute will be replaced with symbol name */
|
||||
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(str_replace(str_tmp, "@symname",
|
||||
|
|
@ -2358,7 +2358,7 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title)
|
|||
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr,
|
||||
xctx->inst[n].prop_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ,
|
||||
get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "template", 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[n].ptr].prop_ptr, "template", 0));
|
||||
|
||||
dbg(1,"descend_schematic(): inst_number=%d\n", inst_number);
|
||||
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", "", 0, inst_number));
|
||||
|
|
|
|||
|
|
@ -1561,7 +1561,7 @@ static int update_symbol(const char *result, int x, int selected_inst)
|
|||
dbg(1, "update_symbol(): for k loop: k=%d\n", k);
|
||||
if(xctx->sel_array[k].type != ELEMENT) continue;
|
||||
*ii=xctx->sel_array[k].n;
|
||||
old_prefix=(get_tok_value((xctx->sym + xctx->inst[*ii].ptr)->templ, "name",0))[0];
|
||||
old_prefix=(get_tok_value(xctx->sym[xctx->inst[*ii].ptr].templ, "name",0))[0];
|
||||
/* 20171220 calculate bbox before changes to correctly redraw areas */
|
||||
/* must be recalculated as cairo text extents vary with zoom factor. */
|
||||
symbol_bbox(*ii, &xctx->inst[*ii].x1, &xctx->inst[*ii].y1, &xctx->inst[*ii].x2, &xctx->inst[*ii].y2);
|
||||
|
|
@ -1604,7 +1604,7 @@ static int update_symbol(const char *result, int x, int selected_inst)
|
|||
( !strcmp(symbol, xctx->inst[*ii].name) && strcmp(translated_sym, old_translated_sym) ) ) {
|
||||
sym_number=match_symbol(translated_sym); /* check if exist */
|
||||
if(sym_number>=0) {
|
||||
prefix=(get_tok_value((xctx->sym+sym_number)->templ, "name",0))[0]; /* get new symbol prefix */
|
||||
prefix=(get_tok_value(xctx->sym[sym_number].templ, "name",0))[0]; /* get new symbol prefix */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -591,7 +591,7 @@ void hilight_parent_pins(void)
|
|||
if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue;
|
||||
my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
|
||||
dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node);
|
||||
pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
pin_name = get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
dbg(1, "pin_name=%s\n", pin_name);
|
||||
if(!pin_name[0]) continue;
|
||||
my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult));
|
||||
|
|
@ -659,7 +659,7 @@ void hilight_child_pins(void)
|
|||
if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue;
|
||||
my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
|
||||
dbg(1, "hilight_child_pins(): net_node=%s\n", net_node);
|
||||
pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
pin_name = get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(!pin_name[0]) continue;
|
||||
my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node);
|
||||
|
|
@ -771,7 +771,7 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case)
|
|||
} else if(!strcmp(tok,"cell::propstring")) {
|
||||
has_token = (str = (xctx->inst[i].ptr+ xctx->sym)->prop_ptr) ? 1 : 0;
|
||||
} else if(!strncmp(tok,"cell::", 6)) { /* cell::xxx looks for xxx in global symbol attributes */
|
||||
my_strdup(_ALLOC_ID_, &tmpname,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,tok+6,0));
|
||||
my_strdup(_ALLOC_ID_, &tmpname,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,tok+6,0));
|
||||
has_token = xctx->tok_size;
|
||||
if(tmpname) {
|
||||
str = tmpname;
|
||||
|
|
|
|||
|
|
@ -839,12 +839,12 @@ static void name_generics()
|
|||
bus_node_hash_lookup(inst[n].node[p],"", XINSERT, 1, sig_type,"", "","");
|
||||
} else {
|
||||
my_strdup(_ALLOC_ID_, &sig_type,
|
||||
get_tok_value((inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "sig_type", 0));
|
||||
get_tok_value(xctx->sym[inst[i].ptr].rect[GENERICLAYER][j-rects].prop_ptr, "sig_type", 0));
|
||||
/* insert generic label in hash table as a port so it will not */
|
||||
/* be declared as a signal in the vhdl netlist. this is a workaround */
|
||||
/* that should be fixed 25092001 */
|
||||
bus_node_hash_lookup(inst[n].node[p],
|
||||
get_tok_value((inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "dir",0),
|
||||
get_tok_value(xctx->sym[inst[i].ptr].rect[GENERICLAYER][j-rects].prop_ptr, "dir",0),
|
||||
XINSERT, 1, sig_type,"", "","");
|
||||
}
|
||||
} /* end if(inst[iptr->n].node[iptr->pin] != NULL) */
|
||||
|
|
@ -1276,7 +1276,7 @@ static int name_nodes_of_pins_labels_and_propagate()
|
|||
if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
|
||||
my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type);
|
||||
if(print_erc && (!inst[i].instname || !inst[i].instname[0]) &&
|
||||
!get_tok_value((inst[i].ptr+ xctx->sym)->templ, "name", 0)[0]
|
||||
!get_tok_value(xctx->sym[inst[i].ptr].templ, "name", 0)[0]
|
||||
) {
|
||||
char str[2048];
|
||||
if( type && /* list of devices that do not have a name= in template attribute */
|
||||
|
|
@ -1319,13 +1319,13 @@ static int name_nodes_of_pins_labels_and_propagate()
|
|||
/* 20071204 only define a dir property if instance is not a label */
|
||||
if(for_netlist)
|
||||
my_strdup2(_ALLOC_ID_, &dir,
|
||||
get_tok_value( (inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0));
|
||||
get_tok_value(xctx->sym[inst[i].ptr].rect[PINLAYER][0].prop_ptr, "dir",0));
|
||||
}
|
||||
else {
|
||||
/* handle global nodes (global=1 set as symbol property) 28032003 */
|
||||
my_strdup(_ALLOC_ID_, &global_node,get_tok_value(inst[i].prop_ptr,"global",0));
|
||||
if(!xctx->tok_size) {
|
||||
my_strdup(_ALLOC_ID_, &global_node,get_tok_value((inst[i].ptr+ xctx->sym)->prop_ptr,"global",0));
|
||||
my_strdup(_ALLOC_ID_, &global_node,get_tok_value(xctx->sym[inst[i].ptr].prop_ptr,"global",0));
|
||||
}
|
||||
/*20071204 if instance is a label dont define a dir property for more precise erc checking */
|
||||
}
|
||||
|
|
@ -1338,7 +1338,7 @@ static int name_nodes_of_pins_labels_and_propagate()
|
|||
}
|
||||
my_strdup(_ALLOC_ID_, &inst[i].node[0], inst[i].lab);
|
||||
if(!(inst[i].node[0])) {
|
||||
my_strdup(_ALLOC_ID_, &inst[i].node[0], get_tok_value((inst[i].ptr+ xctx->sym)->templ, "lab",0));
|
||||
my_strdup(_ALLOC_ID_, &inst[i].node[0], get_tok_value(xctx->sym[inst[i].ptr].templ, "lab",0));
|
||||
dbg(1, "name_nodes_of_pins_labels_and_propagate(): no lab attr on instance, pick from symbol: %s\n",
|
||||
inst[i].node[0]);
|
||||
}
|
||||
|
|
|
|||
25
src/save.c
25
src/save.c
|
|
@ -1551,15 +1551,16 @@ int raw_get_pos(const char *node, double value, int dset, int from_start, int to
|
|||
if(idx >= 0) {
|
||||
double vx;
|
||||
int start, end;
|
||||
int lastpoint = raw->npoints[dset] - 1;
|
||||
int sign, lastpoint = raw->npoints[dset] - 1;
|
||||
double vstart, vend;
|
||||
|
||||
start = from_start >= 0 ? from_start : 0;
|
||||
end = to_end >= 0 ? to_end : lastpoint;
|
||||
if(start > lastpoint) start = lastpoint;
|
||||
if(end > lastpoint) end = lastpoint;
|
||||
double vstart = get_raw_value(dset, idx, start);
|
||||
double vend = get_raw_value(dset, idx, end);
|
||||
int sign = (vend > vstart) ? 1 : -1;
|
||||
vstart = get_raw_value(dset, idx, start);
|
||||
vend = get_raw_value(dset, idx, end);
|
||||
sign = (vend > vstart) ? 1 : -1;
|
||||
if( sign * value >= sign * vstart && sign * value <= sign * vend) {
|
||||
while(1) {
|
||||
x = (start + end ) / 2;
|
||||
|
|
@ -3222,10 +3223,12 @@ static int pin_compare(const void *a, const void *b)
|
|||
int pinnumber_a, pinnumber_b;
|
||||
const char *tmp;
|
||||
int result;
|
||||
xRect *aa = (xRect *)a;
|
||||
xRect *bb = (xRect *)b;
|
||||
|
||||
tmp = get_tok_value(((xRect *)a)->prop_ptr, "sim_pinnumber", 0);
|
||||
tmp = get_tok_value(aa->prop_ptr, "sim_pinnumber", 0);
|
||||
pinnumber_a = tmp[0] ? atoi(tmp) : -1;
|
||||
tmp = get_tok_value(((xRect *)b)->prop_ptr, "sim_pinnumber", 0);
|
||||
tmp = get_tok_value(bb->prop_ptr, "sim_pinnumber", 0);
|
||||
pinnumber_b = tmp[0] ?atoi(tmp) : -1;
|
||||
result = pinnumber_a < pinnumber_b ? -1 : pinnumber_a == pinnumber_b ? 0 : 1;
|
||||
if(result >= 0) order_changed = 1;
|
||||
|
|
@ -4967,7 +4970,7 @@ void create_sch_from_sym(void)
|
|||
if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT)
|
||||
{
|
||||
my_strdup2(_ALLOC_ID_, &sch,
|
||||
get_tok_value((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
get_tok_value(xctx->sym[xctx->inst[xctx->sel_array[0].n].ptr].prop_ptr, "schematic", 0));
|
||||
my_strncpy(schname, abs_sym_path(sch, ""), S(schname));
|
||||
my_free(_ALLOC_ID_, &sch);
|
||||
if(!schname[0]) {
|
||||
|
|
@ -5101,7 +5104,7 @@ void descend_symbol(void)
|
|||
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr,
|
||||
xctx->inst[n].prop_ptr);
|
||||
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ,
|
||||
get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "template", 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[n].ptr].prop_ptr, "template", 0));
|
||||
|
||||
if(!xctx->inst[n].embed)
|
||||
/* use -1 to keep track we are descending into symbol from instance with no embed attr
|
||||
|
|
@ -5149,7 +5152,11 @@ void descend_symbol(void)
|
|||
}
|
||||
if(!sympath || stat(sympath, &buf)) { /* not found */
|
||||
dbg(1, "descend_symbol: not found: %s\n", sympath);
|
||||
my_strdup2(_ALLOC_ID_, &sympath, abs_sym_path(tcl_hook2(name), ""));
|
||||
if(is_generator(name)) {
|
||||
my_strdup2(_ALLOC_ID_, &sympath, tcl_hook2(name));
|
||||
} else {
|
||||
my_strdup2(_ALLOC_ID_, &sympath, abs_sym_path(tcl_hook2(name), ""));
|
||||
}
|
||||
}
|
||||
dbg(1, "descend_symbol(): name=%s, sympath=%s, dirname=%s\n", name, sympath, xctx->current_dirname);
|
||||
++xctx->currsch; /* increment level counter */
|
||||
|
|
|
|||
|
|
@ -1817,7 +1817,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
tmp = xctx->inst[i].name;
|
||||
Tcl_SetResult(interp, (char *) tmp, TCL_VOLATILE);
|
||||
} else if(strstr(argv[4], "cell::") ) {
|
||||
tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, argv[4]+6, with_quotes);
|
||||
tmp = get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr, argv[4]+6, with_quotes);
|
||||
dbg(1, "scheduler(): xschem getprop: looking up instance %d prop cell::|%s| : |%s|\n", i, argv[4]+6, tmp);
|
||||
Tcl_SetResult(interp, (char *) tmp, TCL_VOLATILE);
|
||||
} else {
|
||||
|
|
@ -1853,7 +1853,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0);
|
||||
}
|
||||
if(!value[0]) {
|
||||
value = get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr,argv[5],0);
|
||||
value = get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr,argv[5],0);
|
||||
}
|
||||
if(value[0] != 0) {
|
||||
char *ss;
|
||||
|
|
@ -2450,7 +2450,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
prepare_netlist_structs(0);
|
||||
no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(p=0;p<no_of_pins;p++) {
|
||||
if(!strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0), argv[3])) {
|
||||
if(!strcmp(get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][p].prop_ptr, "name",0), argv[3])) {
|
||||
str_ptr = net_name(i,p, &multip, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2482,7 +2482,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(p=0;p<no_of_pins;p++) {
|
||||
const char *pin;
|
||||
pin = get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0);
|
||||
pin = get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][p].prop_ptr, "name",0);
|
||||
if(!pin[0]) pin = "--ERROR--";
|
||||
if(argc > 3 && strcmp(argv[3], pin)) continue;
|
||||
if(first == 0) Tcl_AppendResult(interp, " ", NULL);
|
||||
|
|
@ -2596,7 +2596,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
|
||||
for(p=0;p<no_of_pins;p++) {
|
||||
const char *pin;
|
||||
pin = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0);
|
||||
pin = get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][p].prop_ptr, "name",0);
|
||||
if(!pin[0]) pin = "--ERROR--";
|
||||
my_mstrcat(_ALLOC_ID_, &pins, "{", pin, "}", NULL);
|
||||
if(p< no_of_pins-1) my_strcat(_ALLOC_ID_, &pins, " ");
|
||||
|
|
@ -3423,7 +3423,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(first == 0) Tcl_AppendResult(interp, " ", NULL);
|
||||
if(argc > 3 && argv[3][0]) {
|
||||
Tcl_AppendResult(interp, "{ {", my_itoa(p), "} {",
|
||||
get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, argv[3], 0),
|
||||
get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][p].prop_ptr, argv[3], 0),
|
||||
"} }", NULL);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "{ {", my_itoa(p), "} {",
|
||||
|
|
@ -4397,7 +4397,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
my_free(_ALLOC_ID_, &sym);
|
||||
if(sym_number>=0)
|
||||
{
|
||||
prefix=(get_tok_value( (xctx->sym+sym_number)->templ , "name",0))[0]; /* get new symbol prefix */
|
||||
prefix=(get_tok_value(xctx->sym[sym_number].templ , "name",0))[0]; /* get new symbol prefix */
|
||||
}
|
||||
else prefix = 'x';
|
||||
delete_inst_node(inst); /* 20180208 fix crashing bug: delete node info if changing symbol */
|
||||
|
|
|
|||
|
|
@ -964,8 +964,7 @@ void select_element(int i,unsigned short select_mode, int fast, int override_loc
|
|||
if(xctx->inst[i].node && (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr)
|
||||
{
|
||||
my_snprintf(str, S(str), "pin:%s -> %s",
|
||||
get_tok_value(
|
||||
(xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0) ,
|
||||
get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0),
|
||||
xctx->inst[i].node[j] ? xctx->inst[i].node[j] : "__UNCONNECTED_PIN__");
|
||||
statusmsg(str,2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ static int spice_netlist(FILE *fd, int spice_stop )
|
|||
if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT);
|
||||
else {
|
||||
my_strdup2(_ALLOC_ID_, &val,
|
||||
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 2));
|
||||
get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr, "device_model", 2));
|
||||
m = val;
|
||||
if(strchr(val, '@')) m = translate(i, val);
|
||||
else m = tcl_hook2(m);
|
||||
|
|
@ -316,7 +316,7 @@ int global_spice_netlist(int global) /* netlister driver */
|
|||
{
|
||||
if(skip_instance(i, 1, lvs_ignore)) continue;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(!place) {
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
|
||||
|
|
@ -380,7 +380,7 @@ int global_spice_netlist(int global) /* netlister driver */
|
|||
{
|
||||
if(skip_instance(i, 1, lvs_ignore)) continue;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(!place) {
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
|
||||
|
|
@ -535,7 +535,7 @@ int global_spice_netlist(int global) /* netlister driver */
|
|||
{
|
||||
if(skip_instance(i, 1, lvs_ignore)) continue;
|
||||
type = (xctx->inst[i].ptr+ xctx->sym)->type;
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
|
||||
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(place && !strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
|
|
|
|||
94
src/token.c
94
src/token.c
|
|
@ -424,6 +424,7 @@ static void get_pin_and_attr(const char *token, char **pin_num_or_name, char **p
|
|||
/* bit 1: */
|
||||
/* 1: do not perform tcl_hook2 substitution */
|
||||
/* bit: 2 = 1: same as bit 0 = 1, but remove surrounding "..." quotes, keep everything in between */
|
||||
/* with_quotes values used in xschem: 0 1 2 4 6 */
|
||||
|
||||
|
||||
const char *get_tok_value(const char *s,const char *tok, int with_quotes)
|
||||
|
|
@ -626,7 +627,7 @@ static char *get_pin_attr_from_inst(int inst, int pin, const char *attr)
|
|||
dbg(1, "get_pin_attr_from_inst(): inst=%d pin=%d attr=%s\n", inst, pin, attr);
|
||||
if(xctx->inst[inst].ptr < 0 ) return NULL;
|
||||
pin_attr_value = NULL;
|
||||
str = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][pin].prop_ptr,"name",0);
|
||||
str = get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][pin].prop_ptr,"name",0);
|
||||
if(str[0]) {
|
||||
size_t tok_val_len;
|
||||
tok_val_len = strlen(str);
|
||||
|
|
@ -934,13 +935,13 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200
|
|||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2));
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size)
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2));
|
||||
/* allow format string override in instance */
|
||||
if(xctx->tok_size && strcmp(fmt_attr, "vhdl_format"))
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "vhdl_format", 2));
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "vhdl_format"))
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "vhdl_format", 2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "vhdl_format", 2));
|
||||
if((name==NULL) || (format==NULL) ) {
|
||||
my_free(_ALLOC_ID_, &template);
|
||||
my_free(_ALLOC_ID_, &name);
|
||||
|
|
@ -1093,7 +1094,7 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200
|
|||
/* get pin_attr from instance pin attribute string */
|
||||
if(!pin_attr_value) {
|
||||
my_strdup(_ALLOC_ID_, &pin_attr_value,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
}
|
||||
}
|
||||
/* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */
|
||||
|
|
@ -1454,13 +1455,13 @@ void print_vhdl_element(FILE *fd, int inst)
|
|||
fmt = get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2);
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size)
|
||||
fmt = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2);
|
||||
fmt = get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2);
|
||||
/* allow format string override in instance */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "vhdl_format") )
|
||||
fmt = get_tok_value(xctx->inst[inst].prop_ptr, "vhdl_format", 2);
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "vhdl_format"))
|
||||
fmt = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "vhdl_format", 2);
|
||||
fmt = get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "vhdl_format", 2);
|
||||
|
||||
if(fmt[0]) {
|
||||
print_vhdl_primitive(fd, inst);
|
||||
|
|
@ -1491,7 +1492,7 @@ void print_vhdl_element(FILE *fd, int inst)
|
|||
|
||||
tmp=0;
|
||||
/* 20080213 use generic_type property to decide if some properties are strings, see later */
|
||||
my_strdup(_ALLOC_ID_, &generic_type, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"generic_type", 0));
|
||||
my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"generic_type", 0));
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
|
@ -1557,13 +1558,13 @@ void print_vhdl_element(FILE *fd, int inst)
|
|||
for(i=0;i<no_of_generics; ++i)
|
||||
{
|
||||
if(!xctx->inst[inst].node || !xctx->inst[inst].node[no_of_pins+i]) continue;
|
||||
my_strdup(_ALLOC_ID_, &generic_type,get_tok_value(
|
||||
(xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"type",0));
|
||||
my_strdup(_ALLOC_ID_, &generic_type,
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[GENERICLAYER][i].prop_ptr,"type",0));
|
||||
my_strdup(_ALLOC_ID_, &generic_value, xctx->inst[inst].node[no_of_pins+i] );
|
||||
/*my_strdup(_ALLOC_ID_, &generic_value, get_tok_value( */
|
||||
/* (xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"value") ); */
|
||||
str_ptr = get_tok_value(
|
||||
(xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"name",0);
|
||||
str_ptr =
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[GENERICLAYER][i].prop_ptr,"name",0);
|
||||
if(generic_value) { /*03062002 dont print generics if unassigned */
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
if(!tmp) fprintf(fd, "generic map (\n");
|
||||
|
|
@ -1589,7 +1590,7 @@ void print_vhdl_element(FILE *fd, int inst)
|
|||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
fprintf(fd, " %s => %s",
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
str_ptr);
|
||||
tmp=1;
|
||||
}
|
||||
|
|
@ -2137,13 +2138,13 @@ int print_spice_element(FILE *fd, int inst)
|
|||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2));
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size)
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2));
|
||||
/* allow format string override in instance */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "format") )
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "format", 2));
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "format"))
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "format", 2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "format", 2));
|
||||
if ((name==NULL) || (format==NULL)) {
|
||||
my_free(_ALLOC_ID_, &template);
|
||||
my_free(_ALLOC_ID_, &format);
|
||||
|
|
@ -2359,7 +2360,7 @@ int print_spice_element(FILE *fd, int inst)
|
|||
/* get pin_attr from instance pin attribute string */
|
||||
if(!pin_attr_value) {
|
||||
my_strdup(_ALLOC_ID_, &pin_attr_value,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
}
|
||||
}
|
||||
/* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */
|
||||
|
|
@ -2516,10 +2517,10 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
int no_of_pins=0;
|
||||
int subcircuit = 0;
|
||||
|
||||
my_strdup(_ALLOC_ID_, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"extra",0));
|
||||
my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"extra",0));
|
||||
my_strdup(_ALLOC_ID_, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0));
|
||||
if(!extra_pinnumber) my_strdup(_ALLOC_ID_, &extra_pinnumber,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"extra_pinnumber",0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"extra_pinnumber",0));
|
||||
my_strdup(_ALLOC_ID_, &template,
|
||||
(xctx->inst[inst].ptr + xctx->sym)->templ);
|
||||
my_strdup(_ALLOC_ID_, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",0));
|
||||
|
|
@ -2533,7 +2534,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
/* allow format string override in instance */
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",2));
|
||||
if(!format || !format[0])
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"tedax_format",2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"tedax_format",2));
|
||||
|
||||
no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
|
||||
if( !format && !strcmp((xctx->inst[inst].ptr + xctx->sym)->type, "subcircuit") ) {
|
||||
|
|
@ -2553,7 +2554,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
for(i=0;i<no_of_pins; ++i) {
|
||||
my_strdup2(_ALLOC_ID_, &net, net_name(inst,i, &net_mult, 0, 1));
|
||||
my_strdup2(_ALLOC_ID_, &pinname,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"name",0));
|
||||
my_strdup2(_ALLOC_ID_, &pin, expandlabel(pinname, &pin_mult));
|
||||
if(!int_hash_lookup(&table, pinname, 1, XINSERT_NOREPLACE)) {
|
||||
dbg(1, "#net=%s pinname=%s pin=%s net_mult=%d pin_mult=%d\n", net, pinname, pin, net_mult, pin_mult);
|
||||
|
|
@ -2592,7 +2593,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
pinnumber = get_pin_attr_from_inst(inst, i, "pinnumber");
|
||||
if(!pinnumber) {
|
||||
my_strdup2(_ALLOC_ID_, &pinnumber,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"pinnumber",0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"pinnumber",0));
|
||||
}
|
||||
if(!xctx->tok_size) my_strdup(_ALLOC_ID_, &pinnumber, "--UNDEF--");
|
||||
tmp = net_name(inst,i, &multip, 0, 1);
|
||||
|
|
@ -2600,7 +2601,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
fprintf(fd, "conn %s %s %s %s %d\n",
|
||||
name,
|
||||
tmp,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
pinnumber,
|
||||
i+1);
|
||||
}
|
||||
|
|
@ -2724,7 +2725,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */
|
||||
for(i=0;i<no_of_pins; ++i) {
|
||||
if(!strcmp(
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"name",0),
|
||||
token+2
|
||||
)
|
||||
) {
|
||||
|
|
@ -2760,7 +2761,7 @@ void print_tedax_element(FILE *fd, int inst)
|
|||
/* get pin_attr from instance pin attribute string */
|
||||
if(!pin_attr_value) {
|
||||
my_strdup(_ALLOC_ID_, &pin_attr_value,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
}
|
||||
}
|
||||
/* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */
|
||||
|
|
@ -2866,13 +2867,13 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level
|
|||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2));
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size)
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2));
|
||||
/* allow format string override in instance */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format") )
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "verilog_format", 2));
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_format", 2));
|
||||
my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_format", 2));
|
||||
if((name==NULL) || (format==NULL) ) {
|
||||
my_free(_ALLOC_ID_, &template);
|
||||
my_free(_ALLOC_ID_, &name);
|
||||
|
|
@ -3021,7 +3022,7 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level
|
|||
/* get pin_attr from instance pin attribute string */
|
||||
if(!pin_attr_value) {
|
||||
my_strdup(_ALLOC_ID_, &pin_attr_value,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
}
|
||||
}
|
||||
/* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */
|
||||
|
|
@ -3150,13 +3151,13 @@ void print_verilog_element(FILE *fd, int inst)
|
|||
fmt = get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2);
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size)
|
||||
fmt = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, fmt_attr, 2);
|
||||
fmt = get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2);
|
||||
/* allow format string override in instance */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format") )
|
||||
fmt = get_tok_value(xctx->inst[inst].prop_ptr, "verilog_format", 2);
|
||||
/* get netlist format rule from symbol */
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
|
||||
fmt = get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_format", 2);
|
||||
fmt = get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_format", 2);
|
||||
|
||||
if(fmt[0]) {
|
||||
print_verilog_primitive(fd, inst);
|
||||
|
|
@ -3170,11 +3171,11 @@ void print_verilog_element(FILE *fd, int inst)
|
|||
return;
|
||||
}
|
||||
/* verilog_extra is the list of additional nodes passed as attributes */
|
||||
my_strdup(_ALLOC_ID_, &v_extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilog_extra", 0));
|
||||
my_strdup(_ALLOC_ID_, &v_extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_extra", 0));
|
||||
/* extra is the list of attributes NOT to consider as instance parameters */
|
||||
my_strdup(_ALLOC_ID_, &extra, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "extra", 0));
|
||||
my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "extra", 0));
|
||||
my_strdup(_ALLOC_ID_, &verilogprefix,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "verilogprefix", 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilogprefix", 0));
|
||||
if(verilogprefix) {
|
||||
my_strdup(_ALLOC_ID_, &symname, verilogprefix);
|
||||
my_strcat(_ALLOC_ID_, &symname, get_sym_name(inst, 0, 0, 0));
|
||||
|
|
@ -3186,7 +3187,7 @@ void print_verilog_element(FILE *fd, int inst)
|
|||
no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER];
|
||||
|
||||
/* 20080915 use generic_type property to decide if some properties are strings, see later */
|
||||
my_strdup(_ALLOC_ID_, &generic_type, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr,"generic_type",0));
|
||||
my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"generic_type",0));
|
||||
s=xctx->inst[inst].prop_ptr;
|
||||
/* print instance subckt */
|
||||
dbg(2, "print_verilog_element(): printing inst name & subcircuit name\n");
|
||||
|
|
@ -3386,13 +3387,13 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int
|
|||
my_snprintf(str_node, S(str_node), "%s", (xctx->inst[i].node[j])+1 );
|
||||
}
|
||||
expandlabel(
|
||||
get_tok_value( (xctx->inst[i].ptr + xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), multip);
|
||||
get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0), multip);
|
||||
return expandlabel(str_node, &tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
expandlabel(
|
||||
get_tok_value( (xctx->inst[i].ptr + xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), multip);
|
||||
get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0), multip);
|
||||
return expandlabel(xctx->inst[i].node[j], &tmp);
|
||||
}
|
||||
}
|
||||
|
|
@ -3541,7 +3542,7 @@ static char *get_pin_attr(const char *token, int inst, int engineering)
|
|||
/* get pin_attr from instance pin attribute string */
|
||||
if(!pin_attr_value) {
|
||||
my_strdup(_ALLOC_ID_, &pin_attr_value,
|
||||
get_tok_value((xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0));
|
||||
}
|
||||
}
|
||||
/* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin
|
||||
|
|
@ -3645,6 +3646,27 @@ static char *get_pin_attr(const char *token, int inst, int engineering)
|
|||
return value;
|
||||
}
|
||||
|
||||
/* This routine processes the entire string returned by translate, looks
|
||||
* for "@spice_get_node <spice_node> " patterns and replaces with the
|
||||
* Spice simulated value for that node.
|
||||
* the format is "some_text@spice_get_node <spice_node> some_additional_text"
|
||||
* Examples:
|
||||
* Id=@spice_get_node i(\@m.@path@spiceprefix@name\.msky130_fd_pr__@model\[id])
|
||||
* will translate to:
|
||||
* Id=6.6177u
|
||||
* Id=@spice_get_node i(\@m.@path@spiceprefix@name\.msky130_fd_pr__@model\[id]) A
|
||||
* will translate to:
|
||||
* Id=6.6177uA
|
||||
* note the required separator spaces around the spice node. Spaces are used here as
|
||||
* separators since spice nodes don't allow spaces.
|
||||
* escapes are used for 2 reasons:
|
||||
* mark a @ as a literal character instead of a the start of a @var token to be substituted
|
||||
* mark the end of a @var, like for example @var\iable. In this case @var will
|
||||
* be substituted by xschem instead of @variable
|
||||
*
|
||||
* caveats: only one @spice_get_node is allowed in a string for now.
|
||||
*/
|
||||
|
||||
const char *spice_get_node(const char *token)
|
||||
{
|
||||
const char *pos;
|
||||
|
|
@ -4305,7 +4327,7 @@ const char *translate(int inst, const char* s)
|
|||
} else if(inst >= 0) {
|
||||
value = get_tok_value(xctx->inst[inst].prop_ptr, token+1, 0);
|
||||
if(!xctx->tok_size && xctx->inst[inst].ptr >= 0) {
|
||||
value=get_tok_value((xctx->inst[inst].ptr + xctx->sym)->templ, token+1, 0);
|
||||
value=get_tok_value(xctx->sym[xctx->inst[inst].ptr].templ, token+1, 0);
|
||||
}
|
||||
if(!xctx->tok_size) { /* above lines did not find a value for token */
|
||||
if(token[0] =='%') {
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@ int global_verilog_netlist(int global) /* netlister driver */
|
|||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
|
||||
if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
|
||||
{
|
||||
str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr , fmt_attr, 2);
|
||||
str_tmp = get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr , fmt_attr, 2);
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
|
||||
str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2);
|
||||
str_tmp = get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr, "verilog_format", 2);
|
||||
|
||||
my_strdup(_ALLOC_ID_, &tmp_string, str_tmp);
|
||||
fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "<NULL>");
|
||||
|
|
@ -479,9 +479,9 @@ int verilog_block_netlist(FILE *fd, int i)
|
|||
my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
|
||||
if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
|
||||
{
|
||||
str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, fmt_attr, 2);
|
||||
str_tmp = get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, fmt_attr, 2);
|
||||
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
|
||||
str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2);
|
||||
str_tmp = get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "verilog_format", 2);
|
||||
my_strdup(_ALLOC_ID_, &tmp_string, str_tmp);
|
||||
fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "<NULL>");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -660,8 +660,8 @@ int vhdl_block_netlist(FILE *fd, int i)
|
|||
for(k=0;k<xctx->sym[j].rects[PINLAYER]; ++k)
|
||||
{
|
||||
if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(
|
||||
xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0));
|
||||
my_strdup(_ALLOC_ID_, &sig_type,
|
||||
get_tok_value( xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0));
|
||||
my_strdup(_ALLOC_ID_, &port_value,
|
||||
get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value", 0) );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue