diff --git a/doc/xschem_man/symbol_property_syntax.html b/doc/xschem_man/symbol_property_syntax.html index 3b28693b..a0c98b95 100644 --- a/doc/xschem_man/symbol_property_syntax.html +++ b/doc/xschem_man/symbol_property_syntax.html @@ -453,10 +453,15 @@ verilog_format="xnor #(@risedel , @falldel ) @name ( @@Z , @@A , @@B );" this indicates the last modification time of the schematic (.sch) containing the symbol instance.
++ this expands to the name of the schematic (.sch) containing + the symbol instance. +
- this expands to the name of the schematic (.sch) containing - the symbol instance. + this expands to the name of the schematic containing + the symbol instance, without the extension (no .sch).
diff --git a/src/token.c b/src/token.c index dbd568f7..480d9fa5 100644 --- a/src/token.c +++ b/src/token.c @@ -823,12 +823,16 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 { fputs(get_cell_w_ext(xctx->inst[inst].name, 0), fd); } - else if(strcmp(token,"@schname")==0) /* of course schname must not be present */ + else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present */ /* in hash table */ { /* fputs(xctx->sch[xctx->currsch],fd); */ fputs(xctx->current_name, fd); } + else if(strcmp(token,"@schname")==0) + { + fputs(get_cell(xctx->current_name, 0), fd); + } else if(strcmp(token,"@topschname")==0) /* of course topschname must not be present in attributes */ { const char *topsch; @@ -1874,14 +1878,21 @@ int print_spice_element(FILE *fd, int inst) STR_ALLOC(&result, tmp + result_pos, &size); result_pos += my_snprintf(result + result_pos, tmp, "%s", topsch); } - else if(strcmp(token,"@schname")==0) /* of course schname must not be present in attributes */ + else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present in attributes */ { tmp = strlen(xctx->current_name) +100 ; /* always make room for some extra chars * so 1-char writes to result do not need reallocs */ STR_ALLOC(&result, tmp + result_pos, &size); result_pos += my_snprintf(result + result_pos, tmp, "%s", xctx->current_name); /* fputs(xctx->current_name, fd); */ - + } + else if(strcmp(token,"@schname")==0) /* of course schname must not be present in attributes */ + { + const char *schname = get_cell(xctx->current_name, 0); + tmp = strlen(schname) +100 ; /* always make room for some extra chars + * so 1-char writes to result do not need reallocs */ + STR_ALLOC(&result, tmp + result_pos, &size); + result_pos += my_snprintf(result + result_pos, tmp, "%s", schname); } else if(strcmp(token,"@pinlist")==0) /* of course pinlist must not be present in attributes */ /* print multiplicity */ @@ -2200,12 +2211,17 @@ void print_tedax_element(FILE *fd, int inst) { fputs(get_cell_w_ext(xctx->inst[inst].name, 0), fd); } - else if(strcmp(token,"@schname")==0) /* of course schname must not be present */ - /* in hash table */ + else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present */ + /* in hash table */ { /* fputs(xctx->sch[xctx->currsch],fd); */ fputs(xctx->current_name, fd); } + else if(strcmp(token,"@schname")==0) /* of course schname must not be present */ + /* in hash table */ + { + fputs(get_cell(xctx->current_name, 0), fd); + } else if(strcmp(token,"@topschname")==0) /* of course topschname must not be present in attributes */ { const char *topsch; @@ -2421,12 +2437,17 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level { fputs(get_cell_w_ext(xctx->inst[inst].name, 0), fd); } - else if(strcmp(token,"@schname")==0) /* of course schname must not be present */ + else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present */ /* in hash table */ { /* fputs(xctx->sch[xctx->currsch],fd); */ fputs(xctx->current_name, fd); } + else if(strcmp(token,"@schname")==0) /* of course schname must not be present */ + /* in hash table */ + { + fputs(get_cell(xctx->current_name, 0), fd); + } else if(strcmp(token,"@topschname")==0) /* of course topschname must not be present in attributes */ { const char *topsch; @@ -2989,13 +3010,19 @@ const char *translate(int inst, const char* s) memcpy(result+result_pos, date, tmp+1); result_pos+=tmp; } - } else if(strcmp(token,"@schname")==0) { + } else if(strcmp(token,"@schname_ext")==0) { /* tmp=strlen(xctx->sch[xctx->currsch]);*/ tmp = strlen(xctx->current_name); STR_ALLOC(&result, tmp + result_pos, &size); /* memcpy(result+result_pos,xctx->sch[xctx->currsch], tmp+1); */ memcpy(result+result_pos, xctx->current_name, tmp+1); result_pos+=tmp; + } else if(strcmp(token,"@schname")==0) { + const char *schname = get_cell(xctx->current_name, 0); + tmp = strlen(schname); + STR_ALLOC(&result, tmp + result_pos, &size); + memcpy(result+result_pos, schname, tmp+1); + result_pos+=tmp; } else if(strcmp(token,"@topschname")==0) { const char *topsch; topsch = get_trailing_path(xctx->sch[0], 0, 1); diff --git a/xschem_library/devices/title.sym b/xschem_library/devices/title.sym index 9efcc8de..5f679048 100644 --- a/xschem_library/devices/title.sym +++ b/xschem_library/devices/title.sym @@ -1,4 +1,4 @@ -v {xschem version=2.9.8 file_version=1.2} +v {xschem version=3.1.0 file_version=1.2 } G {} K {type=logo template="name=l1 author=\\"Stefan Schippers\\"" @@ -12,7 +12,7 @@ E {} L 6 225 0 1020 0 {} L 6 -160 0 -95 0 {} P 5 13 5 -30 -25 0 5 30 -15 30 -35 10 -55 30 -75 30 -45 0 -75 -30 -55 -30 -35 -10 -15 -30 5 -30 {fill=true} -T {@schname} 235 5 0 0 0.4 0.4 {} +T {@schname_ext} 235 5 0 0 0.4 0.4 {} T {@author} 235 -25 0 0 0.4 0.4 {} T {@time_last_modified} 1020 -25 0 1 0.4 0.3 {} T {SCHEM} 5 -25 0 0 1 1 {} diff --git a/xschem_library/examples/mos_power_ampli.sym b/xschem_library/examples/mos_power_ampli.sym index 9099ea62..518460d5 100644 --- a/xschem_library/examples/mos_power_ampli.sym +++ b/xschem_library/examples/mos_power_ampli.sym @@ -1,4 +1,4 @@ -v {xschem version=3.0.0 file_version=1.2 } +v {xschem version=3.1.0 file_version=1.2 } G {} K {type=subcircuit format="@name @pinlist @symname" @@ -32,4 +32,3 @@ T {VSS} -125 -4 0 0 0.2 0.2 {} T {OUT} 125 -44 0 1 0.2 0.2 {} T {VPP} -125 16 0 0 0.2 0.2 {} T {VNN} -125 36 0 0 0.2 0.2 {} -T {MOS Power amplifier} -110 -90 0 0 0.4 0.4 {hide=true} diff --git a/xschem_library/ngspice/solar_panel.sym b/xschem_library/ngspice/solar_panel.sym index 78a6b794..35020f93 100644 --- a/xschem_library/ngspice/solar_panel.sym +++ b/xschem_library/ngspice/solar_panel.sym @@ -1,11 +1,15 @@ -v {xschem version=3.0.0 file_version=1.2} +v {xschem version=3.1.0 file_version=1.2 } +G {} K {type=subcircuit format="@name @pinlist @symname" template="name=x1" } -T {@symname} -67.5 -6 0 0 0.3 0.3 {} -T {@name} 135 -22 0 0 0.2 0.2 {} +V {} +S {} +E {} L 4 -130 -10 130 -10 {} L 4 -130 10 130 10 {} L 4 -130 -10 -130 10 {} L 4 130 -10 130 10 {} +T {@symname} -67.5 -6 0 0 0.3 0.3 {} +T {@name} 135 -22 0 0 0.2 0.2 {}