From 881b32a689db50b4198e476c7d84176b5fd015fb Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 19 Jan 2022 02:05:05 +0100 Subject: [PATCH] fix selection of merged instances done b4 calculating bbox (uninit. values) --- src/save.c | 2 +- src/store.c | 17 +++++++++++++++++ src/xschem.h | 12 ++++++------ tests/xschemtest.tcl | 2 +- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/save.c b/src/save.c index d8bf4e15..22d63ec2 100644 --- a/src/save.c +++ b/src/save.c @@ -1048,7 +1048,6 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas xctx->inst[i].ptr = match_symbol(xctx->inst[i].name); } for(i = from; i < xctx->instances; i++) { - if(merge) select_element(i,SELECTED,1, 0); /* leave elements selected if a paste/copy from windows is done */ type=xctx->sym[xctx->inst[i].ptr].type; cond= !type || !IS_LABEL_SH_OR_PIN(type); if(cond) xctx->inst[i].flags|=2; /* ordinary symbol */ @@ -1061,6 +1060,7 @@ void link_symbols_to_instances(int from) /* from >= 0 : linking symbols from pas * needs .lab field set above, so this must be done last */ for(i = from; i < xctx->instances; i++) { symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); + if(merge) select_element(i,SELECTED,1, 0); /* leave elements selected if a paste/copy from windows is done */ } } diff --git a/src/store.c b/src/store.c index b10afd13..62c4f7f8 100644 --- a/src/store.c +++ b/src/store.c @@ -102,12 +102,17 @@ void check_symbol_storage(void) } +#undef ZERO_REALLOC + void check_inst_storage(void) { if(xctx->instances >= xctx->maxi) { xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST; my_realloc(402, &xctx->inst, sizeof(xInstance)*xctx->maxi); + #ifdef ZERO_REALLOC + memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances)); + #endif } } @@ -117,6 +122,9 @@ void check_arc_storage(int c) { xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS; my_realloc(403, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]); + #ifdef ZERO_REALLOC + memset(xctx->arc[c] + xctx->arcs[c], 0, sizeof(xArc) * (xctx->maxa[c] - xctx->arcs[c])); + #endif } } @@ -126,6 +134,9 @@ void check_box_storage(int c) { xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS; my_realloc(404, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]); + #ifdef ZERO_REALLOC + memset(xctx->rect[c] + xctx->rects[c], 0, sizeof(xRect) * (xctx->maxr[c] - xctx->rects[c])); + #endif } } @@ -135,6 +146,9 @@ void check_line_storage(int c) { xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS; my_realloc(405, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]); + #ifdef ZERO_REALLOC + memset(xctx->line[c] + xctx->lines[c], 0, sizeof(xLine) * (xctx->maxl[c] - xctx->lines[c])); + #endif } } @@ -144,6 +158,9 @@ void check_polygon_storage(int c) { xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS; my_realloc(406, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]); + #ifdef ZERO_REALLOC + memset(xctx->poly[c] + xctx->polygons[c], 0, sizeof(xPoly) * (xctx->maxp[c] - xctx->polygons[c])); + #endif } } diff --git a/src/xschem.h b/src/xschem.h index af91257b..7c5b79b9 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -142,12 +142,12 @@ extern char win_temp_dir[PATH_MAX]; #define CADHALFDOTSIZE 4 #define CADNULLNODE -1 /* no valid node number */ #define CADWIREMINDIST 8.0 -#define CADMAXWIRES 4096 -#define CADMAXTEXT 2048 -#define CADMAXOBJECTS 512 /* (initial) max # of lines, rects (for each layer!!) */ -#define MAXGROUP 300 /* (initial) max # of objects that can be drawn while moving */ -#define ELEMINST 4096 /* (initial) max # of placed elements, was 600 20102004 */ -#define ELEMDEF 256 /* (initial) max # of defined elements */ +#define CADMAXWIRES 200 +#define CADMAXTEXT 100 +#define CADMAXOBJECTS 100 /* (initial) max # of lines, rects (for each layer!!) */ +#define MAXGROUP 100 /* (initial) max # of objects that can be drawn while moving */ +#define ELEMINST 100 /* (initial) max # of placed elements, was 600 20102004 */ +#define ELEMDEF 50 /* (initial) max # of defined elements */ #define EMBEDDED 1 /* used for embedded symbols marking in Symbol.flags */ #define HILIGHT_CONN 4 /* used to hilight instances if connected wire is hilighted */ #define CADMAXGRIDPOINTS 512 diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl index c36d5a45..0d31b202 100644 --- a/tests/xschemtest.tcl +++ b/tests/xschemtest.tcl @@ -186,7 +186,7 @@ proc test_xschem_simulation {{f simulate_ff.sch}} { proc netlist_test {} { global netlist_dir foreach {f t h} { - rom8k.sch spice 2880502233 + rom8k.sch spice 2289841821 greycnt.sch verilog 3391559642 autozero_comp.sch spice 2011673313 loading.sch vhdl 2601437773