draw_graph_points() split big XDrawLines requests into smaller chunks to handle raw files with > 4M points

This commit is contained in:
stefan schippers 2023-04-14 15:41:00 +02:00
parent a8ba903aaa
commit ff9f92646c
7 changed files with 28 additions and 15 deletions

View File

@ -21,11 +21,11 @@ p{padding: 15px 30px 10px;}
<p>
It is quite common to have in a design multiple instances of the same subcircuit.
Think for example of memory arrays and decoder circuits.
In some cases there are numerous instances of the same identical circuit. This lead so a very
In some cases there are numerous instances of the same identical circuit. This leads to a very
large netlist and heavy simulation loads (both in time and space).<br>
On the other hand typically only a small portion of these repetitive circuits are exercised in
simulation. For example you might want to simulate the selection of the first 2 Wordlines in
a 1024 wordlines memory array.
simulation. For example you might want to simulate the selection only of the first 2 wordlines
and the last 2 wordlines in a 1024 wordlines memory array.
</p>
<p>
In these situations it might be useful to keep the full subcircuit implementation for the circuit parts
@ -71,7 +71,7 @@ p{padding: 15px 30px 10px;}
The definition is provided as text (a piece of netlist, like for example a parasitic spice netlist extraction).
</p>
<p>
Putting this all together here is a schematic with 3 instances of <kbd>comp_65nm.sch</kbd>.
Putting this all together here is a schematic with 3 instances of <kbd>comp_65nm.sym</kbd>.
</p>
<ul>
<li><kbd>x1</kbd> is the standard instance using the default <kbd>comp_65nm.sch</kbd></li>

View File

@ -2078,7 +2078,7 @@ static void draw_graph_bus_points(const char *ntok, int n_bits, SPICE_DATA **idx
set_thick_waves(0, wcnt, wave_col, gr);
}
}
#define MAX_POLY_POINTS 4096*16
/* wcnt is the nth wave in graph, idx is the index in spice raw file */
static void draw_graph_points(int idx, int first, int last,
XPoint *point, int wave_col, int wcnt, int n_nodes, Graph_ctx *gr, void *ct)
@ -2102,6 +2102,7 @@ static void draw_graph_points(int idx, int first, int last,
c1 = c + gr->gh * 0.5 * s2; /* trace y-center, used for clipping */
}
if( !digital || (c1 >= gr->ypos1 && c1 <= gr->ypos2) ) {
int x;
for(p = first ; p <= last; p++) {
yy = gv[p];
if(digital) {
@ -2116,11 +2117,23 @@ static void draw_graph_points(int idx, int first, int last,
poly_npoints++;
}
set_thick_waves(1, wcnt, wave_col, gr);
if(xctx->draw_window) {
XDrawLines(display, xctx->window, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
}
if(xctx->draw_pixmap) {
XDrawLines(display, xctx->save_pixmap, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);
for(x = 0; x < 2; x++) {
Drawable w;
int offset = 0, size;
XPoint *pt = point;
if(x == 0 && xctx->draw_window) w = xctx->window;
else if(x == 1 && xctx->draw_pixmap) w = xctx->save_pixmap;
else continue;
while(1) {
pt = point + offset;
size = poly_npoints - offset;
if(size > MAX_POLY_POINTS) size = MAX_POLY_POINTS;
/* dbg(0, "draw_graph_points(): drawing from %d, size %d\n", offset, size);*/
XDrawLines(display, w, xctx->gc[wave_col], pt, size, CoordModeOrigin);
if(offset + size >= poly_npoints) break;
offset += MAX_POLY_POINTS -1; /* repeat last point on next iteration */
}
/*XDrawLines(display, xctx->window, xctx->gc[wave_col], point, poly_npoints, CoordModeOrigin);*/
}
#if !defined(__unix__) && HAS_CAIRO==1
check_cairo_drawpoints(ct, wave_col, point, poly_npoints);

View File

@ -409,7 +409,7 @@ int global_spice_netlist(int global) /* netlister driver */
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));

View File

@ -210,7 +210,7 @@ int global_tedax_netlist(int global) /* netlister driver */
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));

View File

@ -358,7 +358,7 @@ int global_verilog_netlist(int global) /* netlister driver */
if(!xctx->sym[i].type) continue;
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) {
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));

View File

@ -458,7 +458,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{
tclvareval("get_directory ", xctx->sch[xctx->currsch - 1], NULL);
tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0));

View File

@ -1476,7 +1476,7 @@ proc simulate {{callback {}}} {
}
#eval exec {cmd /V /C "cd $netlist_dir&&$cmd}
eval exec $cmd &
return -1 ;# no execute ID on windows
return 0 # no execute ID on windows
} else {
set execute(callback) $callback
set id [$fg $st sh -c "cd $netlist_dir; $cmd"]