various enhancements around the new instance based schematic=... attribute, doc updates.

This commit is contained in:
stefan schippers 2023-04-13 00:49:38 +02:00
parent 590bf8b6ec
commit c71c15e967
7 changed files with 60 additions and 15 deletions

View File

@ -178,6 +178,16 @@ name="mchanged_name" model=\"nmos\" w="20u" l="3u" m="10"
in the symbol if any.
</p>
<li><kbd>schematic</kbd></li>
<p>
This attribute specifies an alternate schematic file to open when descending into the subcircuit.
This is done only for the specific instance allowing to differentiate implementation ona specific
instance of a given subcircuit.
The specified schematic must have the same interface (in/out/inout pins) as the base schematic (that
is inferred from the symbol name).<br>
Example: <kbd>schematic=sky130_tests/inv2.sym</kbd>
</p>
<li><kbd>pinnumber(name)</kbd></li>
<p> This will override at instance level the value of attribute <kbd>pinnumber</kbd> of pin <kbd>name</kbd> of the symbol.
This is mainly used for tedax, where by back annotation a connection to a symbol must be changed.</p>

View File

@ -1198,8 +1198,8 @@ const char *get_sym_name(int inst, int ext)
/* what = 1: start
what = 0 : end
*/
* what = 0 : end
*/
void get_additional_symbols(int what)
{
int i;

View File

@ -399,9 +399,8 @@ int global_spice_netlist(int global) /* netlister driver */
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++;
dbg(1, "global_spice_netlist(): last defined symbol=%d\n",xctx->symbols);
subckt_name=NULL;
dbg(2, "global_spice_netlist(): last defined symbol=%d\n",xctx->symbols);
get_additional_symbols(1);
for(i=0;i<xctx->symbols; ++i)
{
@ -410,6 +409,8 @@ int global_spice_netlist(int global) /* netlister driver */
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL)
@ -530,7 +531,8 @@ int spice_block_netlist(FILE *fd, int i)
/* int multip; */
char *extra=NULL;
int split_f;
const char *sym_def;
const char *sym_def, *sympath;
struct stat buf;
split_f = tclgetboolvar("split_files");
@ -549,7 +551,9 @@ int spice_block_netlist(FILE *fd, int i)
}
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n",
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
fprintf(fd, "** sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
sympath = abs_sym_path(xctx->sym[i].name, "");
if(!stat(sympath, &buf)) fprintf(fd, "** sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
else fprintf(fd, "** sym_path: %s\n", xctx->sym[i].name);
sym_def = get_tok_value(xctx->sym[i].prop_ptr,"spice_sym_def",0);
if(sym_def[0]) {

View File

@ -81,6 +81,8 @@ static int tedax_block_netlist(FILE *fd, int i)
int tedax_stop=0;
char filename[PATH_MAX];
char *extra=NULL;
const char *sympath;
struct stat buf;
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"tedax_stop",0),"true") )
tedax_stop=1;
@ -90,7 +92,9 @@ static int tedax_block_netlist(FILE *fd, int i)
fprintf(fd, "\n# expanding symbol: %s # of pins=%d\n",
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
fprintf(fd, "## sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
sympath = abs_sym_path(xctx->sym[i].name, "");
if(!stat(sympath, &buf)) fprintf(fd, "## sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
else fprintf(fd, "## sym_path: %s\n", xctx->sym[i].name);
fprintf(fd, "## sch_path: %s\n", filename);
fprintf(fd, "begin netlist v1 %s\n",skip_dir(xctx->sym[i].name));
@ -129,10 +133,13 @@ int global_tedax_netlist(int global) /* netlister driver */
char netl_filename[PATH_MAX]; /* overflow safe 20161122 */
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081211 overflow safe 20161122 */
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
char *subckt_name;
char *abs_path = NULL;
Str_hashtable subckt_table = {NULL, 0};
xctx->push_undo();
statusmsg("",2); /* clear infowindow */
str_hash_init(&subckt_table, HASHSIZE);
record_global_node(2, NULL, NULL); /* delete list of global nodes */
bus_char[0] = bus_char[1] = '\0';
xctx->hiersep[0]='.'; xctx->hiersep[1]='\0';
@ -196,8 +203,9 @@ int global_tedax_netlist(int global) /* netlister driver */
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++;
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",xctx->symbols);
subckt_name=NULL;
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",xctx->symbols);
get_additional_symbols(1);
for(i=0;i<xctx->symbols; ++i)
{
if( strcmp(get_tok_value(xctx->sym[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
@ -205,10 +213,21 @@ int global_tedax_netlist(int global) /* netlister driver */
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{
err |= tedax_block_netlist(fd, i);
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL)
{
str_hash_lookup(&subckt_table, subckt_name, "", XINSERT);
err |= tedax_block_netlist(fd, i);
}
}
}
my_free(_ALLOC_ID_, &abs_path);
get_additional_symbols(0);
str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name);
/*clear_drawing(); */
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));
xctx->currsch--;

View File

@ -358,6 +358,8 @@ int global_verilog_netlist(int global) /* netlister driver */
if(!xctx->sym[i].type) continue;
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) {
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL)
@ -430,7 +432,8 @@ int verilog_block_netlist(FILE *fd, int i)
char cellname[PATH_MAX];
const char *str_tmp, *fmt_attr = NULL;
int split_f;
const char *sym_def;
const char *sym_def, *sympath;
struct stat buf;
char *extra_ptr, *saveptr1, *extra_token, *extra = NULL, *extra2=NULL;
@ -452,7 +455,9 @@ int verilog_block_netlist(FILE *fd, int i)
dbg(1, "verilog_block_netlist(): expanding %s\n", xctx->sym[i].name);
fprintf(fd, "\n// expanding symbol: %s # of pins=%d\n",
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
fprintf(fd, "// sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
sympath = abs_sym_path(xctx->sym[i].name, "");
if(!stat(sympath, &buf)) fprintf(fd, "// sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
else fprintf(fd, "// sym_path: %s\n", xctx->sym[i].name);
sym_def = get_tok_value(xctx->sym[i].prop_ptr,"verilog_sym_def",0);
if(sym_def[0]) {
fprintf(fd, "%s\n", sym_def);

View File

@ -458,6 +458,8 @@ int global_vhdl_netlist(int global) /* netlister driver */
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL)
@ -527,7 +529,8 @@ int vhdl_block_netlist(FILE *fd, int i)
char *abs_path = NULL;
const char *str_tmp;
int split_f;
const char *sym_def;
const char *sym_def, *sympath;
struct stat buf;
split_f = tclgetboolvar("split_files");
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"vhdl_stop",0),"true") )
@ -547,7 +550,10 @@ int vhdl_block_netlist(FILE *fd, int i)
dbg(1, "vhdl_block_netlist(): expanding %s\n", xctx->sym[i].name);
fprintf(fd, "\n-- expanding symbol: %s # of pins=%d\n",
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
fprintf(fd, "-- sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
sympath = abs_sym_path(xctx->sym[i].name, "");
if(!stat(sympath, &buf)) fprintf(fd, "-- sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
else fprintf(fd, "-- sym_path: %s\n", xctx->sym[i].name);
sym_def = get_tok_value(xctx->sym[i].prop_ptr,"vhdl_sym_def",0);
if(sym_def[0]) {
fprintf(fd, "%s\n", sym_def);

View File

@ -4464,7 +4464,8 @@ proc sub_match_file { f {paths {}} } {
if {$sub_res != {} } {set res [concat $res $sub_res]}
}
} else {
set fname [file tail $j]
# set fname [file tail $j]
set fname $j
if {[regexp $f $fname]} {
lappend res $j
}