From 4bb321af684f1b9f432ee583834eb361a2266c0d Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 2 Nov 2022 00:47:59 +0100 Subject: [PATCH] add @path attribute for spice/verilog/vhdl/tedax backends --- doc/xschem_man/graphs.html | 2 +- src/token.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/xschem_man/graphs.html b/doc/xschem_man/graphs.html index c5e63bb7..9c10b21d 100644 --- a/doc/xschem_man/graphs.html +++ b/doc/xschem_man/graphs.html @@ -185,7 +185,7 @@ p{padding: 15px 30px 10px;}
  • log10() Base 10 logarithm
  • db20() Value in deciBel (20 * log10(n))
  • avg() Average
  • -
  • prev() Delete waveform by one point (at any x-axis position take the previous value)
  • +
  • prev() Delay waveform by one point (at any x-axis position take the previous value)
  • deriv() Derivative w.r.t. graph sweep variable
  • deriv0() Derivative w.r.t. simulation (index 0) sweep variable
  • integ() Integration
  • diff --git a/src/token.c b/src/token.c index c2503653..599ec27d 100644 --- a/src/token.c +++ b/src/token.c @@ -768,6 +768,10 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 } else fprintf(fd, "%s", value); } + else if(strcmp(token,"@path")==0) + { + fprintf( fd, "%s",xctx->sch_path[xctx->currsch] + 1); + } else if(strcmp(token,"@symname")==0) /* of course symname must not be present */ /* in hash table */ { @@ -1755,6 +1759,15 @@ int print_spice_element(FILE *fd, int inst) /* fputs(value,fd); */ } } + else if (strcmp(token,"@path")==0) /* of course symname must not be present in attributes */ + { + const char *s = xctx->sch_path[xctx->currsch] + 1; + tmp = strlen(s) +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", s); + /* fputs(s,fd); */ + } else if (strcmp(token,"@symname")==0) /* of course symname must not be present in attributes */ { const char *s = skip_dir(xctx->inst[inst].name); @@ -2117,6 +2130,10 @@ void print_tedax_element(FILE *fd, int inst) { fputs(value,fd); } + else if(strcmp(token,"@path")==0) + { + fputs(xctx->sch_path[xctx->currsch] + 1, fd); + } else if(strcmp(token,"@symname")==0) /* of course symname must not be present */ /* in hash table */ { @@ -2345,6 +2362,10 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level } else fprintf(fd, "%s", value); } + else if(strcmp(token,"@path")==0) + { + fputs(xctx->sch_path[xctx->currsch] + 1, fd); + } else if(strcmp(token,"@symname")==0) /* of course symname must not be present */ /* in hash table */ {