when netlisting primitive elements (not subcircuits) the "format", "verilog_format", "vhdl_format, "tedax_format" can be specified in instance attributes to override symbol. This allows to adapt primitives (example digital standard cells) to different design kits without using wrapper subcircuits. Together with "symname" redefinition in instance this allows to completely customize element netlisting.

This commit is contained in:
Stefan Schippers 2020-10-11 00:13:52 +02:00
parent 617d708009
commit 0ce6f6ba5d
2 changed files with 22 additions and 15 deletions

View File

@ -1197,12 +1197,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"get_tok") ) else if(!strcmp(argv[1],"get_tok") )
{ {
char *s=NULL; char *s=NULL;
int t;
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
if(argc < 4) {Tcl_AppendResult(interp, "Missing arguments", NULL);return TCL_ERROR;} if(argc < 4) {Tcl_AppendResult(interp, "Missing arguments", NULL);return TCL_ERROR;}
if(argc == 5) if(argc == 5) t = atoi(argv[4]);
my_strdup(648, &s, get_tok_value(argv[2], argv[3], atoi(argv[4]))); else t = 0;
else my_strdup(648, &s, get_tok_value(argv[2], argv[3], t));
my_strdup(648, &s, get_tok_value(argv[2], argv[3], 0));
Tcl_AppendResult(interp, s, NULL); Tcl_AppendResult(interp, s, NULL);
my_free(649, &s); my_free(649, &s);
} }

View File

@ -1147,7 +1147,7 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol)
{ {
int tmp; int tmp;
register int c, state=XBEGIN, space; register int c, state=XBEGIN, space;
char *template=NULL,*format=NULL, *s, *value=NULL, *token=NULL; char *template=NULL, *s, *value=NULL, *token=NULL;
char *type=NULL, *generic_type=NULL, *generic_value=NULL; char *type=NULL, *generic_type=NULL, *generic_value=NULL;
const char *str_tmp; const char *str_tmp;
int i, sizetok=0, sizeval=0; int i, sizetok=0, sizeval=0;
@ -1161,7 +1161,6 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol)
my_free(998, &template); my_free(998, &template);
return; return;
} }
my_strdup(470, &format, get_tok_value(instdef[symbol].prop_ptr,"format",0));
my_strdup(471, &generic_type, get_tok_value(instdef[symbol].prop_ptr,"generic_type",0)); my_strdup(471, &generic_type, get_tok_value(instdef[symbol].prop_ptr,"generic_type",0));
dbg(2, "print_generic(): symbol=%d template=%s \n", symbol, template); dbg(2, "print_generic(): symbol=%d template=%s \n", symbol, template);
@ -1256,7 +1255,6 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol)
} }
if(tmp) fprintf(fd, "\n);\n"); if(tmp) fprintf(fd, "\n);\n");
my_free(999, &template); my_free(999, &template);
my_free(1000, &format);
my_free(1001, &value); my_free(1001, &value);
my_free(1002, &token); my_free(1002, &token);
my_free(1003, &type); my_free(1003, &type);
@ -1487,8 +1485,10 @@ void print_spice_element(FILE *fd, int inst)
/* my_strdup(485, &name,get_tok_value(inst_ptr[inst].prop_ptr,"name",0)); */ /* my_strdup(485, &name,get_tok_value(inst_ptr[inst].prop_ptr,"name",0)); */
if (!name) my_strdup(43, &name, get_tok_value(template, "name", 0)); if (!name) my_strdup(43, &name, get_tok_value(template, "name", 0));
my_strdup(486, &format, /* allow format string override in instance */
get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"format",2)); my_strdup(470, &format, get_tok_value(inst_ptr[inst].prop_ptr,"format",2));
if(!format || !format[0])
my_strdup(486, &format, get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"format",2));
if ((name==NULL) || (format==NULL)) { if ((name==NULL) || (format==NULL)) {
my_free(1015, &template); my_free(1015, &template);
@ -1674,8 +1674,10 @@ void print_tedax_element(FILE *fd, int inst)
/* my_strdup(496, &name,get_tok_value(inst_ptr[inst].prop_ptr,"name",0)); */ /* my_strdup(496, &name,get_tok_value(inst_ptr[inst].prop_ptr,"name",0)); */
if(!name) my_strdup(2, &name, get_tok_value(template, "name", 0)); if(!name) my_strdup(2, &name, get_tok_value(template, "name", 0));
my_strdup(497, &format, /* allow format string override in instance */
get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"tedax_format",2)); my_strdup(1185, &format, get_tok_value(inst_ptr[inst].prop_ptr,"tedax_format",2));
if(!format || !format[0])
my_strdup(497, &format, get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"tedax_format",2));
if(name==NULL || !format || !format[0]) { if(name==NULL || !format || !format[0]) {
my_free(1023, &extra); my_free(1023, &extra);
my_free(1024, &extra_pinnumber); my_free(1024, &extra_pinnumber);
@ -1931,7 +1933,7 @@ void print_verilog_element(FILE *fd, int inst)
int quote=0; int quote=0;
if(get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"verilog_format",2)[0] != '\0') { if(get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"verilog_format",2)[0] != '\0') {
print_verilog_primitive(fd, inst); /*15112003 */ print_verilog_primitive(fd, inst);
return; return;
} }
my_strdup(506, &template, my_strdup(506, &template,
@ -2130,7 +2132,10 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 *
my_strdup(514, &name, inst_ptr[inst].instname); my_strdup(514, &name, inst_ptr[inst].instname);
if(!name) my_strdup(50, &name, get_tok_value(template, "name", 0)); if(!name) my_strdup(50, &name, get_tok_value(template, "name", 0));
my_strdup(516, &format, get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"vhdl_format",2)); /* 20071217 */ /* allow format string override in instance */
my_strdup(1000, &format, get_tok_value(inst_ptr[inst].prop_ptr,"vhdl_format",2));
if(!format || !format[0])
my_strdup(516, &format, get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"vhdl_format",2)); /* 20071217 */
if((name==NULL) || (format==NULL) ) { if((name==NULL) || (format==NULL) ) {
my_free(1047, &template); my_free(1047, &template);
my_free(1048, &name); my_free(1048, &name);
@ -2301,8 +2306,10 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti
my_strdup(520, &name,inst_ptr[inst].instname); /*20161210 */ my_strdup(520, &name,inst_ptr[inst].instname); /*20161210 */
if(!name) my_strdup(4, &name, get_tok_value(template, "name", 0)); if(!name) my_strdup(4, &name, get_tok_value(template, "name", 0));
my_strdup(522, &format, /* allow format string override in instance */
get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"verilog_format",2)); my_strdup(1186, &format, get_tok_value(inst_ptr[inst].prop_ptr,"verilog_format",2));
if(!format || !format[0])
my_strdup(522, &format, get_tok_value((inst_ptr[inst].ptr+instdef)->prop_ptr,"verilog_format",2));
if((name==NULL) || (format==NULL) ) { if((name==NULL) || (format==NULL) ) {
my_free(1054, &template); my_free(1054, &template);
my_free(1055, &name); my_free(1055, &name);