recursively resolve parameter passing throughout hierarchy and show resolved value in leaf cells if possible
This commit is contained in:
parent
00de54c582
commit
069017e07c
|
|
@ -96,3 +96,37 @@ INSTRUCTIONS TO ADD XSCHEM TO VISUAL STUDIO 2019
|
|||
4. running from Visual Studio 2019
|
||||
|
||||
F5
|
||||
|
||||
INSTRUCTIONS TO COMPILE CAIRO AND COMPILE XSCHEM WITH IT ON VISUAL STUDIO 2019
|
||||
|
||||
1. Create a cairo_win directory in XSchemWin
|
||||
2. cd cairo_win and git clone from "https://github.com/gleb-t/Cairo-VS" (inside the newly cairo_win directory, use command "git clone https://github.com/gleb-t/Cairo-VS .")
|
||||
Note: Latest source can be downloaded from the following (or alternatively, you can use packed-lib-source.zip provided by gleb-t):
|
||||
a. cairo: https://www.cairographics.org/releases/ (e.g. cairo-1.16.0.tar.xz)
|
||||
b. freetype: https://github.com/freetype/freetype
|
||||
c. libpng: http://www.libpng.org/pub/png/libpng.html (e.g., libpng-1.6.37.tar.gz)
|
||||
d. pixman: https://www.cairographics.org/releases/ (e.g., pixman-0.40.0.tar.gz)
|
||||
e. zlib: https://zlib.net/ (e.g., zlib-1.2.11.tar.gz)
|
||||
Put each source content into the appropriate subdirectory in cairo_win directory.
|
||||
For example, in cairo_win/cairo folder, you should have the following folders: boilerplate, build, doc, perf, src, test, util, ...
|
||||
3. Compile freetype (x64, release_static) library in freetype directory:
|
||||
a. Open builds/windows/vc2010/freetype.sln in VS2019
|
||||
b. Select Release_static; x64 and build solution (library file is created in freetype\objs\x64\Release Static\freetype.lib)
|
||||
c. create a libs folder in cairo_win, and make a copy of Release_Static\freetype.lib into this lib folder
|
||||
4. Compile cairo: Open VS 2019 solution in projects/cairo.sln
|
||||
a. Change to Release, x64 build
|
||||
b. Change cairo > Properties > Librarian > General > freetype271.lib to freetype.lib (Optional: Also do this for Debug,x64 build if needed)
|
||||
c. Edit cairo > Header Files > cairo-features.h by adding the following line "#define CAIRO_HAS_XLIB_SURFACE 1" at the end
|
||||
d. Build solution (If VS2019 complaint about missing freetype.lib, redo step (3c) by copying the file over again)
|
||||
e. cairo.lib and pixman.lib are in cairo_win/projects/x64/Release
|
||||
5. Setup xschem VS 2019 to compile with cairo library
|
||||
a. Uncomment "#define HAS_CAIRO 1" and "#define CAIRO_WIN32_STATIC_BUILD" in config.h
|
||||
Note: Step b and onward is updated in XSchemWin_cairo.vcxproj
|
||||
For Release, x64
|
||||
* Properties > VC++ Directories > Include: ;cairo_win\cairo\src;cairo_win\projects\cairo\src;
|
||||
Libraries: ;cairo_win\projects\x64\Release;cairo_win\libs
|
||||
* Properties > Linker > Input > Additional Dependencies: Add ;cairo.lib;pixman.lib;zlib.lib;libpng.lib;freetype.lib;
|
||||
For Debug, x64
|
||||
* Properties > VC++ Directories > Include: ;cairo_win\cairo\src;cairo_win\projects\cairo\src;
|
||||
Libraries: ;cairo_win\projects\x64\Debug;cairo_win\libs
|
||||
* Properties > Linker > Input > Additional Dependencies: Add ;cairo.lib;pixman.lib;zlibd.lib;libpngd.lib;freetype.lib;
|
||||
|
|
@ -1270,7 +1270,8 @@ void descend_schematic(int instnumber)
|
|||
}
|
||||
my_strdup(14, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
|
||||
xctx->sch_path_hash[xctx->currsch+1] =0;
|
||||
|
||||
my_strdup(1516, &xctx->hier_attr[xctx->currsch].prop_ptr,
|
||||
xctx->inst[xctx->sel_array[0].n].prop_ptr);
|
||||
inst_number = 1;
|
||||
if(inst_mult > 1) { /* on multiple instances ask where to descend, to correctly evaluate
|
||||
the hierarchy path you descend to */
|
||||
|
|
|
|||
|
|
@ -3213,6 +3213,10 @@ void descend_symbol(void)
|
|||
my_strcat(365, &xctx->sch_path[xctx->currsch+1], str);
|
||||
my_strcat(366, &xctx->sch_path[xctx->currsch+1], ".");
|
||||
xctx->sch_path_hash[xctx->currsch+1] = 0;
|
||||
|
||||
my_strdup(1518, &xctx->hier_attr[xctx->currsch].prop_ptr,
|
||||
xctx->inst[xctx->sel_array[0].n].prop_ptr);
|
||||
|
||||
xctx->sch_inst_number[xctx->currsch+1] = 1;
|
||||
my_free(921, &str);
|
||||
xctx->previous_instance[xctx->currsch]=xctx->sel_array[0].n;
|
||||
|
|
|
|||
40
src/token.c
40
src/token.c
|
|
@ -2771,6 +2771,10 @@ const char *translate(int inst, const char* s)
|
|||
char *sch = NULL;
|
||||
int sp_prefix;
|
||||
int s_pnetname;
|
||||
int level;
|
||||
Lcc *lcc;
|
||||
char *value1 = NULL, *value2 = NULL;
|
||||
|
||||
|
||||
s_pnetname = tclgetboolvar("show_pin_net_names");
|
||||
sp_prefix = tclgetboolvar("spiceprefix");
|
||||
|
|
@ -2779,6 +2783,8 @@ const char *translate(int inst, const char* s)
|
|||
return empty;
|
||||
}
|
||||
|
||||
level = xctx->currsch;
|
||||
lcc = xctx->hier_attr;
|
||||
size=CADCHUNKALLOC;
|
||||
my_realloc(527, &result,size);
|
||||
result[0]='\0';
|
||||
|
|
@ -3014,10 +3020,27 @@ const char *translate(int inst, const char* s)
|
|||
result_pos+=tmp;
|
||||
}
|
||||
} else {
|
||||
tmp=strlen(value);
|
||||
int i = level;
|
||||
my_strdup2(1521, &value1, value);
|
||||
/* recursive substitution of value using parent level prop_str attributes */
|
||||
while(i > 0) {
|
||||
my_strdup2(1522, &value2, get_tok_value(lcc[i-1].prop_ptr, value1, 0));
|
||||
if(xctx->tok_size && value2[0]) {
|
||||
dbg(1, "value2=%s\n", value2);
|
||||
my_strdup2(1523, &value1, value2);
|
||||
}
|
||||
dbg(1, "2 translate(): lcc[%d].prop_ptr=%s, value1=%s\n", i-1, lcc[i-1].prop_ptr, value1);
|
||||
i--;
|
||||
}
|
||||
|
||||
|
||||
tmp=strlen(value1);
|
||||
STR_ALLOC(&result, tmp + result_pos, &size);
|
||||
memcpy(result+result_pos, value, tmp+1);
|
||||
memcpy(result+result_pos, value1, tmp+1);
|
||||
result_pos+=tmp;
|
||||
my_free(1524, &value1);
|
||||
my_free(1525, &value2);
|
||||
|
||||
}
|
||||
}
|
||||
token_pos = 0;
|
||||
|
|
@ -3060,8 +3083,9 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
|||
return empty;
|
||||
}
|
||||
size = CADCHUNKALLOC;
|
||||
my_realloc(661, &result, size);
|
||||
my_realloc(1528, &result, size);
|
||||
result[0] = '\0';
|
||||
dbg(1, "translate2(): s=%s\n", s);
|
||||
while (1) {
|
||||
c = *s++;
|
||||
if (c == '\\') {
|
||||
|
|
@ -3083,6 +3107,7 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
|||
token[token_pos] = '\0';
|
||||
token_pos = 0;
|
||||
|
||||
dbg(1, "translate2(): lcc[%d].prop_ptr=%s\n", level, lcc[level].prop_ptr);
|
||||
/* if spiceprefix==0 and token == @spiceprefix then set empty value */
|
||||
if(!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) {
|
||||
my_free(1069, &value1);
|
||||
|
|
@ -3098,6 +3123,7 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
|||
while(i > 1) {
|
||||
save_tok_size = xctx->tok_size;
|
||||
my_strdup2(440, &value2, get_tok_value(lcc[i-1].prop_ptr, value, 0));
|
||||
dbg(1, "translate2(): lcc[%d].prop_ptr=%s\n", i-1, lcc[i-1].prop_ptr);
|
||||
if(xctx->tok_size && value2[0]) {
|
||||
value = value2;
|
||||
} else {
|
||||
|
|
@ -3141,8 +3167,10 @@ const char *translate2(Lcc *lcc, int level, char* s)
|
|||
break;
|
||||
}
|
||||
}
|
||||
my_free(1070, &token);
|
||||
my_free(1071, &value1);
|
||||
my_free(1072, &value2);
|
||||
my_free(1532, &token);
|
||||
my_free(1533, &value1);
|
||||
my_free(1071, &value2);
|
||||
dbg(1, "translate2(): result=%s\n", result);
|
||||
return tcl_hook2(&result);
|
||||
}
|
||||
|
||||
|
|
|
|||
10
src/xinit.c
10
src/xinit.c
|
|
@ -358,7 +358,12 @@ static void free_xschem_data()
|
|||
my_free(1132, &xctx->maxa);
|
||||
my_free(1133, &xctx->maxl);
|
||||
my_free(1108, &xctx->sel_array);
|
||||
for(i=0;i<CADMAXHIER;i++) my_free(1139, &xctx->sch_path[i]);
|
||||
for(i=0;i<CADMAXHIER;i++) {
|
||||
my_free(1139, &xctx->sch_path[i]);
|
||||
my_free(959, &xctx->hier_attr[i].prop_ptr);
|
||||
my_free(960, &xctx->hier_attr[i].symname);
|
||||
}
|
||||
|
||||
my_free(1099, &xctx->gridpoint);
|
||||
my_free(1214, &xctx->biggridpoint);
|
||||
my_free(1135, &xctx->gc);
|
||||
|
|
@ -529,6 +534,9 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
|
|||
for(i=0;i<CADMAXHIER;i++) {
|
||||
xctx->sch_path[i]=NULL;
|
||||
xctx->sch_path_hash[i]=0;
|
||||
xctx->hier_attr[i].prop_ptr = NULL;
|
||||
xctx->hier_attr[i].symname = NULL;
|
||||
xctx->hier_attr[i].fd = NULL;
|
||||
}
|
||||
my_strdup(1187, &xctx->sch_path[0],".");
|
||||
xctx->sch_inst_number[0] = 1;
|
||||
|
|
|
|||
|
|
@ -944,6 +944,7 @@ typedef struct {
|
|||
void (*clear_undo)(void);
|
||||
int case_insensitive; /* for case insensitive compare where needed */
|
||||
int (*x_strcmp)(const char *, const char *);
|
||||
Lcc hier_attr[CADMAXHIER]; /* hierarchical recursive attribute substitution when descending */
|
||||
} Xschem_ctx;
|
||||
|
||||
/* GLOBAL VARIABLES */
|
||||
|
|
|
|||
|
|
@ -351,6 +351,14 @@ proc sframe {container} {
|
|||
}
|
||||
#### /Scrollable frame
|
||||
|
||||
## evaluate expression. if expression has errors or does not evaluate return expression as is
|
||||
proc ev {s} {
|
||||
if {![catch {expr $s} res]} {
|
||||
return [format %.4g $res]
|
||||
} else {
|
||||
return $s
|
||||
}
|
||||
}
|
||||
proc netlist {source_file show netlist_file} {
|
||||
global XSCHEM_SHAREDIR flat_netlist hspice_netlist netlist_dir
|
||||
global verilog_2001 debug_var OS
|
||||
|
|
|
|||
Loading…
Reference in New Issue