code refactoring (global context in Xschem_ctx), "New Schematic" or "New Symbol" will set netlist_type to "spice" or "symbol" respectively
This commit is contained in:
parent
32f85ac4f4
commit
64c0abc58e
886
src/actions.c
886
src/actions.c
File diff suppressed because it is too large
Load Diff
290
src/callback.c
290
src/callback.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: callback.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "xschem.h"
|
||||
static int mx_save, my_save;
|
||||
static int last_command=0;
|
||||
static int last_command=0;
|
||||
|
||||
void start_line(double mx, double my)
|
||||
{
|
||||
|
|
@ -33,13 +33,13 @@ void start_line(double mx, double my)
|
|||
mx_double_save=mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my; /* 20070323 */
|
||||
my_save = my;
|
||||
my_double_save=mousey_snap;
|
||||
}
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
} else {
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
}
|
||||
|
|
@ -55,13 +55,13 @@ void start_wire(double mx, double my)
|
|||
mx_double_save=mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my; /* 20070323 */
|
||||
my_save = my;
|
||||
my_double_save=mousey_snap;
|
||||
}
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
} else {
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
}
|
||||
|
|
@ -70,8 +70,8 @@ void start_wire(double mx, double my)
|
|||
}
|
||||
/* main window callback */
|
||||
/* mx and my are set to the mouse coord. relative to window */
|
||||
int callback(int event, int mx, int my, KeySym key,
|
||||
int button, int aux, int state)
|
||||
int callback(int event, int mx, int my, KeySym key,
|
||||
int button, int aux, int state)
|
||||
{
|
||||
char str[PATH_MAX];/* overflow safe 20161122 */
|
||||
static char sel_or_clip[PATH_MAX] = "";/* overflow safe 20161122 */
|
||||
|
|
@ -125,35 +125,35 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
state &=~Mod2Mask; /* 20170511 filter out NumLock status */
|
||||
if(semaphore)
|
||||
{
|
||||
if(debug_var>=2)
|
||||
if(debug_var>=2)
|
||||
if(event != MotionNotify) fprintf(errfp, "callback(): reentrant call of callback(), semaphore=%d\n", semaphore);
|
||||
/* if(event==Expose) {
|
||||
* XCopyArea(display, save_pixmap, window, gctiled, mx,my,button,aux,mx,my);
|
||||
*
|
||||
*
|
||||
* }
|
||||
*/
|
||||
/* return 0; */
|
||||
}
|
||||
semaphore++; /* used to debug Tcl-Tk frontend */
|
||||
mousex=X_TO_XSCHEM(mx);
|
||||
mousey=Y_TO_XSCHEM(my);
|
||||
mousey=Y_TO_XSCHEM(my);
|
||||
mousex_snap=ROUND(mousex / cadsnap) * cadsnap;
|
||||
mousey_snap=ROUND(mousey / cadsnap) * cadsnap;
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
mousex_snap, mousey_snap, lastselected, sch_path[currentsch] );
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
mousex_snap, mousey_snap, lastselected, xctx.sch_path[xctx.currsch] );
|
||||
statusmsg(str,1);
|
||||
switch(event)
|
||||
{
|
||||
case EnterNotify:
|
||||
if(!sel_or_clip[0]) my_snprintf(sel_or_clip, S(sel_or_clip), "%s/%s", user_conf_dir, ".selection.sch");
|
||||
|
||||
/* xschem window *sending* selected objects
|
||||
when the pointer comes back in abort copy operation since it has been done
|
||||
/* xschem window *sending* selected objects
|
||||
when the pointer comes back in abort copy operation since it has been done
|
||||
in another xschem window; STARTCOPY set and selection file does not exist any more */
|
||||
if( stat(sel_or_clip, &buf) && (ui_state & STARTCOPY) )
|
||||
if( stat(sel_or_clip, &buf) && (ui_state & STARTCOPY) )
|
||||
{
|
||||
copy_objects(ABORT); /* also unlinks sel_or_flip file */
|
||||
unselect_all();
|
||||
unselect_all();
|
||||
}
|
||||
/* xschem window *receiving* selected objects */
|
||||
/* no selected objects and selection file exists */
|
||||
|
|
@ -204,10 +204,10 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
/* *NOT* a solution but at least makes the program useable. 20171130 */
|
||||
XSetClipRectangles(display, gctiled, 0,0, xrect, 1, Unsorted);
|
||||
#endif
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d w=%.16g h=%.16g",
|
||||
mousex_snap, mousey_snap,
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d w=%.16g h=%.16g",
|
||||
mousex_snap, mousey_snap,
|
||||
lastselected ,
|
||||
mousex_snap-mx_double_save, mousey_snap-my_double_save /* 20070322 */
|
||||
mousex_snap-mx_double_save, mousey_snap-my_double_save
|
||||
);
|
||||
statusmsg(str,1);
|
||||
}
|
||||
|
|
@ -221,27 +221,27 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
}
|
||||
if(ui_state & STARTWIRE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_wire(RUBBER, mousex_snap, mousey_snap);
|
||||
}
|
||||
if(ui_state & STARTARC) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_arc(RUBBER, 0);
|
||||
}
|
||||
if(ui_state & STARTLINE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_line(RUBBER);
|
||||
}
|
||||
if(ui_state & STARTMOVE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
move_objects(RUBBER,0,0,0);
|
||||
}
|
||||
if(ui_state & STARTCOPY) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
copy_objects(RUBBER);
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(ui_state & STARTPOLYGON) {
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_polygon(RUBBER); /* 20171115 */
|
||||
new_polygon(RUBBER);
|
||||
}
|
||||
if(!(ui_state & STARTPOLYGON) && (state&Button1Mask) && !(ui_state & STARTWIRE) && !(ui_state & STARTPAN2) &&
|
||||
!(state & Mod1Mask) && !(state & ShiftMask) && !(ui_state & PLACE_SYMBOL)) /* start of a mouse area select */
|
||||
|
|
@ -282,15 +282,15 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
select_rect(BEGIN,1);
|
||||
}
|
||||
if(abs(mx-mx_save) > 8 || abs(my-my_save) > 8 ) { /* set some reasonable threshold before unselecting */
|
||||
select_object(X_TO_XSCHEM(mx_save), Y_TO_XSCHEM(my_save), 0, 0); /* 20121130 remove near object if dragging */
|
||||
select_object(X_TO_XSCHEM(mx_save), Y_TO_XSCHEM(my_save), 0, 0); /* remove near object if dragging */
|
||||
rebuild_selected_array();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KeyRelease: /* 20161118 */
|
||||
case KeyRelease:
|
||||
break;
|
||||
case KeyPress: /* 20161118 */
|
||||
case KeyPress:
|
||||
if(key==' ') {
|
||||
if(ui_state & STARTWIRE) { /* & instead of == 20190409 */
|
||||
new_wire(RUBBER|CLEAR, mousex_snap, mousey_snap);
|
||||
|
|
@ -304,7 +304,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
manhattan_lines %=3;
|
||||
new_line(RUBBER);
|
||||
} else {
|
||||
if(semaphore<2) { /* 20160425 */
|
||||
if(semaphore<2) {
|
||||
rebuild_selected_array();
|
||||
if(lastselected==0) ui_state &=~SELECTION;
|
||||
}
|
||||
|
|
@ -399,12 +399,12 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
tcleval("xschem set horizontal_move");
|
||||
}
|
||||
if(ui_state & STARTWIRE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_wire(RUBBER, mousex_snap, mousey_snap);
|
||||
}
|
||||
if(ui_state & STARTLINE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_line(RUBBER);
|
||||
}
|
||||
|
|
@ -423,12 +423,12 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
tcleval("xschem set vertical_move");
|
||||
}
|
||||
if(ui_state & STARTWIRE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_wire(RUBBER, mousex_snap, mousey_snap);
|
||||
}
|
||||
if(ui_state & STARTLINE) {
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_line(RUBBER);
|
||||
}
|
||||
|
|
@ -477,12 +477,12 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
else if(fill==2) {
|
||||
tcleval("alert_ { solid pattern fill} {}");
|
||||
for(x=0;x<cadlayers;x++)
|
||||
for(x=0;x<cadlayers;x++)
|
||||
XSetFillStyle(display,gcstipple[x],FillSolid);
|
||||
}
|
||||
else {
|
||||
tcleval("alert_ { No pattern fill} {}");
|
||||
for(x=0;x<cadlayers;x++)
|
||||
for(x=0;x<cadlayers;x++)
|
||||
XSetFillStyle(display,gcstipple[x],FillStippled);
|
||||
}
|
||||
|
||||
|
|
@ -496,7 +496,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
draw();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(key == '-' && state&ControlMask) /* change line width */
|
||||
{
|
||||
lw_double-=0.1;if(lw_double<0.0) lw_double=0.0;
|
||||
|
|
@ -506,43 +506,43 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key == 'X' && state == ShiftMask) /* highlight discrepanciens between selected instance pin and net names */
|
||||
{
|
||||
/* 20130628 */
|
||||
|
||||
|
||||
int i,j,k;
|
||||
Instdef *symbol;
|
||||
xSymbol *symbol;
|
||||
int npin;
|
||||
char *type=NULL;
|
||||
char *labname=NULL;
|
||||
char *lab=NULL;
|
||||
char *netname=NULL;
|
||||
int mult;
|
||||
Box *rect;
|
||||
xRect *rct;
|
||||
|
||||
rebuild_selected_array();
|
||||
prepare_netlist_structs(0);
|
||||
for(k=0; k<lastselected; k++) {
|
||||
if(selectedgroup[k].type!=ELEMENT) continue;
|
||||
j = selectedgroup[k].n ;
|
||||
/* my_strdup(22, &type,get_tok_value((inst_ptr[j].ptr+instdef)->prop_ptr,"type",0)); */
|
||||
my_strdup(23, &type,(inst_ptr[j].ptr+instdef)->type); /* 20150409 */
|
||||
/* my_strdup(22, &type,get_tok_value((xctx.inst[j].ptr+ xctx.sym)->prop_ptr,"type",0)); */
|
||||
my_strdup(23, &type,(xctx.inst[j].ptr+ xctx.sym)->type);
|
||||
if( type && IS_LABEL_SH_OR_PIN(type)) break;
|
||||
symbol = instdef + inst_ptr[j].ptr;
|
||||
symbol = xctx.sym + xctx.inst[j].ptr;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rect=symbol->boxptr[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
dbg(1, "\n");
|
||||
for(i=0;i<npin;i++) {
|
||||
my_strdup(24, &labname,get_tok_value(rect[i].prop_ptr,"name",0));
|
||||
my_strdup(24, &labname,get_tok_value(rct[i].prop_ptr,"name",0));
|
||||
my_strdup(25, &lab, expandlabel(labname, &mult));
|
||||
my_strdup(26, &netname, net_name(j,i,&mult, 0));
|
||||
dbg(1, "i=%d labname=%s explabname = %s net = %s\n", i, labname, lab, netname);
|
||||
if(netname && strcmp(lab, netname)) {
|
||||
if(netname && strcmp(lab, netname)) {
|
||||
dbg(1, "hilight: %s\n", netname);
|
||||
bus_hilight_lookup(netname, hilight_color, XINSERT);
|
||||
if(incr_hilight) hilight_color++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
my_free(713, &type);
|
||||
my_free(714, &labname);
|
||||
my_free(715, &lab);
|
||||
|
|
@ -561,7 +561,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
find_closest_net_or_symbol_pin(mousex, mousey, &x, &y);
|
||||
xx = X_TO_SCREEN(x);
|
||||
yy = Y_TO_SCREEN(y);
|
||||
mx_save = xx; my_save = yy; /* 20070323 */
|
||||
mx_save = xx; my_save = yy;
|
||||
mx_double_save = ROUND(x / cadsnap) * cadsnap;
|
||||
my_double_save = ROUND(y / cadsnap) * cadsnap;
|
||||
new_wire(PLACE, x, y);
|
||||
|
|
@ -570,7 +570,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
find_closest_net_or_symbol_pin(mousex, mousey, &x, &y);
|
||||
new_wire(RUBBER, x, y);
|
||||
new_wire(PLACE|END, x, y);
|
||||
horizontal_move = vertical_move=0; /* 20171023 */
|
||||
horizontal_move = vertical_move=0;
|
||||
tcleval("set vertical_move 0; set horizontal_move 0" );
|
||||
}
|
||||
break;
|
||||
|
|
@ -578,7 +578,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key == 'w'&& state==0) /* place wire. */
|
||||
{
|
||||
if(semaphore >= 2) break;
|
||||
start_wire(mx, my);
|
||||
start_wire(mx, my);
|
||||
break;
|
||||
}
|
||||
if(key == XK_Return && (state == 0 ) && ui_state & STARTPOLYGON) { /* close polygon */
|
||||
|
|
@ -592,7 +592,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
tcleval("set vertical_move 0; set horizontal_move 0" );
|
||||
last_command=0;
|
||||
manhattan_lines = 0;
|
||||
horizontal_move = vertical_move = 0; /* 20171023 */
|
||||
horizontal_move = vertical_move = 0;
|
||||
dbg(1, "callback(): Escape: ui_state=%ld\n", ui_state);
|
||||
if(ui_state & STARTMOVE)
|
||||
{
|
||||
|
|
@ -612,9 +612,9 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
delete();
|
||||
set_modify(0); /* aborted merge: no change, so reset modify flag set by delete() */
|
||||
}
|
||||
|
||||
|
||||
ui_state = 0;
|
||||
unselect_all();
|
||||
unselect_all();
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -630,7 +630,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='p' && state == Mod1Mask) /* add symbol pin */
|
||||
{
|
||||
unselect_all();
|
||||
storeobject(-1, mousex_snap-2.5, mousey_snap-2.5, mousex_snap+2.5, mousey_snap+2.5,
|
||||
storeobject(-1, mousex_snap-2.5, mousey_snap-2.5, mousex_snap+2.5, mousey_snap+2.5,
|
||||
xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout");
|
||||
need_rebuild_selected_array=1;
|
||||
rebuild_selected_array();
|
||||
|
|
@ -642,7 +642,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
if(semaphore >= 2) break;
|
||||
dbg(1, "callback(): start polygon\n");
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
last_command = 0;
|
||||
|
|
@ -655,7 +655,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='P' && state == ShiftMask) /* pan, other way to. */
|
||||
{
|
||||
xorigin=-mousex_snap+areaw*zoom/2.0;yorigin=-mousey_snap+areah*zoom/2.0;
|
||||
xctx.xorigin=-mousex_snap+areaw*xctx.zoom/2.0;xctx.yorigin=-mousey_snap+areah*xctx.zoom/2.0;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -679,25 +679,25 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key==XK_Right) /* left */
|
||||
{
|
||||
xorigin+=-CADMOVESTEP*zoom;
|
||||
xctx.xorigin+=-CADMOVESTEP*xctx.zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key==XK_Left) /* right */
|
||||
{
|
||||
xorigin-=-CADMOVESTEP*zoom;
|
||||
xctx.xorigin-=-CADMOVESTEP*xctx.zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key==XK_Down) /* down */
|
||||
{
|
||||
yorigin+=-CADMOVESTEP*zoom;
|
||||
xctx.yorigin+=-CADMOVESTEP*xctx.zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key==XK_Up) /* up */
|
||||
{
|
||||
yorigin-=-CADMOVESTEP*zoom;
|
||||
xctx.yorigin-=-CADMOVESTEP*xctx.zoom;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -709,7 +709,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(strcmp(tclresult(),"ok")==0) {
|
||||
tcleval( "exit");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
tcleval( "exit");
|
||||
}
|
||||
|
|
@ -725,7 +725,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='r' && !ui_state && state==0) /* start rect */
|
||||
{
|
||||
dbg(1, "callback(): start rect\n");
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
last_command = 0;
|
||||
|
|
@ -762,7 +762,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
if(semaphore >= 2) break;
|
||||
/* check if unnamed schematic, use saveas in this case */
|
||||
if(!strcmp(schematic[currentsch],"") || strstr(schematic[currentsch], "untitled")) {
|
||||
if(!strcmp(xctx.sch[xctx.currsch],"") || strstr(xctx.sch[xctx.currsch], "untitled")) {
|
||||
saveas(NULL, SCHEMATIC);
|
||||
} else {
|
||||
save(1);
|
||||
|
|
@ -804,11 +804,11 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
|
||||
if(key=='a' && state == 0) /* make symbol */
|
||||
{
|
||||
if(semaphore >= 2) break; /* 20180914 */
|
||||
if(semaphore >= 2) break;
|
||||
tcleval("tk_messageBox -type okcancel -message {do you want to make symbol view ?}");
|
||||
if(strcmp(tclresult(),"ok")==0)
|
||||
if(strcmp(tclresult(),"ok")==0)
|
||||
{
|
||||
save_schematic(schematic[currentsch]);
|
||||
save_schematic(xctx.sch[xctx.currsch]);
|
||||
make_symbol();
|
||||
}
|
||||
break;
|
||||
|
|
@ -821,7 +821,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='y' && state == 0) /* toggle stretching */
|
||||
{
|
||||
enable_stretch=!enable_stretch;
|
||||
|
||||
|
||||
if(enable_stretch) {
|
||||
tcleval("alert_ { enabling stretch mode } {}");
|
||||
tclsetvar("enable_stretch","1");
|
||||
|
|
@ -839,7 +839,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(lastselected) { /* 20071203 check if something selected */
|
||||
save_selection(2);
|
||||
delete();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(key=='c' && state == ControlMask) /* save clipboard */
|
||||
|
|
@ -901,14 +901,14 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(semaphore >= 2) break;
|
||||
rebuild_selected_array();
|
||||
if(lastselected==0 ) {
|
||||
my_snprintf(str, S(str), "edit_file {%s}", abs_sym_path(schematic[currentsch], ""));
|
||||
my_snprintf(str, S(str), "edit_file {%s}", abs_sym_path(xctx.sch[xctx.currsch], ""));
|
||||
tcleval(str);
|
||||
}
|
||||
else if(selectedgroup[0].type==ELEMENT) {
|
||||
my_snprintf(str, S(str), "edit_file {%s}",
|
||||
abs_sym_path(inst_ptr[selectedgroup[0].n].name, ""));
|
||||
my_snprintf(str, S(str), "edit_file {%s}",
|
||||
abs_sym_path(xctx.inst[selectedgroup[0].n].name, ""));
|
||||
tcleval(str);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -928,7 +928,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
last_command = 0;
|
||||
|
||||
/* place_symbol(-1,NULL,mousex_snap, mousey_snap, 0, 0, NULL,3, 1);*/
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save = mousex_snap;
|
||||
my_double_save = mousey_snap;
|
||||
if(place_symbol(-1,NULL,mousex_snap, mousey_snap, 0, 0, NULL, 4, 1) ) {
|
||||
|
|
@ -947,7 +947,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
char filename[PATH_MAX];
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
my_strncpy(filename, abs_sym_path(schematic[currentsch], ""), S(filename));
|
||||
my_strncpy(filename, abs_sym_path(xctx.sch[xctx.currsch], ""), S(filename));
|
||||
load_schematic(1, filename, 1);
|
||||
draw();
|
||||
}
|
||||
|
|
@ -972,7 +972,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='k' && state==ControlMask) /* unhilight net */
|
||||
{
|
||||
Box boundbox;
|
||||
xRect boundbox;
|
||||
if(semaphore >= 2) break;
|
||||
calc_drawing_bbox(&boundbox, 2);
|
||||
|
||||
|
|
@ -1006,7 +1006,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='K' && state == ShiftMask) /* delete hilighted nets */
|
||||
{
|
||||
Box boundbox;
|
||||
xRect boundbox;
|
||||
if(semaphore >= 2) break;
|
||||
enable_drill=0;
|
||||
calc_drawing_bbox(&boundbox, 2);
|
||||
|
|
@ -1034,7 +1034,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='g' && state==ControlMask) /* set snap factor 20161212 */
|
||||
{
|
||||
my_snprintf(str, S(str),
|
||||
"input_line {Enter snap value (default: %.16g current: %.16g)} {xschem set cadsnap} {%g} 10",
|
||||
"input_line {Enter snap value (default: %.16g current: %.16g)} {xschem set cadsnap} {%g} 10",
|
||||
CADSNAP, cadsnap, cadsnap);
|
||||
tcleval(str);
|
||||
break;
|
||||
|
|
@ -1065,14 +1065,14 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='u' && state==Mod1Mask) /* align to grid */
|
||||
{
|
||||
if(semaphore >= 2) break;
|
||||
push_undo(); /* 20150327 */
|
||||
push_undo();
|
||||
round_schematic_to_grid(cadsnap);
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
|
||||
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -1109,13 +1109,13 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='&') /* check wire connectivity */
|
||||
{
|
||||
if(semaphore >= 2) break;
|
||||
push_undo(); /* 20150327 */
|
||||
push_undo();
|
||||
trim_wires();
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key=='l' && state == ControlMask) { /* create schematic from selected symbol 20171004 */
|
||||
|
||||
|
||||
if(semaphore >= 2) break;
|
||||
create_sch_from_sym();
|
||||
break;
|
||||
|
|
@ -1154,7 +1154,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(ui_state & STARTCOPY) copy_objects(FLIP);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
move_objects(BEGIN,0,0,0);
|
||||
|
|
@ -1176,7 +1176,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(ui_state & STARTCOPY) copy_objects(FLIP|ROTATELOCAL);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
move_objects(BEGIN,0,0,0);
|
||||
|
|
@ -1191,7 +1191,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(ui_state & STARTCOPY) copy_objects(ROTATE);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
move_objects(BEGIN,0,0,0);
|
||||
|
|
@ -1208,7 +1208,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
else if(ui_state & STARTCOPY) copy_objects(ROTATE|ROTATELOCAL);
|
||||
else {
|
||||
rebuild_selected_array();
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
move_objects(BEGIN,0,0,0);
|
||||
|
|
@ -1219,18 +1219,18 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if(key=='m' && state==0 && !(ui_state & (STARTMOVE | STARTCOPY)))/* move selected obj. */
|
||||
{
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
move_objects(BEGIN,0,0,0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(key=='c' && state==0 && /* copy selected obj. */
|
||||
!(ui_state & (STARTMOVE | STARTCOPY)))
|
||||
{
|
||||
if(semaphore >= 2) break;
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
copy_objects(BEGIN);
|
||||
|
|
@ -1250,7 +1250,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
yyparse_error = 0;
|
||||
if(semaphore >= 2) break;
|
||||
unselect_all(); /* 20180929 */
|
||||
unselect_all();
|
||||
if(set_netlist_dir(0, NULL)) {
|
||||
dbg(1, "callback(): -------------\n");
|
||||
if(netlist_type == CAD_SPICE_NETLIST)
|
||||
|
|
@ -1272,7 +1272,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
{
|
||||
yyparse_error = 0;
|
||||
if(semaphore >= 2) break;
|
||||
unselect_all(); /* 20180929 */
|
||||
unselect_all();
|
||||
if( set_netlist_dir(0, NULL) ) {
|
||||
dbg(1, "callback(): -------------\n");
|
||||
if(netlist_type == CAD_SPICE_NETLIST)
|
||||
|
|
@ -1302,15 +1302,15 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
break;
|
||||
}
|
||||
if(key=='>') { /* 20151117 */
|
||||
if(key=='>') {
|
||||
if(semaphore >= 2) break;
|
||||
if(draw_single_layer< cadlayers-1) draw_single_layer++;
|
||||
if(draw_single_layer< cadlayers-1) draw_single_layer++;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
if(key=='<') { /* 20151117 */
|
||||
if(key=='<') {
|
||||
if(semaphore >= 2) break;
|
||||
if(draw_single_layer>=0 ) draw_single_layer--;
|
||||
if(draw_single_layer>=0 ) draw_single_layer--;
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -1345,14 +1345,14 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='B' && state==ShiftMask) /* delete files */
|
||||
{
|
||||
|
||||
if(semaphore >= 2) break; /* 20160423 */
|
||||
if(semaphore >= 2) break;
|
||||
rebuild_selected_array();
|
||||
if(lastselected && selectedgroup[0].type==ELEMENT) {
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(inst_ptr[selectedgroup[0].n].name, ""));
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(xctx.inst[selectedgroup[0].n].name, ""));
|
||||
} else {
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(schematic[currentsch], ""));
|
||||
my_snprintf(str, S(str), "delete_files {%s}",
|
||||
abs_sym_path(xctx.sch[xctx.currsch], ""));
|
||||
}
|
||||
|
||||
tcleval(str);
|
||||
|
|
@ -1361,8 +1361,8 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(key=='x' && state == 0 ) /* new cad session */
|
||||
{
|
||||
char * tmp;
|
||||
tmp = (char *) tclgetvar("XSCHEM_START_WINDOW"); /* 20121110 */
|
||||
if(tmp && tmp[0]) new_window(abs_sym_path(tmp, "") ,0); /* 20090708 */
|
||||
tmp = (char *) tclgetvar("XSCHEM_START_WINDOW");
|
||||
if(tmp && tmp[0]) new_window(abs_sym_path(tmp, "") ,0);
|
||||
else new_window(NULL, 0);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1378,7 +1378,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if( 0 && (key==';') && (state & ControlMask) ) /* testmode: for performance testing */
|
||||
{
|
||||
draw_stuff();
|
||||
draw_stuff();
|
||||
draw();
|
||||
break;
|
||||
}
|
||||
|
|
@ -1436,7 +1436,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
if((key=='z' && state==ControlMask)) /* zoom out */
|
||||
{
|
||||
view_unzoom(0.0);
|
||||
view_unzoom(0.0);
|
||||
break;
|
||||
}
|
||||
if(key=='!')
|
||||
|
|
@ -1449,11 +1449,11 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
|
||||
case ButtonPress: /* end operation */
|
||||
dbg(1, "callback(): ButtonPress ui_state=%ld state=%d\n",ui_state,state);
|
||||
if(ui_state & STARTPAN2) { /* 20121123 */
|
||||
if(ui_state & STARTPAN2) {
|
||||
ui_state &=~STARTPAN2;
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap; /* 20070322 */
|
||||
my_double_save=mousey_snap; /* 20070322 */
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1473,26 +1473,26 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
|
||||
}
|
||||
else if(button==Button4 && state == 0 ) view_zoom(CADZOOMSTEP);
|
||||
/* 20111114 */
|
||||
|
||||
else if(button==Button4 && (state & ShiftMask) && !(state & Button2Mask)) {
|
||||
xorigin+=-CADMOVESTEP*zoom/2.;
|
||||
xctx.xorigin+=-CADMOVESTEP*xctx.zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button5 && (state & ShiftMask) && !(state & Button2Mask)) {
|
||||
xorigin-=-CADMOVESTEP*zoom/2.;
|
||||
xctx.xorigin-=-CADMOVESTEP*xctx.zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button4 && (state & ControlMask) && !(state & Button2Mask)) {
|
||||
yorigin+=-CADMOVESTEP*zoom/2.;
|
||||
xctx.yorigin+=-CADMOVESTEP*xctx.zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button5 && (state & ControlMask) && !(state & Button2Mask)) {
|
||||
yorigin-=-CADMOVESTEP*zoom/2.;
|
||||
xctx.yorigin-=-CADMOVESTEP*xctx.zoom/2.;
|
||||
draw();
|
||||
}
|
||||
else if(button==Button1 && (state & Mod1Mask) ) {
|
||||
last_command = 0;
|
||||
mx_save = mx; my_save = my; /* 20171218 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
|
||||
|
|
@ -1528,30 +1528,30 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(!(ui_state & STARTPOLYGON) && !(ui_state & STARTWIRE) && !(ui_state & STARTLINE) ) {
|
||||
horizontal_move = vertical_move=0; /* 20171023 */
|
||||
horizontal_move = vertical_move=0;
|
||||
tcleval("set vertical_move 0; set horizontal_move 0" );
|
||||
}
|
||||
if(ui_state & MENUSTARTTEXT) {
|
||||
place_text(1, mousex_snap, mousey_snap); /* 20161201 */
|
||||
place_text(1, mousex_snap, mousey_snap);
|
||||
ui_state &=~MENUSTARTTEXT;
|
||||
break; /* 20161201 */
|
||||
break;
|
||||
}
|
||||
if(ui_state & MENUSTARTWIRE) {
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
new_wire(PLACE, mousex_snap, mousey_snap);
|
||||
new_wire(PLACE, mousex_snap, mousey_snap);
|
||||
ui_state &=~MENUSTARTWIRE;
|
||||
break;
|
||||
}
|
||||
if(ui_state & MENUSTARTSNAPWIRE) { /* 20171022 */
|
||||
if(ui_state & MENUSTARTSNAPWIRE) {
|
||||
double x, y;
|
||||
int xx, yy;
|
||||
|
||||
|
||||
find_closest_net_or_symbol_pin(mousex, mousey, &x, &y);
|
||||
xx = X_TO_SCREEN(x);
|
||||
yy = Y_TO_SCREEN(y);
|
||||
mx_save = xx; my_save = yy; /* 20070323 */
|
||||
mx_save = xx; my_save = yy;
|
||||
mx_double_save = ROUND(x / cadsnap) * cadsnap;
|
||||
my_double_save = ROUND(y / cadsnap) * cadsnap;
|
||||
|
||||
|
|
@ -1560,7 +1560,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(ui_state & MENUSTARTLINE) {
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
new_line(PLACE);
|
||||
|
|
@ -1568,7 +1568,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
break;
|
||||
}
|
||||
if(ui_state & MENUSTARTRECT) {
|
||||
mx_save = mx; my_save = my; /* 20070323 */
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
new_rect(PLACE);
|
||||
|
|
@ -1619,10 +1619,10 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
mx_double_save=mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my; /* 20070323 */
|
||||
my_save = my;
|
||||
my_double_save=mousey_snap;
|
||||
}
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_wire(PLACE, mousex_snap, mousey_snap);
|
||||
|
||||
|
|
@ -1642,10 +1642,10 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
mx_double_save=mousex_snap;
|
||||
}
|
||||
if(!horizontal_move) {
|
||||
my_save = my; /* 20070323 */
|
||||
my_save = my;
|
||||
my_double_save=mousey_snap;
|
||||
}
|
||||
if(horizontal_move) mousey_snap = my_double_save; /* 20171023 */
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_line(PLACE);
|
||||
} else {
|
||||
|
|
@ -1657,13 +1657,13 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
new_rect(PLACE|END);
|
||||
break;
|
||||
}
|
||||
if(ui_state & STARTPOLYGON) { /* 20171115 */
|
||||
if(ui_state & STARTPOLYGON) {
|
||||
if(horizontal_move) mousey_snap = my_double_save;
|
||||
if(vertical_move) mousex_snap = mx_double_save;
|
||||
new_polygon(ADD);
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
horizontal_move = vertical_move=0; /* 20171023 */
|
||||
horizontal_move = vertical_move=0;
|
||||
tcleval("set vertical_move 0; set horizontal_move 0" );
|
||||
break;
|
||||
}
|
||||
|
|
@ -1679,8 +1679,8 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if( !(ui_state & STARTSELECT) && !(ui_state & STARTWIRE) && !(ui_state & STARTLINE) ) {
|
||||
int prev_last_sel = lastselected;
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap; /* 20070322 */
|
||||
my_double_save=mousey_snap; /* 20070322 */
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
if( !(state & ShiftMask) && !(state & Mod1Mask) ) {
|
||||
unselect_all();
|
||||
#ifndef __unix__
|
||||
|
|
@ -1693,11 +1693,11 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
#ifndef __unix__
|
||||
draw_selection(gc[SELLAYER], 0); /* 20181009 moved outside of cadlayers loop */
|
||||
#endif
|
||||
if(sel && state == ControlMask) { /* 20170416 */
|
||||
if(sel && state == ControlMask) {
|
||||
launcher();
|
||||
}
|
||||
if( !(state & ShiftMask) ) {
|
||||
Box boundbox;
|
||||
xRect boundbox;
|
||||
if(auto_hilight && hilight_nets && sel == 0 ) { /* 20160413 20160503 */
|
||||
if(!prev_last_sel) {
|
||||
calc_drawing_bbox(&boundbox, 2);
|
||||
|
|
@ -1711,7 +1711,7 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
}
|
||||
}
|
||||
}
|
||||
if(auto_hilight) { /* 20160413 */
|
||||
if(auto_hilight) {
|
||||
hilight_net(0);
|
||||
if(lastselected) {
|
||||
redraw_hilights();
|
||||
|
|
@ -1726,13 +1726,13 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(ui_state & STARTPAN2) {
|
||||
ui_state &=~STARTPAN2;
|
||||
mx_save = mx; my_save = my;
|
||||
mx_double_save=mousex_snap; /* 20070322 */
|
||||
my_double_save=mousey_snap; /* 20070322 */
|
||||
mx_double_save=mousex_snap;
|
||||
my_double_save=mousey_snap;
|
||||
|
||||
break;
|
||||
}
|
||||
dbg(1, "callback(): ButtonRelease ui_state=%ld state=%d\n",ui_state,state);
|
||||
if(semaphore >= 2) break; /* 20160423 */
|
||||
if(semaphore >= 2) break;
|
||||
if(ui_state & STARTSELECT) {
|
||||
if(state & ControlMask) {
|
||||
enable_stretch=1;
|
||||
|
|
@ -1744,8 +1744,8 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
if(!(state&(Button4Mask|Button5Mask) ) ) select_rect(END,-1);
|
||||
}
|
||||
rebuild_selected_array();
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
mousex_snap, mousey_snap, lastselected, sch_path[currentsch] );
|
||||
my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s",
|
||||
mousex_snap, mousey_snap, lastselected, xctx.sch_path[xctx.currsch] );
|
||||
statusmsg(str,1);
|
||||
|
||||
}
|
||||
|
|
@ -1767,17 +1767,17 @@ int callback(int event, int mx, int my, KeySym key,
|
|||
#ifndef __unix__
|
||||
case MOUSE_WHEEL_UP: /* windows do not use button4 and button5 like X */
|
||||
{
|
||||
xorigin += -CADMOVESTEP * zoom / 2.;
|
||||
xctx.xorigin += -CADMOVESTEP * xctx.zoom / 2.;
|
||||
draw();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
dbg(1, "callback(): Event:%d\n",event);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
semaphore--;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
333
src/check.c
333
src/check.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: check.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -32,47 +32,47 @@ void check_touch(int i, int j,
|
|||
int touch1=0,touch2=0,touch3=0,touch4=0;
|
||||
double delta1x,delta1y,delta2x,delta2y;
|
||||
double x1,y1,x2,y2;
|
||||
x1=wire[i].x1;
|
||||
x2=wire[i].x2;
|
||||
y1=wire[i].y1;
|
||||
y2=wire[i].y2;
|
||||
x1=xctx.wire[i].x1;
|
||||
x2=xctx.wire[i].x2;
|
||||
y1=xctx.wire[i].y1;
|
||||
y2=xctx.wire[i].y2;
|
||||
delta1x = x2-x1;delta1y = y1-y2 ;
|
||||
delta2x = wire[j].x2-wire[j].x1;delta2y = wire[j].y1-wire[j].y2 ;
|
||||
delta2x = xctx.wire[j].x2-xctx.wire[j].x1;delta2y = xctx.wire[j].y1-xctx.wire[j].y2 ;
|
||||
|
||||
*included = 0;
|
||||
*includes = 0;
|
||||
*touches = 0;
|
||||
*broken = 0;
|
||||
*broken = 0;
|
||||
*breaks = 0;
|
||||
*parallel = (delta1x*delta2y == delta2x*delta1y ? 1:0);
|
||||
|
||||
/* the order of the following 4 if(touch...) is not don't care !!! */
|
||||
if(touch(wire[j].x1,wire[j].y1,wire[j].x2,wire[j].y2,x1,y1) )
|
||||
if(touch(xctx.wire[j].x1,xctx.wire[j].y1,xctx.wire[j].x2,xctx.wire[j].y2,x1,y1) )
|
||||
{
|
||||
*touches = 1;touch3 =1;
|
||||
*xt = x1; *yt = y1;
|
||||
if((*xt > wire[j].x1 && *xt < wire[j].x2)||
|
||||
(*yt > wire[j].y1 && *yt < wire[j].y2)) *breaks = 1;
|
||||
if((*xt > xctx.wire[j].x1 && *xt < xctx.wire[j].x2)||
|
||||
(*yt > xctx.wire[j].y1 && *yt < xctx.wire[j].y2)) *breaks = 1;
|
||||
}
|
||||
if(touch(wire[j].x1,wire[j].y1,wire[j].x2,wire[j].y2,x2,y2) )
|
||||
if(touch(xctx.wire[j].x1,xctx.wire[j].y1,xctx.wire[j].x2,xctx.wire[j].y2,x2,y2) )
|
||||
{
|
||||
*touches = 1;touch4 =1;
|
||||
*xt = x2; *yt = y2;
|
||||
if((*xt > wire[j].x1 && *xt < wire[j].x2)||
|
||||
(*yt > wire[j].y1 && *yt < wire[j].y2)) *breaks = 1;
|
||||
if((*xt > xctx.wire[j].x1 && *xt < xctx.wire[j].x2)||
|
||||
(*yt > xctx.wire[j].y1 && *yt < xctx.wire[j].y2)) *breaks = 1;
|
||||
}
|
||||
if(touch3 && touch4) *included = 1;
|
||||
|
||||
if(touch(x1,y1,x2,y2,wire[j].x1,wire[j].y1) )
|
||||
|
||||
if(touch(x1,y1,x2,y2,xctx.wire[j].x1,xctx.wire[j].y1) )
|
||||
{
|
||||
*touches = 1;touch1=1;
|
||||
*xt = wire[j].x1; *yt = wire[j].y1;
|
||||
*xt = xctx.wire[j].x1; *yt = xctx.wire[j].y1;
|
||||
if((*xt > x1 && *xt < x2)||(*yt > y1 && *yt < y2)) *broken = 1;
|
||||
}
|
||||
if(touch(x1,y1,x2,y2,wire[j].x2,wire[j].y2) )
|
||||
if(touch(x1,y1,x2,y2,xctx.wire[j].x2,xctx.wire[j].y2) )
|
||||
{
|
||||
*touches = 1;touch2=1;
|
||||
*xt = wire[j].x2; *yt = wire[j].y2;
|
||||
*xt = xctx.wire[j].x2; *yt = xctx.wire[j].y2;
|
||||
if((*xt > x1 && *xt < x2)||(*yt > y1 && *yt < y2)) *broken = 1;
|
||||
}
|
||||
if(touch1 && touch2) *includes = 1;
|
||||
|
|
@ -86,11 +86,11 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
double x0, y0;
|
||||
double x1, y1, x2, y2;
|
||||
struct wireentry *wireptr;
|
||||
|
||||
hash_wires(); /* must be done also if lastwire==0 to clear wiretable */
|
||||
if(!lastwire) return;
|
||||
|
||||
hash_wires(); /* must be done also if xctx.wires==0 to clear wiretable */
|
||||
if(!xctx.wires) return;
|
||||
if(!draw_dots) return;
|
||||
if(cadhalfdotsize*mooz<0.7) return;
|
||||
if(cadhalfdotsize*xctx.mooz<0.7) return;
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
|
|
@ -98,18 +98,18 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
k=wireptr->n;
|
||||
/* optimization when editing small areas (detailed zoom) of a huge schematic */
|
||||
if(LINE_OUTSIDE(wire[k].x1, wire[k].y1, wire[k].x2, wire[k].y2, x1, y1, x2, y2)) continue;
|
||||
if(LINE_OUTSIDE(xctx.wire[k].x1, xctx.wire[k].y1, xctx.wire[k].x2, xctx.wire[k].y2, x1, y1, x2, y2)) continue;
|
||||
for(l = 0;l < 2;l++) {
|
||||
if(l==0 ) {
|
||||
if(wire[k].end1 !=-1) continue; /* 20181103 */
|
||||
wire[k].end1=0;
|
||||
x0 = wire[k].x1;
|
||||
y0 = wire[k].y1;
|
||||
if(xctx.wire[k].end1 !=-1) continue;
|
||||
xctx.wire[k].end1=0;
|
||||
x0 = xctx.wire[k].x1;
|
||||
y0 = xctx.wire[k].y1;
|
||||
} else {
|
||||
if(wire[k].end2 !=-1) continue; /* 20181103 */
|
||||
wire[k].end2=0;
|
||||
x0 = wire[k].x2;
|
||||
y0 = wire[k].y2;
|
||||
if(xctx.wire[k].end2 !=-1) continue;
|
||||
xctx.wire[k].end2=0;
|
||||
x0 = xctx.wire[k].x2;
|
||||
y0 = xctx.wire[k].y2;
|
||||
}
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
for(wptr = wiretable[sqx][sqy] ; wptr ; wptr = wptr->next) {
|
||||
|
|
@ -117,14 +117,14 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
if(i == k) {
|
||||
continue; /* no check wire against itself */
|
||||
}
|
||||
if( touch(wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, x0,y0) ) {
|
||||
if( (x0 != wire[i].x1 && x0 != wire[i].x2) ||
|
||||
(y0 != wire[i].y1 && y0 != wire[i].y2) ) {
|
||||
if(l == 0) wire[k].end1 += 2;
|
||||
else wire[k].end2 += 2;
|
||||
if( touch(xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, x0,y0) ) {
|
||||
if( (x0 != xctx.wire[i].x1 && x0 != xctx.wire[i].x2) ||
|
||||
(y0 != xctx.wire[i].y1 && y0 != xctx.wire[i].y2) ) {
|
||||
if(l == 0) xctx.wire[k].end1 += 2;
|
||||
else xctx.wire[k].end2 += 2;
|
||||
} else {
|
||||
if(l == 0) wire[k].end1 += 1;
|
||||
else wire[k].end2 += 1;
|
||||
if(l == 0) xctx.wire[k].end1 += 1;
|
||||
else xctx.wire[k].end2 += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,12 +136,12 @@ void update_conn_cues(int draw_cues, int dr_win)
|
|||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
/* optimization when editing small areas (detailed zoom) of a huge schematic */
|
||||
if(LINE_OUTSIDE(wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, x1, y1, x2, y2)) continue;
|
||||
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
if(LINE_OUTSIDE(xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, x1, y1, x2, y2)) continue;
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(WIRELAYER, ADD, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
filledarc(WIRELAYER, END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
@ -157,16 +157,16 @@ void trim_wires(void)
|
|||
double xt=0,yt=0;
|
||||
int loops=0;
|
||||
|
||||
do {
|
||||
do {
|
||||
loops++;
|
||||
for(i=0;i<lastwire;i++) wire[i].end1=wire[i].end2=0;
|
||||
for(i=0;i<xctx.wires;i++) xctx.wire[i].end1=xctx.wire[i].end2=0;
|
||||
changed=0;
|
||||
for(i=0;i<lastwire;i++)
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
{
|
||||
for(j=i+1;j<lastwire;j++)
|
||||
for(j=i+1;j<xctx.wires;j++)
|
||||
{
|
||||
check_touch(i,j, ¶llel,&breaks,&broken,&touches,&included,&includes, &xt,&yt);
|
||||
if(included)
|
||||
if(included)
|
||||
{
|
||||
freenet_nocheck(i);
|
||||
i--;
|
||||
|
|
@ -181,86 +181,86 @@ void trim_wires(void)
|
|||
continue;
|
||||
}
|
||||
if(touches)
|
||||
{
|
||||
{
|
||||
if(broken)
|
||||
{
|
||||
check_wire_storage();
|
||||
changed=1;
|
||||
wire[lastwire].x1=wire[i].x1;
|
||||
wire[lastwire].y1=wire[i].y1;
|
||||
wire[lastwire].end1=wire[i].end1;
|
||||
wire[lastwire].end2=1;
|
||||
wire[lastwire].x2=xt;
|
||||
wire[lastwire].y2=yt;
|
||||
wire[lastwire].sel=0;
|
||||
wire[lastwire].prop_ptr=NULL;
|
||||
my_strdup(27, &wire[lastwire].prop_ptr, wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(wire[lastwire].prop_ptr,"bus",0), "true")) /* 20171201 */
|
||||
wire[lastwire].bus=1;
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[i].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[i].y1;
|
||||
xctx.wire[xctx.wires].end1=xctx.wire[i].end1;
|
||||
xctx.wire[xctx.wires].end2=1;
|
||||
xctx.wire[xctx.wires].x2=xt;
|
||||
xctx.wire[xctx.wires].y2=yt;
|
||||
xctx.wire[xctx.wires].sel=0;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(27, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
else
|
||||
wire[lastwire].bus=0;
|
||||
wire[lastwire].node=NULL;
|
||||
my_strdup(28, &wire[lastwire].node, wire[i].node);
|
||||
lastwire++;
|
||||
|
||||
wire[i].x1 = xt;
|
||||
wire[i].y1 = yt;
|
||||
wire[i].end1 = 1;
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
my_strdup(28, &xctx.wire[xctx.wires].node, xctx.wire[i].node);
|
||||
xctx.wires++;
|
||||
|
||||
xctx.wire[i].x1 = xt;
|
||||
xctx.wire[i].y1 = yt;
|
||||
xctx.wire[i].end1 = 1;
|
||||
} /* end if broken */
|
||||
else if(breaks) /*wire[i] breaks wire[j] */
|
||||
else if(breaks) /*xctx.wire[i] breaks xctx.wire[j] */
|
||||
{
|
||||
changed=1;
|
||||
if(wire[i].x1==xt && wire[i].y1==yt) wire[i].end1+=1;
|
||||
else if(wire[i].x2==xt && wire[i].y2==yt) wire[i].end2+=1;
|
||||
|
||||
if(xctx.wire[i].x1==xt && xctx.wire[i].y1==yt) xctx.wire[i].end1+=1;
|
||||
else if(xctx.wire[i].x2==xt && xctx.wire[i].y2==yt) xctx.wire[i].end2+=1;
|
||||
|
||||
check_wire_storage();
|
||||
wire[lastwire].x1=wire[j].x1;
|
||||
wire[lastwire].y1=wire[j].y1;
|
||||
wire[lastwire].end1=wire[j].end1;
|
||||
wire[lastwire].end2=1;
|
||||
wire[lastwire].x2=xt;
|
||||
wire[lastwire].y2=yt;
|
||||
wire[lastwire].sel=0;
|
||||
wire[lastwire].prop_ptr=NULL;
|
||||
my_strdup(29, &wire[lastwire].prop_ptr, wire[j].prop_ptr);
|
||||
if(!strcmp(get_tok_value(wire[lastwire].prop_ptr,"bus",0), "true")) /* 20171201 */
|
||||
wire[lastwire].bus=1;
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[j].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[j].y1;
|
||||
xctx.wire[xctx.wires].end1=xctx.wire[j].end1;
|
||||
xctx.wire[xctx.wires].end2=1;
|
||||
xctx.wire[xctx.wires].x2=xt;
|
||||
xctx.wire[xctx.wires].y2=yt;
|
||||
xctx.wire[xctx.wires].sel=0;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(29, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[j].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
else
|
||||
wire[lastwire].bus=0;
|
||||
wire[lastwire].node=NULL;
|
||||
my_strdup(30, &wire[lastwire].node, wire[j].node);
|
||||
lastwire++;
|
||||
|
||||
wire[j].x1 = xt;
|
||||
wire[j].y1 = yt;
|
||||
wire[j].end1 = 1;
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
my_strdup(30, &xctx.wire[xctx.wires].node, xctx.wire[j].node);
|
||||
xctx.wires++;
|
||||
|
||||
xctx.wire[j].x1 = xt;
|
||||
xctx.wire[j].y1 = yt;
|
||||
xctx.wire[j].end1 = 1;
|
||||
} /* end else if breaks */
|
||||
else /* wire[i] touches but does not break wire[j] */
|
||||
else /* xctx.wire[i] touches but does not break xctx.wire[j] */
|
||||
{
|
||||
if(wire[i].x1==wire[j].x1 && wire[i].y1==wire[j].y1)
|
||||
{wire[i].end1++;wire[j].end1++;}
|
||||
else if(wire[i].x1==wire[j].x2 && wire[i].y1==wire[j].y2)
|
||||
{wire[i].end1++;wire[j].end2++;}
|
||||
else if(wire[i].x2==wire[j].x1 && wire[i].y2==wire[j].y1)
|
||||
{wire[i].end2++;wire[j].end1++;}
|
||||
else
|
||||
{wire[i].end2++;wire[j].end2++;}
|
||||
if(xctx.wire[i].x1==xctx.wire[j].x1 && xctx.wire[i].y1==xctx.wire[j].y1)
|
||||
{xctx.wire[i].end1++;xctx.wire[j].end1++;}
|
||||
else if(xctx.wire[i].x1==xctx.wire[j].x2 && xctx.wire[i].y1==xctx.wire[j].y2)
|
||||
{xctx.wire[i].end1++;xctx.wire[j].end2++;}
|
||||
else if(xctx.wire[i].x2==xctx.wire[j].x1 && xctx.wire[i].y2==xctx.wire[j].y1)
|
||||
{xctx.wire[i].end2++;xctx.wire[j].end1++;}
|
||||
else
|
||||
{xctx.wire[i].end2++;xctx.wire[j].end2++;}
|
||||
}
|
||||
} /* end if touches */
|
||||
} /* end for j */
|
||||
} /* end for i */
|
||||
for(i=0;i<lastwire;i++) {
|
||||
for(j=i+1;j<lastwire;j++) {
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
for(j=i+1;j<xctx.wires;j++) {
|
||||
check_touch(i,j, ¶llel,&breaks,&broken,&touches,&included,&includes, &xt,&yt);
|
||||
if( touches && parallel)
|
||||
{
|
||||
if(wire[j].x1 == xt && wire[j].y1 == yt) /* touch in x1, y1 */
|
||||
if(xctx.wire[j].x1 == xt && xctx.wire[j].y1 == yt) /* touch in x1, y1 */
|
||||
{
|
||||
if(wire[i].end2 == 1 && wire[j].end1 == 1) /* merge wire */
|
||||
if(xctx.wire[i].end2 == 1 && xctx.wire[j].end1 == 1) /* merge wire */
|
||||
{
|
||||
changed=1;
|
||||
wire[i].x2 = wire[j].x2;wire[i].y2 = wire[j].y2;
|
||||
wire[i].end2=wire[j].end2;
|
||||
xctx.wire[i].x2 = xctx.wire[j].x2;xctx.wire[i].y2 = xctx.wire[j].y2;
|
||||
xctx.wire[i].end2=xctx.wire[j].end2;
|
||||
freenet_nocheck(j);
|
||||
j--;
|
||||
break;
|
||||
|
|
@ -268,11 +268,11 @@ void trim_wires(void)
|
|||
}
|
||||
else /* touch in x2,y2 */
|
||||
{
|
||||
if(wire[i].end1 == 1 && wire[j].end2 == 1) /* merge wire */
|
||||
if(xctx.wire[i].end1 == 1 && xctx.wire[j].end2 == 1) /* merge wire */
|
||||
{
|
||||
changed=1;
|
||||
wire[i].x1 = wire[j].x1;wire[i].y1 = wire[j].y1;
|
||||
wire[i].end1=wire[j].end1;
|
||||
xctx.wire[i].x1 = xctx.wire[j].x1;xctx.wire[i].y1 = xctx.wire[j].y1;
|
||||
xctx.wire[i].end1=xctx.wire[j].end1;
|
||||
freenet_nocheck(j);
|
||||
j--;
|
||||
break;
|
||||
|
|
@ -291,62 +291,62 @@ void trim_wires(void)
|
|||
dbg(1, "trim_wires:loops=%d\n", loops);
|
||||
draw_dots=1;
|
||||
}
|
||||
|
||||
|
||||
void break_wires_at_pins(void)
|
||||
{
|
||||
int k, i, j, r, rects, rot, flip, sqx, sqy;
|
||||
struct wireentry *wptr;
|
||||
Box *rect;
|
||||
xRect *rct;
|
||||
double x0, y0, rx1, ry1;
|
||||
int changed=0;
|
||||
hash_wires();
|
||||
|
||||
need_rebuild_selected_array=1;
|
||||
rebuild_selected_array();
|
||||
|
||||
/* for(k=0;k<lastinst;k++) */
|
||||
|
||||
/* for(k=0;k<xctx.instances;k++) */
|
||||
for(j=0;j<lastselected;j++) if(selectedgroup[j].type==ELEMENT) {
|
||||
k = selectedgroup[j].n;
|
||||
if( (rects = (inst_ptr[k].ptr+instdef)->rects[PINLAYER]) > 0 )
|
||||
if( (rects = (xctx.inst[k].ptr+ xctx.sym)->rects[PINLAYER]) > 0 )
|
||||
{
|
||||
for(r=0;r<rects;r++)
|
||||
{
|
||||
rect=(inst_ptr[k].ptr+instdef)->boxptr[PINLAYER];
|
||||
x0=(rect[r].x1+rect[r].x2)/2;
|
||||
y0=(rect[r].y1+rect[r].y2)/2;
|
||||
rot=inst_ptr[k].rot;
|
||||
flip=inst_ptr[k].flip;
|
||||
rct=(xctx.inst[k].ptr+ xctx.sym)->rect[PINLAYER];
|
||||
x0=(rct[r].x1+rct[r].x2)/2;
|
||||
y0=(rct[r].y1+rct[r].y2)/2;
|
||||
rot=xctx.inst[k].rot;
|
||||
flip=xctx.inst[k].flip;
|
||||
ROTATION(0.0,0.0,x0,y0,rx1,ry1);
|
||||
x0=inst_ptr[k].x0+rx1;
|
||||
y0=inst_ptr[k].y0+ry1;
|
||||
x0=xctx.inst[k].x0+rx1;
|
||||
y0=xctx.inst[k].y0+ry1;
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
for(wptr=wiretable[sqx][sqy]; wptr; wptr=wptr->next) {
|
||||
i = wptr->n;
|
||||
if( touch(wire[i].x1, wire[i].y1,
|
||||
wire[i].x2, wire[i].y2, x0,y0) )
|
||||
if( touch(xctx.wire[i].x1, xctx.wire[i].y1,
|
||||
xctx.wire[i].x2, xctx.wire[i].y2, x0,y0) )
|
||||
{
|
||||
if( (x0!=wire[i].x1 && x0!=wire[i].x2) ||
|
||||
(y0!=wire[i].y1 && y0!=wire[i].y2) ) {
|
||||
if( (x0!=xctx.wire[i].x1 && x0!=xctx.wire[i].x2) ||
|
||||
(y0!=xctx.wire[i].y1 && y0!=xctx.wire[i].y2) ) {
|
||||
if(!changed) { push_undo(); changed=1;}
|
||||
check_wire_storage();
|
||||
wire[lastwire].x1=wire[i].x1;
|
||||
wire[lastwire].y1=wire[i].y1;
|
||||
wire[lastwire].x2=x0;
|
||||
wire[lastwire].y2=y0;
|
||||
wire[lastwire].sel=SELECTED;
|
||||
wire[lastwire].prop_ptr=NULL;
|
||||
my_strdup(31, &wire[lastwire].prop_ptr, wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(wire[lastwire].prop_ptr,"bus",0), "true")) /* 20171201 */
|
||||
wire[lastwire].bus=1;
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[i].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[i].y1;
|
||||
xctx.wire[xctx.wires].x2=x0;
|
||||
xctx.wire[xctx.wires].y2=y0;
|
||||
xctx.wire[xctx.wires].sel=SELECTED;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(31, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
else
|
||||
wire[lastwire].bus=0;
|
||||
wire[lastwire].node=NULL;
|
||||
hash_wire(XINSERT, lastwire);
|
||||
my_strdup(32, &wire[lastwire].node, wire[i].node);
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx.wires);
|
||||
my_strdup(32, &xctx.wire[xctx.wires].node, xctx.wire[i].node);
|
||||
need_rebuild_selected_array=1;
|
||||
lastwire++;
|
||||
wire[i].x1 = x0;
|
||||
wire[i].y1 = y0;
|
||||
xctx.wires++;
|
||||
xctx.wire[i].x1 = x0;
|
||||
xctx.wire[i].y1 = y0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -357,17 +357,17 @@ void break_wires_at_pins(void)
|
|||
/* hash_wires(); */
|
||||
rebuild_selected_array();
|
||||
for(j=0;j<lastselected;j++) if(selectedgroup[j].type==WIRE) {
|
||||
/* for(k=0; k < lastwire; k++) { */
|
||||
/* for(k=0; k < xctx.wires; k++) { */
|
||||
int l;
|
||||
|
||||
k = selectedgroup[j].n;
|
||||
for(l=0;l<2;l++) {
|
||||
if(l==0 ) {
|
||||
x0 = wire[k].x1;
|
||||
y0 = wire[k].y1;
|
||||
x0 = xctx.wire[k].x1;
|
||||
y0 = xctx.wire[k].y1;
|
||||
} else {
|
||||
x0 = wire[k].x2;
|
||||
y0 = wire[k].y2;
|
||||
x0 = xctx.wire[k].x2;
|
||||
y0 = xctx.wire[k].y2;
|
||||
}
|
||||
get_square(x0, y0, &sqx, &sqy);
|
||||
/* printf(" k=%d, x0=%g, y0=%g\n", k, x0, y0); */
|
||||
|
|
@ -377,32 +377,31 @@ void break_wires_at_pins(void)
|
|||
if(i==k) {
|
||||
continue; /* no check wire against itself */
|
||||
}
|
||||
/* printf(" i=%d, x1=%g, y1=%g x2=%g, y2=%g\n", i, wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2); */
|
||||
if( touch(wire[i].x1, wire[i].y1,
|
||||
wire[i].x2, wire[i].y2, x0,y0) )
|
||||
if( touch(xctx.wire[i].x1, xctx.wire[i].y1,
|
||||
xctx.wire[i].x2, xctx.wire[i].y2, x0,y0) )
|
||||
{
|
||||
if( (x0!=wire[i].x1 && x0!=wire[i].x2) ||
|
||||
(y0!=wire[i].y1 && y0!=wire[i].y2) ) {
|
||||
if( (x0!=xctx.wire[i].x1 && x0!=xctx.wire[i].x2) ||
|
||||
(y0!=xctx.wire[i].y1 && y0!=xctx.wire[i].y2) ) {
|
||||
/* printf("touch in mid point: %d\n", l+1); */
|
||||
if(!changed) { push_undo(); changed=1;}
|
||||
check_wire_storage();
|
||||
wire[lastwire].x1=wire[i].x1;
|
||||
wire[lastwire].y1=wire[i].y1;
|
||||
wire[lastwire].x2=x0;
|
||||
wire[lastwire].y2=y0;
|
||||
wire[lastwire].sel=SELECTED;
|
||||
wire[lastwire].prop_ptr=NULL;
|
||||
my_strdup(33, &wire[lastwire].prop_ptr, wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(wire[lastwire].prop_ptr,"bus",0), "true")) /* 20171201 */
|
||||
wire[lastwire].bus=1;
|
||||
xctx.wire[xctx.wires].x1=xctx.wire[i].x1;
|
||||
xctx.wire[xctx.wires].y1=xctx.wire[i].y1;
|
||||
xctx.wire[xctx.wires].x2=x0;
|
||||
xctx.wire[xctx.wires].y2=y0;
|
||||
xctx.wire[xctx.wires].sel=SELECTED;
|
||||
xctx.wire[xctx.wires].prop_ptr=NULL;
|
||||
my_strdup(33, &xctx.wire[xctx.wires].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[xctx.wires].prop_ptr,"bus",0), "true"))
|
||||
xctx.wire[xctx.wires].bus=1;
|
||||
else
|
||||
wire[lastwire].bus=0;
|
||||
wire[lastwire].node=NULL;
|
||||
hash_wire(XINSERT, lastwire);
|
||||
xctx.wire[xctx.wires].bus=0;
|
||||
xctx.wire[xctx.wires].node=NULL;
|
||||
hash_wire(XINSERT, xctx.wires);
|
||||
need_rebuild_selected_array=1;
|
||||
lastwire++;
|
||||
wire[i].x1 = x0;
|
||||
wire[i].y1 = y0;
|
||||
xctx.wires++;
|
||||
xctx.wire[i].x1 = x0;
|
||||
xctx.wire[i].y1 = y0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
src/clip.c
10
src/clip.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: clip.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -42,7 +42,7 @@ int clip( double *xa,double *ya,double *xb,double *yb)
|
|||
{
|
||||
int outa, outb,outpoint;
|
||||
double x,y;
|
||||
|
||||
|
||||
outa=outcode(*xa, *ya);
|
||||
outb=outcode(*xb, *yb);
|
||||
while(1)
|
||||
|
|
@ -88,7 +88,7 @@ int rectclip(int x1,int y1,int x2,int y2,
|
|||
double dist_from_rect(double mx, double my, double x1, double y1, double x2, double y2)
|
||||
{/* return square of dist... */
|
||||
double dist, tmp;
|
||||
|
||||
|
||||
dist=mx-x1;
|
||||
tmp=x2-mx;
|
||||
if(tmp < dist) dist=tmp;
|
||||
|
|
@ -110,7 +110,7 @@ double dist(double x1,double y1,double x2,double y2,double xa,double ya)
|
|||
double distance1,distance2,distance3,denom,a,b,c,ab,xb,yb,tmp;
|
||||
double xa1,ya1,xa2,ya2;
|
||||
|
||||
if( (x1==x2) && (y1==y2) )
|
||||
if( (x1==x2) && (y1==y2) )
|
||||
return (x1-xa)*(x1-xa)+(y1-ya)*(y1-ya);
|
||||
xa1 = xa - x1; xa1*=xa1;
|
||||
ya1 = ya - y1; ya1*=ya1;
|
||||
|
|
|
|||
528
src/draw.c
528
src/draw.c
File diff suppressed because it is too large
Load Diff
593
src/editprop.c
593
src/editprop.c
File diff suppressed because it is too large
Load Diff
114
src/findnet.c
114
src/findnet.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: findnet.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -33,9 +33,9 @@ void find_closest_net(double mx,double my)
|
|||
int i,w=-1;
|
||||
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
|
||||
|
||||
for(i=0;i<lastwire;i++)
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
{
|
||||
if( (tmp = dist(wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2,mx,my)) < distance )
|
||||
if( (tmp = dist(xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2,mx,my)) < distance )
|
||||
{
|
||||
w = i; distance = tmp;
|
||||
}
|
||||
|
|
@ -56,14 +56,14 @@ void find_closest_polygon(double mx,double my)
|
|||
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<lastpolygon[c];i++)
|
||||
for(i=0;i<xctx.polygons[c];i++)
|
||||
{
|
||||
/*fprintf(errfp, "points=%d\n", polygon[c][i].points); */
|
||||
for(j=0; j<polygon[c][i].points-1; j++) {
|
||||
x1 = polygon[c][i].x[j];
|
||||
y1 = polygon[c][i].y[j];
|
||||
x2 = polygon[c][i].x[j+1];
|
||||
y2 = polygon[c][i].y[j+1];
|
||||
/*fprintf(errfp, "points=%d\n", xctx.poly[c][i].points); */
|
||||
for(j=0; j<xctx.poly[c][i].points-1; j++) {
|
||||
x1 = xctx.poly[c][i].x[j];
|
||||
y1 = xctx.poly[c][i].y[j];
|
||||
x2 = xctx.poly[c][i].x[j+1];
|
||||
y2 = xctx.poly[c][i].y[j+1];
|
||||
ORDER(x1,y1,x2,y2);
|
||||
if( (tmp = dist(x1, y1, x2, y2, mx, my)) < distance )
|
||||
{
|
||||
|
|
@ -89,9 +89,9 @@ void find_closest_line(double mx,double my)
|
|||
double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<lastline[c];i++)
|
||||
for(i=0;i<xctx.lines[c];i++)
|
||||
{
|
||||
if( (tmp = dist(line[c][i].x1,line[c][i].y1,line[c][i].x2,line[c][i].y2,mx,my))
|
||||
if( (tmp = dist(xctx.line[c][i].x1,xctx.line[c][i].y1,xctx.line[c][i].x2,xctx.line[c][i].y2,mx,my))
|
||||
< distance )
|
||||
{
|
||||
l = i; distance = tmp;col = c;
|
||||
|
|
@ -110,23 +110,23 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
{
|
||||
int i, j, no_of_pin_rects;
|
||||
double x0, x1, x2, y0, y1, y2, xx, yy, dist, min_dist_x=0, min_dist_y=0;
|
||||
Box box;
|
||||
xRect box;
|
||||
int rot, flip;
|
||||
char *type=NULL;
|
||||
|
||||
distance = DBL_MAX;
|
||||
for(i=0;i<lastinst;i++) {
|
||||
x0=inst_ptr[i].x0;
|
||||
y0=inst_ptr[i].y0;
|
||||
rot = inst_ptr[i].rot;
|
||||
flip = inst_ptr[i].flip;
|
||||
my_strdup(133, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
x0=xctx.inst[i].x0;
|
||||
y0=xctx.inst[i].y0;
|
||||
rot = xctx.inst[i].rot;
|
||||
flip = xctx.inst[i].flip;
|
||||
my_strdup(133, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if(!type) continue;
|
||||
|
||||
no_of_pin_rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER];
|
||||
no_of_pin_rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
if(IS_LABEL_OR_PIN(type)) no_of_pin_rects=1;
|
||||
for(j=0; j<no_of_pin_rects; j++) {
|
||||
box = ((inst_ptr[i].ptr+instdef)->boxptr[PINLAYER])[j];
|
||||
box = ((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
|
||||
x1 += x0;
|
||||
|
|
@ -137,23 +137,23 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
|
|||
yy = (y1+y2)/2;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < distance) {
|
||||
distance = dist;
|
||||
distance = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(i=0;i<lastwire; i++) {
|
||||
xx=wire[i].x1;
|
||||
yy = wire[i].y1;
|
||||
for(i=0;i<xctx.wires; i++) {
|
||||
xx=xctx.wire[i].x1;
|
||||
yy = xctx.wire[i].y1;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < distance) {
|
||||
distance = dist;
|
||||
min_dist_x = xx;
|
||||
min_dist_y = yy;
|
||||
}
|
||||
xx=wire[i].x2;
|
||||
yy = wire[i].y2;
|
||||
xx=xctx.wire[i].x2;
|
||||
yy = xctx.wire[i].y2;
|
||||
dist = (mx - xx) * (mx - xx) + (my - yy) * (my - yy);
|
||||
if(dist < distance) {
|
||||
distance = dist;
|
||||
|
|
@ -175,18 +175,18 @@ void find_closest_arc(double mx,double my)
|
|||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<lastarc[c];i++)
|
||||
for(i=0;i<xctx.arcs[c];i++)
|
||||
{
|
||||
dist = sqrt(pow(mx-arc[c][i].x,2) + pow(my-arc[c][i].y,2)) - arc[c][i].r;
|
||||
dist = sqrt(pow(mx-xctx.arc[c][i].x,2) + pow(my-xctx.arc[c][i].y,2)) - xctx.arc[c][i].r;
|
||||
dist *= dist; /* square distance */
|
||||
angle = fmod(atan2(arc[c][i].y-my, mx-arc[c][i].x)*180./XSCH_PI, 360.);
|
||||
angle = fmod(atan2(xctx.arc[c][i].y-my, mx-xctx.arc[c][i].x)*180./XSCH_PI, 360.);
|
||||
if(angle<0.) angle +=360.;
|
||||
angle1 = arc[c][i].a;
|
||||
angle2 = fmod(arc[c][i].a + arc[c][i].b, 360.);
|
||||
angle1 = xctx.arc[c][i].a;
|
||||
angle2 = fmod(xctx.arc[c][i].a + xctx.arc[c][i].b, 360.);
|
||||
|
||||
match=0;
|
||||
if(dist < distance) {
|
||||
if(arc[c][i].b==360.) match=1;
|
||||
if(xctx.arc[c][i].b==360.) match=1;
|
||||
if(angle2<angle1) {
|
||||
if(angle >= angle1 || angle<= angle2) {
|
||||
match=1;
|
||||
|
|
@ -198,17 +198,17 @@ void find_closest_arc(double mx,double my)
|
|||
}
|
||||
}
|
||||
dbg(1, "find_closest_arc(): dist = %g, angle = %g\n", dist, angle);
|
||||
dbg(1, "find_closest_arc(): center=%g,%g: mouse: %g:%g\n",
|
||||
arc[c][i].x, arc[c][i].y, mx, my);
|
||||
dbg(1, "find_closest_arc(): center=%g,%g: mouse: %g:%g\n",
|
||||
xctx.arc[c][i].x, xctx.arc[c][i].y, mx, my);
|
||||
if(match ) {
|
||||
dbg(1, "find_closest_arc(): i = %d\n", i);
|
||||
r = i;
|
||||
r = i;
|
||||
distance = dist;
|
||||
col = c;
|
||||
}
|
||||
} /* end for i */
|
||||
} /* end for c */
|
||||
if( r!=-1 && distance <= thres ) /* * pow(arc[col][r].r,2)) */
|
||||
if( r!=-1 && distance <= thres ) /* * pow(xctx.arc[col][r].r,2)) */
|
||||
{
|
||||
sel.n = r; sel.type = ARC; sel.col = col;
|
||||
}
|
||||
|
|
@ -221,12 +221,12 @@ void find_closest_box(double mx,double my)
|
|||
int i,c,r=-1, col = 0;
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
for(i=0;i<lastrect[c];i++)
|
||||
for(i=0;i<xctx.rects[c];i++)
|
||||
{
|
||||
if( POINTINSIDE(mx,my,rect[c][i].x1,rect[c][i].y1,rect[c][i].x2,rect[c][i].y2) )
|
||||
if( POINTINSIDE(mx,my,xctx.rect[c][i].x1,xctx.rect[c][i].y1,xctx.rect[c][i].x2,xctx.rect[c][i].y2) )
|
||||
{
|
||||
tmp=dist_from_rect(mx,my,rect[c][i].x1,rect[c][i].y1,
|
||||
rect[c][i].x2,rect[c][i].y2);
|
||||
tmp=dist_from_rect(mx,my,xctx.rect[c][i].x1,xctx.rect[c][i].y1,
|
||||
xctx.rect[c][i].x2,xctx.rect[c][i].y2);
|
||||
if(tmp < distance)
|
||||
{
|
||||
r = i; distance = tmp;col = c;
|
||||
|
|
@ -245,18 +245,18 @@ void find_closest_element(double mx,double my)
|
|||
{
|
||||
double tmp;
|
||||
int i,r=-1;
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
dbg(2, "find_closest_element(): %s: %g %g %g %g\n",
|
||||
inst_ptr[i].instname, inst_ptr[i].x1,inst_ptr[i].y1,inst_ptr[i].x2,inst_ptr[i].y2);
|
||||
if( POINTINSIDE(mx,my,inst_ptr[i].x1,inst_ptr[i].y1,inst_ptr[i].x2,inst_ptr[i].y2) )
|
||||
dbg(2, "find_closest_element(): %s: %g %g %g %g\n",
|
||||
xctx.inst[i].instname, xctx.inst[i].x1,xctx.inst[i].y1,xctx.inst[i].x2,xctx.inst[i].y2);
|
||||
if( POINTINSIDE(mx,my,xctx.inst[i].x1,xctx.inst[i].y1,xctx.inst[i].x2,xctx.inst[i].y2) )
|
||||
{
|
||||
tmp=pow(mx-(inst_ptr[i].xx1 + inst_ptr[i].xx2)/2, 2)+pow(my-(inst_ptr[i].yy1 + inst_ptr[i].yy2)/2, 2);
|
||||
tmp=pow(mx-(xctx.inst[i].xx1 + xctx.inst[i].xx2)/2, 2)+pow(my-(xctx.inst[i].yy1 + xctx.inst[i].yy2)/2, 2);
|
||||
if(tmp*0.1 < distance)
|
||||
{
|
||||
r = i; distance = tmp*0.1;
|
||||
}
|
||||
dbg(2, "find_closest_element(): finding closest element, lastinst=%d, dist=%.16g\n",i,tmp);
|
||||
dbg(2, "find_closest_element(): finding closest element, xctx.instances=%d, dist=%.16g\n",i,tmp);
|
||||
}
|
||||
} /* end for i */
|
||||
if( r!=-1 )
|
||||
|
|
@ -274,16 +274,16 @@ void find_closest_text(double mx,double my)
|
|||
#ifdef HAS_CAIRO
|
||||
int customfont;
|
||||
#endif
|
||||
for(i=0;i<lasttext;i++)
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
{
|
||||
rot = textelement[i].rot;
|
||||
flip = textelement[i].flip;
|
||||
rot = xctx.text[i].rot;
|
||||
flip = xctx.text[i].flip;
|
||||
#ifdef HAS_CAIRO
|
||||
customfont = set_text_custom_font(&textelement[i]);
|
||||
customfont = set_text_custom_font(&xctx.text[i]);
|
||||
#endif
|
||||
text_bbox(textelement[i].txt_ptr,
|
||||
textelement[i].xscale, textelement[i].yscale, rot, flip, textelement[i].hcenter, textelement[i].vcenter,
|
||||
textelement[i].x0, textelement[i].y0,
|
||||
text_bbox(xctx.text[i].txt_ptr,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale, rot, flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0, xctx.text[i].y0,
|
||||
&xx1,&yy1, &xx2,&yy2);
|
||||
#ifdef HAS_CAIRO
|
||||
if(customfont) cairo_restore(cairo_ctx);
|
||||
|
|
@ -291,14 +291,14 @@ void find_closest_text(double mx,double my)
|
|||
if(POINTINSIDE(mx,my,xx1,yy1, xx2, yy2))
|
||||
{
|
||||
r = i; distance = 0;
|
||||
dbg(2, "find_closest_text(): finding closest text, lasttext=%d, dist=%.16g\n",i,distance);
|
||||
dbg(2, "find_closest_text(): finding closest text, xctx.texts=%d, dist=%.16g\n",i,distance);
|
||||
}
|
||||
} /* end for i */
|
||||
if( distance <= threshold && r!=-1)
|
||||
{
|
||||
sel.n = r; sel.type = xTEXT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Selected find_closest_obj(double mx,double my)
|
||||
{
|
||||
|
|
|
|||
26
src/font.c
26
src/font.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: font.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -27,7 +27,7 @@ void compile_font(void)
|
|||
int code, i;
|
||||
char name[PATH_MAX];
|
||||
|
||||
currentsch = 0;
|
||||
xctx.currsch = 0;
|
||||
my_snprintf(name, S(name), "%s/systemlib/font.sch", tclgetvar("XSCHEM_SHAREDIR"));
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
|
|
@ -43,14 +43,14 @@ void compile_font(void)
|
|||
dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]);
|
||||
for(i=0;i<lastselected;i++)
|
||||
{
|
||||
character[code][i*4+1] =
|
||||
line[selectedgroup[i].col][selectedgroup[i].n].x1-code*FONTOFFSET;
|
||||
character[code][i*4+2] =
|
||||
line[selectedgroup[i].col][selectedgroup[i].n].y1+FONTHEIGHT;
|
||||
character[code][i*4+3] =
|
||||
line[selectedgroup[i].col][selectedgroup[i].n].x2-code*FONTOFFSET;
|
||||
character[code][i*4+4] =
|
||||
line[selectedgroup[i].col][selectedgroup[i].n].y2+FONTHEIGHT;
|
||||
character[code][i*4+1] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].x1-code*FONTOFFSET;
|
||||
character[code][i*4+2] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].y1+FONTHEIGHT;
|
||||
character[code][i*4+3] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].x2-code*FONTOFFSET;
|
||||
character[code][i*4+4] =
|
||||
xctx.line[selectedgroup[i].col][selectedgroup[i].n].y2+FONTHEIGHT;
|
||||
dbg(2, ",\n%.16g,%.16g,%.16g,%.16g",
|
||||
character[code][i*4+1],character[code][i*4+2],
|
||||
character[code][i*4+3],character[code][i*4+4]);
|
||||
|
|
@ -59,8 +59,8 @@ void compile_font(void)
|
|||
}
|
||||
clear_drawing();
|
||||
unselect_all();
|
||||
currentsch = 0;
|
||||
my_strncpy(schematic[currentsch], "", S(schematic[currentsch]));
|
||||
xctx.currsch = 0;
|
||||
my_strncpy(xctx.sch[xctx.currsch], "", S(xctx.sch[xctx.currsch]));
|
||||
if(event_reporting) {
|
||||
printf("xschem clear_drawing\n");
|
||||
printf("xschem unselect_all\n");
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: globals.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -34,7 +34,7 @@ int sym_txt=1;
|
|||
int event_reporting=0;
|
||||
int rainbow_colors=0;
|
||||
int manhattan_lines=0;
|
||||
FILE *errfp;
|
||||
FILE *errfp;
|
||||
char *filename=NULL; /* filename given on cmdline */
|
||||
char user_conf_dir[PATH_MAX];
|
||||
char home_dir[PATH_MAX]; /* home dir obtained via getpwuid */
|
||||
|
|
@ -59,11 +59,11 @@ int do_print=0;
|
|||
int no_readline=0;
|
||||
Colormap colormap;
|
||||
int lw=0; /* line width */
|
||||
int bus_width = BUS_WIDTH;
|
||||
int bus_width = BUS_WIDTH;
|
||||
double lw_double=0.0; /* line width */
|
||||
int fill=1; /* filled rectangles */
|
||||
int draw_pixmap=1; /* use pixmap for double buffer */
|
||||
int draw_window=0; /* 20181009 */
|
||||
int draw_window=0;
|
||||
int draw_grid=1;
|
||||
double cadgrid = CADGRID;
|
||||
double cadhalfdotsize = CADHALFDOTSIZE;
|
||||
|
|
@ -75,13 +75,13 @@ unsigned int rectcolor ; /* this is the currently used layer */
|
|||
unsigned long ui_state = 0; /* this signals that we are doing a net place,panning etc. */
|
||||
/* used to prevent nesting of some commands */
|
||||
|
||||
char *undo_dirname = NULL; /* 20150327 */
|
||||
char *undo_dirname = NULL;
|
||||
int cur_undo_ptr=0;
|
||||
int tail_undo_ptr=0;
|
||||
int head_undo_ptr=0;
|
||||
int max_undo=MAX_UNDO;
|
||||
int draw_dots=1; /*20150331 */
|
||||
int draw_single_layer=-1; /* 20151117 */
|
||||
int draw_dots=1;
|
||||
int draw_single_layer=-1;
|
||||
int check_version = 0; /* if set ensures 'v' version header line is present before loading file */
|
||||
int yyparse_error = 0;
|
||||
unsigned short enable_stretch=0;
|
||||
|
|
@ -175,15 +175,9 @@ XRectangle xrect[1] = {{0,0,0,0}};
|
|||
int xschem_h, xschem_w; /* 20171130 window size */
|
||||
double mousex,mousey; /* mouse coord. */
|
||||
double mousex_snap,mousey_snap; /* mouse coord. snapped to grid */
|
||||
double mx_double_save, my_double_save; /* 20070322 */
|
||||
double mx_double_save, my_double_save;
|
||||
|
||||
/*double xorigin=-CADWIDTH/2.0,yorigin=-CADHEIGHT/2.0; */
|
||||
double cadsnap = CADSNAP;
|
||||
|
||||
double zoom=CADINITIALZOOM;
|
||||
double mooz=1/CADINITIALZOOM;
|
||||
double xorigin=CADINITIALX;
|
||||
double yorigin=CADINITIALY;
|
||||
double *character[256]; /* array or per-char coordinates of xschem internal vector font */
|
||||
int lastselected = 0;
|
||||
int max_selected;
|
||||
|
|
@ -193,8 +187,8 @@ XPoint *gridpoint; /* pointer to array of gridpoints, used in draw() *
|
|||
Tcl_Interp *interp;
|
||||
|
||||
int do_netlist=0; /* set by process_options if user wants netllist from cmdline */
|
||||
int do_simulation=0; /* 20171007 */
|
||||
int do_waves=0; /* 20171007 */
|
||||
int do_simulation=0;
|
||||
int do_waves=0;
|
||||
int netlist_count=0; /* netlist counter incremented at any cell being netlisted */
|
||||
int top_subckt = 0;
|
||||
int spiceprefix = 1;
|
||||
|
|
@ -206,21 +200,21 @@ int prepared_netlist_structs=0;
|
|||
int prepared_hilight_structs=0;
|
||||
int prepared_hash_instances=0;
|
||||
int prepared_hash_wires=0;
|
||||
int horizontal_move=0; /* 20171023 */
|
||||
int vertical_move=0; /* 20171023 */
|
||||
int horizontal_move=0;
|
||||
int vertical_move=0;
|
||||
int modified = 0;
|
||||
int color_ps=-1;
|
||||
int only_probes=0; /* 20110112 */
|
||||
int only_probes=0;
|
||||
int hilight_color=0;
|
||||
int pending_fullzoom=0;
|
||||
int split_files=0; /* split netlist files 20081202 */
|
||||
char *netlist_dir=NULL; /* user set netlist directory via cmd-option or menu or xschemrc */
|
||||
char user_top_netl_name[PATH_MAX] = ""; /* user set netlist name via cmd option -N <name> */
|
||||
XColor xcolor_array[256];/* 20171109 */
|
||||
Visual *visual; /*20171111 */
|
||||
int dark_colorscheme=1; /* 20171113 */
|
||||
double color_dim=0.0; /* 20171123 */
|
||||
int no_undo=0; /* 20171204 */
|
||||
XColor xcolor_array[256];
|
||||
Visual *visual;
|
||||
int dark_colorscheme=1;
|
||||
double color_dim=0.0;
|
||||
int no_undo=0;
|
||||
int enable_drill=0; /* 20171211 pass net hilights through components with 'propagate_to' property set on pins */
|
||||
struct instpinentry *instpintable[NBOXES][NBOXES];
|
||||
struct wireentry *wiretable[NBOXES][NBOXES];
|
||||
|
|
@ -237,7 +231,7 @@ cairo_t *cairo_ctx, *cairo_save_ctx;
|
|||
XRenderPictFormat *format;
|
||||
|
||||
#if HAS_XCB==1
|
||||
xcb_connection_t *xcbconn; /* 20171125 */
|
||||
xcb_connection_t *xcbconn;
|
||||
xcb_render_pictforminfo_t format_rgb, format_rgba;
|
||||
xcb_screen_t *screen_xcb;
|
||||
xcb_visualtype_t *visual_xcb;
|
||||
|
|
@ -260,44 +254,6 @@ double cairo_vert_correct=0.0;
|
|||
double nocairo_vert_correct=0.0;
|
||||
int show_erc=1;
|
||||
int hilight_nets=0;
|
||||
|
||||
/* following data is relative to the current schematic */
|
||||
int max_texts;
|
||||
int max_wires;
|
||||
int max_instances;
|
||||
int max_symbols;
|
||||
int *max_rects;
|
||||
int *max_polygons;
|
||||
int *max_arcs;
|
||||
int *max_lines;
|
||||
Wire *wire;
|
||||
int lastwire = 0;
|
||||
Instance *inst_ptr; /* Pointer to element INSTANCE */
|
||||
int lastinst = 0;
|
||||
Instdef *instdef; /* Pointer to element definition */
|
||||
int lastinstdef = 0;
|
||||
Box **rect;
|
||||
int *lastrect;
|
||||
xPolygon **polygon;
|
||||
int *lastpolygon;
|
||||
xArc **arc;
|
||||
int *lastarc;
|
||||
Line **line;
|
||||
int *lastline;
|
||||
Text *textelement;
|
||||
int lasttext=0;
|
||||
char schematic[CADMAXHIER][PATH_MAX];
|
||||
int currentsch = 0;
|
||||
char current_name[PATH_MAX];
|
||||
char *schprop=NULL; /* spice */
|
||||
char *schtedaxprop=NULL; /* tEDAx */
|
||||
char *schvhdlprop=NULL; /* vhdl property string */
|
||||
char *schsymbolprop=NULL; /* symbol property string */
|
||||
char *schverilogprop=NULL;/* verilog */
|
||||
char *xschem_version_string=NULL;
|
||||
char file_version[100];
|
||||
char *sch_path[CADMAXHIER];
|
||||
int sch_inst_number[CADMAXHIER];
|
||||
int previous_instance[CADMAXHIER]; /* to remember the instance we came from when going up the hier. */
|
||||
Zoom zoom_array[CADMAXHIER];
|
||||
|
||||
/* following data is relative to the current schematic */
|
||||
Xschem_ctx xctx;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: hash_iterator.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -33,9 +33,9 @@ static unsigned short *wireflag=NULL;
|
|||
|
||||
void init_inst_iterator(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
dbg(3, "init_inst_iterator(): lastinst=%d\n", lastinst);
|
||||
my_realloc(135, &instflag, lastinst*sizeof(unsigned short));
|
||||
memset(instflag, 0, lastinst*sizeof(unsigned short));
|
||||
dbg(3, "init_inst_iterator(): xctx.instances=%d\n", xctx.instances);
|
||||
my_realloc(135, &instflag, xctx.instances*sizeof(unsigned short));
|
||||
memset(instflag, 0, xctx.instances*sizeof(unsigned short));
|
||||
/* calculate square 4 1st corner of drawing area */
|
||||
x1a=floor(x1/BOXSIZE) ;
|
||||
y1a=floor(y1/BOXSIZE) ;
|
||||
|
|
@ -58,7 +58,7 @@ void init_inst_iterator(double x1, double y1, double x2, double y2)
|
|||
struct instentry *inst_iterator_next()
|
||||
{
|
||||
struct instentry *ptr;
|
||||
dbg(3, "inst_iterator_next(): lastinst=%d\n", lastinst);
|
||||
dbg(3, "inst_iterator_next(): xctx.instances=%d\n", xctx.instances);
|
||||
while(1) {
|
||||
while(instanceptr) {
|
||||
ptr = instanceptr;
|
||||
|
|
@ -91,9 +91,9 @@ struct instentry *inst_iterator_next()
|
|||
|
||||
void init_wire_iterator(double x1, double y1, double x2, double y2)
|
||||
{
|
||||
dbg(3, "init_wire_iterator(): lastwire=%d\n", lastwire);
|
||||
my_realloc(136, &wireflag, lastwire*sizeof(unsigned short));
|
||||
memset(wireflag, 0, lastwire*sizeof(unsigned short));
|
||||
dbg(3, "init_wire_iterator(): xctx.wires=%d\n", xctx.wires);
|
||||
my_realloc(136, &wireflag, xctx.wires*sizeof(unsigned short));
|
||||
memset(wireflag, 0, xctx.wires*sizeof(unsigned short));
|
||||
/* calculate square 4 1st corner of drawing area */
|
||||
x1a=floor(x1/BOXSIZE) ;
|
||||
y1a=floor(y1/BOXSIZE) ;
|
||||
|
|
@ -116,13 +116,13 @@ void init_wire_iterator(double x1, double y1, double x2, double y2)
|
|||
struct wireentry *wire_iterator_next()
|
||||
{
|
||||
struct wireentry *ptr;
|
||||
dbg(3, "wire_iterator_next(): lastwire=%d\n", lastwire);
|
||||
dbg(3, "wire_iterator_next(): xctx.wires=%d\n", xctx.wires);
|
||||
while(1) {
|
||||
while(wireptr) {
|
||||
ptr = wireptr;
|
||||
wireptr = wireptr -> next;
|
||||
if(!wireflag[ptr->n]) {
|
||||
wireflag[ptr->n]=1;
|
||||
wireflag[ptr->n]=1;
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
372
src/hilight.c
372
src/hilight.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: hilight.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include "xschem.h"
|
||||
|
||||
static struct hilight_hashentry *hilight_table[HASHSIZE];
|
||||
static int nelements=0; /* 20161221 */
|
||||
static int nelements=0;
|
||||
static int *inst_color=NULL;
|
||||
|
||||
static unsigned int hash(const char *tok)
|
||||
|
|
@ -32,7 +32,7 @@ static unsigned int hash(const char *tok)
|
|||
char *str;
|
||||
int c;
|
||||
|
||||
str=sch_path[currentsch];
|
||||
str=xctx.sch_path[xctx.currsch];
|
||||
while ( (c = *tok++) )
|
||||
hash = c + (hash << 6) + (hash << 16) - hash;
|
||||
while ( (c = *str++) )
|
||||
|
|
@ -80,11 +80,11 @@ void free_hilight_hash(void) /* remove the whole hash table */
|
|||
hilight_table[i] = free_hilight_entry( hilight_table[i] );
|
||||
}
|
||||
dbg(2, "free_hilight_hash(): : nelements=%d\n", nelements);
|
||||
nelements=0; /* 20161221 */
|
||||
nelements=0;
|
||||
}
|
||||
|
||||
|
||||
int get_color(int value)
|
||||
int get_color(int value)
|
||||
{
|
||||
int x;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ void create_plot_cmd(int viewer)
|
|||
tok = entry->token;
|
||||
node_entry = bus_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", "");
|
||||
if(tok[0] == '#') tok++;
|
||||
if(node_entry && !strcmp(sch_path[currentsch], entry->path) &&
|
||||
if(node_entry && !strcmp(xctx.sch_path[xctx.currsch], entry->path) &&
|
||||
(node_entry->d.port == 0 || !strcmp(entry->path, ".") )) {
|
||||
c = get_color(entry->value);
|
||||
sprintf(color_str, "%02x%02x%02x", xcolor_array[c].red>>8, xcolor_array[c].green>>8, xcolor_array[c].blue>>8);
|
||||
|
|
@ -149,7 +149,7 @@ void create_plot_cmd(int viewer)
|
|||
char *t=NULL, *p=NULL;
|
||||
my_strdup(241, &t, tok);
|
||||
my_strdup2(245, &p, (entry->path)+1);
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
|
||||
") p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
my_free(759, &p);
|
||||
my_free(760, &t);
|
||||
|
|
@ -183,14 +183,14 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int remov
|
|||
struct hilight_hashentry *entry, *saveptr, **preventry;
|
||||
char *ptr;
|
||||
int s ;
|
||||
int depth=0; /* 20161221 */
|
||||
int depth=0;
|
||||
|
||||
if(token==NULL) return NULL;
|
||||
hashcode=hash(token);
|
||||
index=hashcode % HASHSIZE;
|
||||
entry=hilight_table[index];
|
||||
preventry=&hilight_table[index];
|
||||
depth=0; /* 20161221 */
|
||||
depth=0;
|
||||
while(1)
|
||||
{
|
||||
if( !entry ) /* empty slot */
|
||||
|
|
@ -198,23 +198,23 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int remov
|
|||
if( remove==XINSERT ) /* insert data */
|
||||
{
|
||||
s=sizeof( struct hilight_hashentry );
|
||||
ptr= my_malloc(137, s );
|
||||
ptr= my_malloc(137, s );
|
||||
entry=(struct hilight_hashentry *)ptr;
|
||||
entry->next = NULL;
|
||||
entry->token = NULL;
|
||||
my_strdup(138, &(entry->token),token);
|
||||
entry->path = NULL;
|
||||
my_strdup(139, &(entry->path),sch_path[currentsch]);
|
||||
my_strdup(139, &(entry->path),xctx.sch_path[xctx.currsch]);
|
||||
entry->value=value;
|
||||
entry->hash=hashcode;
|
||||
*preventry=entry;
|
||||
hilight_nets=1; /* some nets should be hilighted .... 07122002 */
|
||||
nelements++; /* 20161221 */
|
||||
nelements++;
|
||||
}
|
||||
return NULL; /* whether inserted or not return NULL since it was not in */
|
||||
}
|
||||
if( entry -> hash==hashcode && !strcmp(token,entry->token) &&
|
||||
!strcmp(sch_path[currentsch], entry->path) ) /* found matching tok */
|
||||
!strcmp(xctx.sch_path[xctx.currsch], entry->path) ) /* found matching tok */
|
||||
{
|
||||
if(remove==XDELETE) /* remove token from the hash table ... */
|
||||
{
|
||||
|
|
@ -232,10 +232,10 @@ struct hilight_hashentry *hilight_lookup(const char *token, int value, int remov
|
|||
}
|
||||
preventry=&entry->next; /* descend into the list. */
|
||||
entry = entry->next;
|
||||
depth++; /* 20161221 */
|
||||
if(debug_var>=2)
|
||||
if(depth>200)
|
||||
fprintf(errfp, "hilight_lookup(): deep into the list: %d, index=%d, token=%s, hashcode=%d\n",
|
||||
depth++;
|
||||
if(debug_var>=2)
|
||||
if(depth>200)
|
||||
fprintf(errfp, "hilight_lookup(): deep into the list: %d, index=%d, token=%s, hashcode=%d\n",
|
||||
depth, index, token, hashcode);
|
||||
}
|
||||
}
|
||||
|
|
@ -294,8 +294,8 @@ void delete_hilight_net(void)
|
|||
}
|
||||
|
||||
hilight_nets=0;
|
||||
for(i=0;i<lastinst;i++) {
|
||||
inst_ptr[i].flags &= ~4 ;
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
xctx.inst[i].flags &= ~4 ;
|
||||
}
|
||||
dbg(1, "delete_hilight_net(): clearing\n");
|
||||
my_free(766, &inst_color);
|
||||
|
|
@ -310,38 +310,38 @@ void hilight_parent_pins(void)
|
|||
char *pin_node = NULL;
|
||||
char *net_node=NULL;
|
||||
int mult, net_mult, inst_number;
|
||||
|
||||
|
||||
if(!hilight_nets) return;
|
||||
prepare_netlist_structs(0);
|
||||
i=previous_instance[currentsch];
|
||||
inst_number = sch_inst_number[currentsch+1];
|
||||
dbg(1, "hilight_parent_pins(): previous_instance=%d\n", previous_instance[currentsch]);
|
||||
i=xctx.previous_instance[xctx.currsch];
|
||||
inst_number = xctx.sch_inst_number[xctx.currsch+1];
|
||||
dbg(1, "hilight_parent_pins(): xctx.previous_instance=%d\n", xctx.previous_instance[xctx.currsch]);
|
||||
dbg(1, "hilight_parent_pins(): inst_number=%d\n", inst_number);
|
||||
|
||||
rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER];
|
||||
rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
|
||||
for(j=0;j<rects;j++)
|
||||
{
|
||||
if(!inst_ptr[i].node[j]) continue;
|
||||
my_strdup(445, &net_node, expandlabel(inst_ptr[i].node[j], &net_mult));
|
||||
if(!xctx.inst[i].node[j]) continue;
|
||||
my_strdup(445, &net_node, expandlabel(xctx.inst[i].node[j], &net_mult));
|
||||
dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node);
|
||||
pin_name = get_tok_value((inst_ptr[i].ptr+instdef)->boxptr[PINLAYER][j].prop_ptr,"name",0);
|
||||
pin_name = get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(!pin_name[0]) continue;
|
||||
my_strdup(450, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node);
|
||||
|
||||
for(k = 1; k<=mult; k++) {
|
||||
currentsch++;
|
||||
xctx.currsch++;
|
||||
entry = bus_hilight_lookup(find_nth(pin_node, ',', k), 0, XLOOKUP);
|
||||
currentsch--;
|
||||
xctx.currsch--;
|
||||
if(entry)
|
||||
{
|
||||
bus_hilight_lookup(find_nth(net_node, ',',
|
||||
bus_hilight_lookup(find_nth(net_node, ',',
|
||||
((inst_number - 1) * mult + k - 1) % net_mult + 1), entry->value, XINSERT);
|
||||
}
|
||||
else
|
||||
{
|
||||
bus_hilight_lookup(find_nth(net_node, ',',
|
||||
bus_hilight_lookup(find_nth(net_node, ',',
|
||||
((inst_number - 1) * mult + k - 1) % net_mult + 1), 0, XDELETE);
|
||||
}
|
||||
}
|
||||
|
|
@ -359,36 +359,36 @@ void hilight_child_pins(void)
|
|||
struct hilight_hashentry *entry;
|
||||
int mult, net_mult, i, inst_number;
|
||||
|
||||
i = previous_instance[currentsch-1];
|
||||
i = xctx.previous_instance[xctx.currsch-1];
|
||||
if(!hilight_nets) return;
|
||||
prepare_netlist_structs(0);
|
||||
rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER];
|
||||
inst_number = sch_inst_number[currentsch];
|
||||
rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER];
|
||||
inst_number = xctx.sch_inst_number[xctx.currsch];
|
||||
for(j=0;j<rects;j++)
|
||||
{
|
||||
dbg(1, "inst_number=%d\n", inst_number);
|
||||
|
||||
if(!inst_ptr[i].node[j]) continue;
|
||||
my_strdup(508, &net_node, expandlabel(inst_ptr[i].node[j], &net_mult));
|
||||
if(!xctx.inst[i].node[j]) continue;
|
||||
my_strdup(508, &net_node, expandlabel(xctx.inst[i].node[j], &net_mult));
|
||||
dbg(1, "hilight_child_pins(): net_node=%s\n", net_node);
|
||||
pin_name = get_tok_value((inst_ptr[i].ptr+instdef)->boxptr[PINLAYER][j].prop_ptr,"name",0);
|
||||
pin_name = get_tok_value((xctx.inst[i].ptr+ xctx.sym)->rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(!pin_name[0]) continue;
|
||||
my_strdup(521, &pin_node, expandlabel(pin_name, &mult));
|
||||
dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node);
|
||||
for(k = 1; k<=mult; k++) {
|
||||
dbg(1, "hilight_child_pins():looking nth net:%d, k=%d, inst_number=%d, mult=%d\n",
|
||||
dbg(1, "hilight_child_pins():looking nth net:%d, k=%d, inst_number=%d, mult=%d\n",
|
||||
(inst_number-1)*mult+k, k, inst_number, mult);
|
||||
dbg(1, "hilight_child_pins():looking net:%s\n", find_nth(net_node, ',',
|
||||
dbg(1, "hilight_child_pins():looking net:%s\n", find_nth(net_node, ',',
|
||||
((inst_number - 1) * mult + k - 1) % net_mult + 1));
|
||||
currentsch--;
|
||||
xctx.currsch--;
|
||||
entry = bus_hilight_lookup(find_nth(net_node, ',', ((inst_number - 1) * mult + k - 1) % net_mult + 1), 0, XLOOKUP);
|
||||
currentsch++;
|
||||
xctx.currsch++;
|
||||
if(entry) {
|
||||
bus_hilight_lookup(find_nth(pin_node, ',', k), entry->value, XINSERT);
|
||||
bus_hilight_lookup(find_nth(pin_node, ',', k), entry->value, XINSERT);
|
||||
dbg(1, "hilight_child_pins(): inserting: %s\n", find_nth(pin_node, ',', k));
|
||||
}
|
||||
else {
|
||||
bus_hilight_lookup(find_nth(pin_node, ',', k), 0, XDELETE);
|
||||
bus_hilight_lookup(find_nth(pin_node, ',', k), 0, XDELETE);
|
||||
dbg(1, "hilight_child_pins(): deleting: %s\n", find_nth(pin_node, ',', k));
|
||||
}
|
||||
} /* for(k..) */
|
||||
|
|
@ -398,8 +398,8 @@ void hilight_child_pins(void)
|
|||
}
|
||||
|
||||
|
||||
int bus_search(const char*s)
|
||||
{
|
||||
int bus_search(const char*s)
|
||||
{
|
||||
int c, bus=0;
|
||||
while( (c=*s++) ) {
|
||||
if(c=='[') bus=1;
|
||||
|
|
@ -413,7 +413,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
int save_draw, hilight_layer = 7;
|
||||
int i,c, col = 7,tmp,bus=0;
|
||||
const char *str;
|
||||
char *type;
|
||||
char *type;
|
||||
int has_token;
|
||||
const char empty_string[] = "";
|
||||
char *tmpname=NULL;
|
||||
|
|
@ -433,8 +433,8 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
#endif
|
||||
dbg(1, "search():val=%s\n", val);
|
||||
if(what==ADD || what==NOW) {
|
||||
|
||||
if(!sel) { /* 20190525 */
|
||||
|
||||
if(!sel) {
|
||||
col=hilight_color;
|
||||
hilight_layer = get_color(col);
|
||||
if(incr_hilight) hilight_color++;
|
||||
|
|
@ -442,27 +442,27 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
has_token = 0;
|
||||
prepare_netlist_structs(0);
|
||||
bus=bus_search(val);
|
||||
for(i=0;i<lastinst;i++) {
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!strcmp(tok,"cell::name")) {
|
||||
has_token = (inst_ptr[i].name != NULL) && inst_ptr[i].name[0];
|
||||
str = inst_ptr[i].name;
|
||||
has_token = (xctx.inst[i].name != NULL) && xctx.inst[i].name[0];
|
||||
str = xctx.inst[i].name;
|
||||
} else if(!strncmp(tok,"cell::", 6)) { /* cell::xxx looks for xxx in global symbol attributes */
|
||||
my_strdup(142, &tmpname,get_tok_value((inst_ptr[i].ptr+instdef)->prop_ptr,tok+6,0));
|
||||
my_strdup(142, &tmpname,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,tok+6,0));
|
||||
has_token = get_tok_size;
|
||||
if(tmpname) {
|
||||
str = tmpname;
|
||||
} else {
|
||||
str = empty_string;
|
||||
}
|
||||
} else if(!strcmp(tok,"propstring")) { /* 20170408 */
|
||||
has_token = (inst_ptr[i].prop_ptr != NULL) && inst_ptr[i].prop_ptr[0];
|
||||
str = inst_ptr[i].prop_ptr;
|
||||
} else if(!strcmp(tok,"propstring")) {
|
||||
has_token = (xctx.inst[i].prop_ptr != NULL) && xctx.inst[i].prop_ptr[0];
|
||||
str = xctx.inst[i].prop_ptr;
|
||||
} else {
|
||||
str = get_tok_value(inst_ptr[i].prop_ptr, tok,0);
|
||||
str = get_tok_value(xctx.inst[i].prop_ptr, tok,0);
|
||||
has_token = get_tok_size;
|
||||
}
|
||||
dbg(1, "search(): inst=%d, tok=%s, val=%s \n", i,tok, str);
|
||||
|
||||
|
||||
if(bus && sub) {
|
||||
dbg(1, "search(): doing substr search on bus sig:%s inst=%d tok=%s val=%s\n", str,i,tok,val);
|
||||
str=expandlabel(str,&tmp);
|
||||
|
|
@ -470,41 +470,41 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
if(str && has_token) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub) || /* 20071120 regex instead of strcmp */
|
||||
(!strcmp(str, val) && sub && !bus) || (strstr(str,val) && sub && bus))
|
||||
(!strcmp(str, val) && sub && !bus) || (strstr(str,val) && sub && bus))
|
||||
#else
|
||||
if ((!strcmp(str, val) && sub && !bus) || (strstr(str,val) && sub && bus))
|
||||
#endif
|
||||
{
|
||||
if(!sel) { /*20190525 */
|
||||
type = (inst_ptr[i].ptr+instdef)->type;
|
||||
if(!sel) {
|
||||
type = (xctx.inst[i].ptr+ xctx.sym)->type;
|
||||
if( type && IS_LABEL_SH_OR_PIN(type) ) {
|
||||
if(!bus_hilight_lookup(inst_ptr[i].node[0], col, XINSERT)) hilight_nets = 1;
|
||||
if(!bus_hilight_lookup(xctx.inst[i].node[0], col, XINSERT)) hilight_nets = 1;
|
||||
if(what==NOW) for(c=0;c<cadlayers;c++)
|
||||
draw_symbol(NOW, hilight_layer, i,c,0,0,0.0,0.0);
|
||||
}
|
||||
else {
|
||||
dbg(1, "search(): setting hilight flag on inst %d\n",i);
|
||||
hilight_nets=1;
|
||||
inst_ptr[i].flags |= 4;
|
||||
xctx.inst[i].flags |= 4;
|
||||
if(what==NOW) for(c=0;c<cadlayers;c++)
|
||||
draw_symbol(NOW, hilight_layer, i,c,0,0,0.0,0.0); /* 20150804 */
|
||||
draw_symbol(NOW, hilight_layer, i,c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
if(sel==1) {
|
||||
select_element(i, SELECTED, 1, 0);
|
||||
ui_state|=SELECTION;
|
||||
}
|
||||
|
||||
|
||||
if(sel==-1) { /* 20171211 unselect */
|
||||
select_element(i, 0, 1, 0);
|
||||
}
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for(i=0;i<lastwire;i++) {
|
||||
str = get_tok_value(wire[i].prop_ptr, tok,0);
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
str = get_tok_value(xctx.wire[i].prop_ptr, tok,0);
|
||||
if(get_tok_size ) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) || /* 20071120 regex instead of strcmp */
|
||||
|
|
@ -513,22 +513,22 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
if (!strcmp(str, val) && sub)
|
||||
#endif
|
||||
{
|
||||
dbg(2, "search(): wire=%d, tok=%s, val=%s \n", i,tok, wire[i].node);
|
||||
dbg(2, "search(): wire=%d, tok=%s, val=%s \n", i,tok, xctx.wire[i].node);
|
||||
if(!sel) {
|
||||
bus_hilight_lookup(wire[i].node, col, XINSERT);
|
||||
bus_hilight_lookup(xctx.wire[i].node, col, XINSERT);
|
||||
if(what == NOW) {
|
||||
if(wire[i].bus) /* 20171201 */
|
||||
if(xctx.wire[i].bus)
|
||||
drawline(hilight_layer, THICK,
|
||||
wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0);
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
else
|
||||
drawline(hilight_layer, NOW,
|
||||
wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0);
|
||||
if(cadhalfdotsize*mooz>=0.7) {
|
||||
if( wire[i].end1 >1 ) {
|
||||
filledarc(hilight_layer, NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
if(cadhalfdotsize*xctx.mooz>=0.7) {
|
||||
if( xctx.wire[i].end1 >1 ) {
|
||||
filledarc(hilight_layer, NOW, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( wire[i].end2 >1 ) {
|
||||
filledarc(hilight_layer, NOW, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx.wire[i].end2 >1 ) {
|
||||
filledarc(hilight_layer, NOW, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -547,8 +547,8 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
}
|
||||
}
|
||||
}
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<lastline[c];i++) {
|
||||
str = get_tok_value(line[c][i].prop_ptr, tok,0);
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx.lines[c];i++) {
|
||||
str = get_tok_value(xctx.line[c][i].prop_ptr, tok,0);
|
||||
if(get_tok_size) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) ||
|
||||
|
|
@ -567,13 +567,13 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
found = 1;
|
||||
}
|
||||
else {
|
||||
dbg(2, "search(): not found line=%d col=%d, tok=%s, val=%s search=%s\n",
|
||||
dbg(2, "search(): not found line=%d col=%d, tok=%s, val=%s search=%s\n",
|
||||
i, c, tok, str, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<lastrect[c];i++) {
|
||||
str = get_tok_value(rect[c][i].prop_ptr, tok,0);
|
||||
if(sel) for(c = 0; c < cadlayers; c++) for(i=0;i<xctx.rects[c];i++) {
|
||||
str = get_tok_value(xctx.rect[c][i].prop_ptr, tok,0);
|
||||
if(get_tok_size) {
|
||||
#ifdef __unix__
|
||||
if( (!regexec(&re, str,0 , NULL, 0) && !sub ) ||
|
||||
|
|
@ -592,7 +592,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
found = 1;
|
||||
}
|
||||
else {
|
||||
dbg(2, "search(): not found rect=%d col=%d, tok=%s, val=%s search=%s\n",
|
||||
dbg(2, "search(): not found rect=%d col=%d, tok=%s, val=%s search=%s\n",
|
||||
i, c, tok, str, val);
|
||||
}
|
||||
}
|
||||
|
|
@ -622,7 +622,7 @@ int search(const char *tok, const char *val, int sub, int sel, int what)
|
|||
|
||||
|
||||
|
||||
/* 20171211 */
|
||||
|
||||
/* "drill" option (pass through resistors or pass gates or whatever elements with */
|
||||
/* 'propagate_to' properties set on pins) */
|
||||
void drill_hilight(void)
|
||||
|
|
@ -630,8 +630,8 @@ void drill_hilight(void)
|
|||
char *netname=NULL, *propagated_net=NULL;
|
||||
int mult=0;
|
||||
int found;
|
||||
Instdef *symbol;
|
||||
Box *rect;
|
||||
xSymbol *symbol;
|
||||
xRect *rct;
|
||||
int i, j, npin;
|
||||
const char *propagate_str;
|
||||
int propagate;
|
||||
|
|
@ -640,26 +640,24 @@ void drill_hilight(void)
|
|||
|
||||
prepare_netlist_structs(0);
|
||||
count=0;
|
||||
while(1) {
|
||||
while(1) {
|
||||
found=0;
|
||||
count++;
|
||||
for(i=0; i<lastinst;i++) {
|
||||
symbol = inst_ptr[i].ptr+instdef;
|
||||
for(i=0; i<xctx.instances;i++) {
|
||||
symbol = xctx.inst[i].ptr+xctx.sym;
|
||||
npin = symbol->rects[PINLAYER];
|
||||
rect=symbol->boxptr[PINLAYER];
|
||||
rct=symbol->rect[PINLAYER];
|
||||
for(j=0; j<npin;j++) {
|
||||
my_strdup(143, &netname, net_name(i, j, &mult, 1));
|
||||
propagate_str=get_tok_value(rect[j].prop_ptr, "propagate_to", 0);
|
||||
propagate_str=get_tok_value(rct[j].prop_ptr, "propagate_to", 0);
|
||||
if(propagate_str[0] && (entry=bus_hilight_lookup(netname, 0, XLOOKUP))) {
|
||||
propagate = atoi(propagate_str);
|
||||
my_strdup(144, &propagated_net, net_name(i, propagate, &mult, 1)); /* get net to propagate highlight to... */
|
||||
my_strdup(144, &propagated_net, net_name(i, propagate, &mult, 1)); /* get net to propagate hilight to...*/
|
||||
propag_entry = bus_hilight_lookup(propagated_net, entry->value, XINSERT); /* add net to highlight list */
|
||||
if(!propag_entry) {
|
||||
/* fprintf(errfp, "inst %s: j=%d count=%d propagate=%d --> net %s, propagate to --> %s color %d\n", */
|
||||
/* inst_ptr[i].instname, j, count, propagate, netname, net_name(i, propagate, &mult, 1), entry->value); */
|
||||
found=1; /* keep looping until no more nets are found. */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} /* for(j...) */
|
||||
} /* for(i...) */
|
||||
|
|
@ -691,14 +689,14 @@ static void send_net_to_gaw(int simtype, const char *node)
|
|||
int c, k, tok_mult;
|
||||
struct node_hashentry *node_entry;
|
||||
const char *expanded_tok;
|
||||
const char *tok;
|
||||
const char *tok;
|
||||
char color_str[8];
|
||||
|
||||
|
||||
if(!node || !node[0]) return;
|
||||
tok = node;
|
||||
node_entry = bus_hash_lookup(tok, "", XLOOKUP, 0, "", "", "", "");
|
||||
if(tok[0] == '#') tok++;
|
||||
if(node_entry && (node_entry->d.port == 0 || !strcmp(sch_path[currentsch], ".") )) {
|
||||
if(node_entry && (node_entry->d.port == 0 || !strcmp(xctx.sch_path[xctx.currsch], ".") )) {
|
||||
char *t=NULL, *p=NULL;
|
||||
c = get_color(hilight_color);
|
||||
sprintf(color_str, "%02x%02x%02x", xcolor_array[c].red>>8, xcolor_array[c].green>>8, xcolor_array[c].blue>>8);
|
||||
|
|
@ -706,9 +704,9 @@ static void send_net_to_gaw(int simtype, const char *node)
|
|||
tcleval("if { ![info exists gaw_fd] } { gaw_setup_tcp }\n");
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
my_strdup(246, &t, find_nth(expanded_tok, ',', k));
|
||||
my_strdup2(254, &p, sch_path[currentsch]+1);
|
||||
my_strdup2(254, &p, xctx.sch_path[xctx.currsch]+1);
|
||||
if(simtype == 0 ) { /* spice */
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
|
||||
") p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
} else { /* Xyce */
|
||||
char *c=p;
|
||||
|
|
@ -716,7 +714,7 @@ static void send_net_to_gaw(int simtype, const char *node)
|
|||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
}
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t),
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t),
|
||||
" p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
}
|
||||
}
|
||||
|
|
@ -729,7 +727,7 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
{
|
||||
int c, k, tok_mult;
|
||||
const char *expanded_tok;
|
||||
const char *tok;
|
||||
const char *tok;
|
||||
char color_str[8];
|
||||
char *t=NULL, *p=NULL;
|
||||
|
||||
|
|
@ -742,9 +740,9 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
tcleval("if { ![info exists gaw_fd] } { gaw_setup_tcp }\n");
|
||||
for(k=1; k<=tok_mult; k++) {
|
||||
my_strdup(1179, &t, find_nth(expanded_tok, ',', k));
|
||||
my_strdup2(1180, &p, sch_path[currentsch]+1);
|
||||
my_strdup2(1180, &p, xctx.sch_path[xctx.currsch]+1);
|
||||
if(!simtype) { /* spice */
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar i(", currentsch>0 ? "v." : "",
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar i(", xctx.currsch>0 ? "v." : "",
|
||||
strtolower(p), strtolower(t),
|
||||
") p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
} else { /* Xyce */
|
||||
|
|
@ -753,15 +751,15 @@ static void send_current_to_gaw(int simtype, const char *node)
|
|||
if(*c == '.') *c = ':'; /* Xyce uses : as path separator */
|
||||
c++;
|
||||
}
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar ", currentsch>0 ? "V:" : "",
|
||||
strtoupper(p), strtoupper( currentsch>0 ? t+1 : t ), "#branch",
|
||||
Tcl_VarEval(interp, "puts $gaw_fd {copyvar ", xctx.currsch>0 ? "V:" : "",
|
||||
strtoupper(p), strtoupper( xctx.currsch>0 ? t+1 : t ), "#branch",
|
||||
" p0 #", color_str, "}\nvwait gaw_fd\n", NULL);
|
||||
|
||||
}
|
||||
}
|
||||
my_free(1181, &p);
|
||||
my_free(1182, &t);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -781,43 +779,43 @@ void hilight_net(int to_waveform)
|
|||
n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
{
|
||||
case WIRE:
|
||||
case WIRE:
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, wire[n].node, PATH_MAX));
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, xctx.wire[n].node, PATH_MAX));
|
||||
fflush(stdout);
|
||||
}
|
||||
hilight_nets=1;
|
||||
if(!bus_hilight_lookup(wire[n].node, hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, wire[n].node);
|
||||
if(!bus_hilight_lookup(xctx.wire[n].node, hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx.wire[n].node);
|
||||
if(incr_hilight) hilight_color++;
|
||||
}
|
||||
break;
|
||||
case ELEMENT:
|
||||
type = (inst_ptr[n].ptr+instdef)->type;
|
||||
if( type && inst_ptr[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
type = (xctx.inst[n].ptr+ xctx.sym)->type;
|
||||
if( type && xctx.inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, inst_ptr[n].node[0], PATH_MAX));
|
||||
printf("xschem search exact %d lab %s\n", 0, escape_chars(s, xctx.inst[n].node[0], PATH_MAX));
|
||||
fflush(stdout);
|
||||
}
|
||||
if(!bus_hilight_lookup(inst_ptr[n].node[0], hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, inst_ptr[n].node[0]);
|
||||
if(!bus_hilight_lookup(xctx.inst[n].node[0], hilight_color, XINSERT)) {
|
||||
if(to_waveform == GAW) send_net_to_gaw(sim_is_xyce, xctx.inst[n].node[0]);
|
||||
hilight_nets=1;
|
||||
if(incr_hilight) hilight_color++;
|
||||
}
|
||||
} else {
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d name %s\n", 0, escape_chars(s, inst_ptr[n].instname, PATH_MAX));
|
||||
printf("xschem search exact %d name %s\n", 0, escape_chars(s, xctx.inst[n].instname, PATH_MAX));
|
||||
fflush(stdout);
|
||||
}
|
||||
dbg(1, "hilight_net(): setting hilight flag on inst %d\n",n);
|
||||
hilight_nets=1;
|
||||
inst_ptr[n].flags |= 4;
|
||||
xctx.inst[n].flags |= 4;
|
||||
}
|
||||
if(type && (!strcmp(type, "current_probe") || !strcmp(type, "vsource")) ) {
|
||||
if(to_waveform == GAW) send_current_to_gaw(sim_is_xyce, inst_ptr[n].instname);
|
||||
if(to_waveform == GAW) send_current_to_gaw(sim_is_xyce, xctx.inst[n].instname);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -845,33 +843,33 @@ void unhilight_net(void)
|
|||
n = selectedgroup[i].n;
|
||||
switch(selectedgroup[i].type)
|
||||
{
|
||||
case WIRE:
|
||||
case WIRE:
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d lab %s\n", 1, escape_chars(s, wire[n].node, PATH_MAX));
|
||||
printf("xschem search exact %d lab %s\n", 1, escape_chars(s, xctx.wire[n].node, PATH_MAX));
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
bus_hilight_lookup(wire[n].node, hilight_color, XDELETE);
|
||||
bus_hilight_lookup(xctx.wire[n].node, hilight_color, XDELETE);
|
||||
break;
|
||||
case ELEMENT:
|
||||
type = (inst_ptr[n].ptr+instdef)->type;
|
||||
type = (xctx.inst[n].ptr+ xctx.sym)->type;
|
||||
if( type &&
|
||||
inst_ptr[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
xctx.inst[n].node && IS_LABEL_SH_OR_PIN(type) ) { /* instance must have a pin! */
|
||||
if(event_reporting) {
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
bus_hilight_lookup(inst_ptr[n].node[0], hilight_color, XDELETE);
|
||||
bus_hilight_lookup(xctx.inst[n].node[0], hilight_color, XDELETE);
|
||||
} else {
|
||||
if(event_reporting) {
|
||||
char s[PATH_MAX];
|
||||
printf("xschem search exact %d name %s\n", 1, escape_chars(s, inst_ptr[n].instname, PATH_MAX));
|
||||
printf("xschem search exact %d name %s\n", 1, escape_chars(s, xctx.inst[n].instname, PATH_MAX));
|
||||
printf("xschem unhilight\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
inst_ptr[n].flags &= ~4;
|
||||
xctx.inst[n].flags &= ~4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -882,7 +880,7 @@ void unhilight_net(void)
|
|||
|
||||
void redraw_hilights(void)
|
||||
{
|
||||
Box boundbox;
|
||||
xRect boundbox;
|
||||
if(!has_x) return;
|
||||
calc_drawing_bbox(&boundbox, 2);
|
||||
bbox(BEGIN, 0.0 , 0.0 , 0.0 , 0.0);
|
||||
|
|
@ -898,89 +896,89 @@ void draw_hilight_net(int on_window)
|
|||
char *type=NULL;
|
||||
int i,c;
|
||||
struct hilight_hashentry *entry;
|
||||
register double x1,y1,x2,y2; /* 20150409 */
|
||||
Instdef *symptr; /* 20160414 */
|
||||
register double x1,y1,x2,y2;
|
||||
xSymbol *symptr;
|
||||
int use_hash;
|
||||
struct wireentry *wireptr;
|
||||
int hilight_connected_inst;
|
||||
|
||||
if(!hilight_nets) return;
|
||||
prepare_netlist_structs(0);
|
||||
save_draw = draw_window; /* 20181009 */
|
||||
save_draw = draw_window;
|
||||
draw_window = on_window;
|
||||
x1 = X_TO_XSCHEM(areax1);
|
||||
y1 = Y_TO_XSCHEM(areay1);
|
||||
x2 = X_TO_XSCHEM(areax2);
|
||||
y2 = Y_TO_XSCHEM(areay2);
|
||||
use_hash = (lastwire> 2000 || lastinst > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
use_hash = (xctx.wires> 2000 || xctx.instances > 2000 ) && (x2 - x1 < ITERATOR_THRESHOLD);
|
||||
if(use_hash) {
|
||||
hash_wires();
|
||||
}
|
||||
if(!use_hash) for(i=0;i<lastwire;i++)
|
||||
if(!use_hash) for(i=0;i<xctx.wires;i++)
|
||||
{
|
||||
if( (entry = bus_hilight_lookup(wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(wire[i].bus) /* 20171201 */
|
||||
if( (entry = bus_hilight_lookup(xctx.wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(xctx.wire[i].bus)
|
||||
drawline(get_color(entry->value), THICK,
|
||||
wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0);
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
else
|
||||
drawline(get_color(entry->value), NOW,
|
||||
wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0);
|
||||
if(cadhalfdotsize*mooz>=0.7) {
|
||||
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
if(cadhalfdotsize*xctx.mooz>=0.7) {
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( (entry = bus_hilight_lookup(wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(wire[i].bus) /* 20171201 */
|
||||
if( (entry = bus_hilight_lookup(xctx.wire[i].node, 0, XLOOKUP)) ) {
|
||||
if(xctx.wire[i].bus)
|
||||
drawline(get_color(entry->value), THICK,
|
||||
wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0);
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
else
|
||||
drawline(get_color(entry->value), NOW,
|
||||
wire[i].x1, wire[i].y1, wire[i].x2, wire[i].y2, 0);
|
||||
if(cadhalfdotsize*mooz>=0.7) {
|
||||
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
xctx.wire[i].x1, xctx.wire[i].y1, xctx.wire[i].x2, xctx.wire[i].y2, 0);
|
||||
if(cadhalfdotsize*xctx.mooz>=0.7) {
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
filledarc(get_color(entry->value), NOW, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dbg(1, "draw_hilight_net() : allocating inst_color %d bytes \n", lastinst*sizeof(int));
|
||||
my_realloc(145, &inst_color,lastinst*sizeof(int));
|
||||
for(i=0;i<lastinst;i++)
|
||||
dbg(1, "draw_hilight_net() : allocating inst_color %d bytes \n", xctx.instances*sizeof(int));
|
||||
my_realloc(145, &inst_color,xctx.instances*sizeof(int));
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
/* 20150409 */
|
||||
x1=X_TO_SCREEN(inst_ptr[i].x1);
|
||||
x2=X_TO_SCREEN(inst_ptr[i].x2);
|
||||
y1=Y_TO_SCREEN(inst_ptr[i].y1);
|
||||
y2=Y_TO_SCREEN(inst_ptr[i].y2);
|
||||
|
||||
x1=X_TO_SCREEN(xctx.inst[i].x1);
|
||||
x2=X_TO_SCREEN(xctx.inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx.inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx.inst[i].y2);
|
||||
inst_color[i]=0;
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2)) continue;
|
||||
/* /20150409 */
|
||||
|
||||
type = (inst_ptr[i].ptr+instdef)->type; /* 20150409 */
|
||||
type = (xctx.inst[i].ptr+ xctx.sym)->type;
|
||||
|
||||
hilight_connected_inst = !strcmp(get_tok_value((inst_ptr[i].ptr+instdef)->prop_ptr, "highlight", 0), "true") ||
|
||||
!strcmp(get_tok_value(inst_ptr[i].prop_ptr, "highlight", 0), "true");
|
||||
if( inst_ptr[i].flags & 4) {
|
||||
hilight_connected_inst = !strcmp(get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "highlight", 0), "true") ||
|
||||
!strcmp(get_tok_value(xctx.inst[i].prop_ptr, "highlight", 0), "true");
|
||||
if( xctx.inst[i].flags & 4) {
|
||||
dbg(1, "draw_hilight_net(): instance %d flags &4 true\n", i);
|
||||
inst_color[i]=PINLAYER;
|
||||
}
|
||||
else if(hilight_connected_inst) {
|
||||
int rects, j;
|
||||
dbg(2, "draw_hilight_net(): hilight_connected_inst inst=%d, node=%s\n", i, inst_ptr[i].node[0]);
|
||||
if( (rects = (inst_ptr[i].ptr+instdef)->rects[PINLAYER]) > 0 ) {
|
||||
dbg(2, "draw_hilight_net(): hilight_connected_inst inst=%d, node=%s\n", i, xctx.inst[i].node[0]);
|
||||
if( (rects = (xctx.inst[i].ptr+ xctx.sym)->rects[PINLAYER]) > 0 ) {
|
||||
for(j=0;j<rects;j++) {
|
||||
if( inst_ptr[i].node && inst_ptr[i].node[j]) {
|
||||
entry=bus_hilight_lookup(inst_ptr[i].node[j], 0, XLOOKUP);
|
||||
if( xctx.inst[i].node && xctx.inst[i].node[j]) {
|
||||
entry=bus_hilight_lookup(xctx.inst[i].node[j], 0, XLOOKUP);
|
||||
if(entry) {
|
||||
inst_color[i]=get_color(entry->value);
|
||||
break;
|
||||
|
|
@ -989,28 +987,28 @@ void draw_hilight_net(int on_window)
|
|||
}
|
||||
}
|
||||
} else if( type && IS_LABEL_SH_OR_PIN(type) ) {
|
||||
entry=bus_hilight_lookup( get_tok_value(inst_ptr[i].prop_ptr,"lab",0) , 0, XLOOKUP);
|
||||
entry=bus_hilight_lookup( get_tok_value(xctx.inst[i].prop_ptr,"lab",0) , 0, XLOOKUP);
|
||||
if(entry) inst_color[i]=get_color(entry->value);
|
||||
}
|
||||
}
|
||||
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
/* 20160414 from draw() */
|
||||
if(draw_single_layer!=-1 && c != draw_single_layer) continue; /* 20151117 */
|
||||
|
||||
for(i=0;i<lastinst;i++)
|
||||
if(draw_single_layer!=-1 && c != draw_single_layer) continue;
|
||||
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if(inst_color[i] )
|
||||
{
|
||||
/* 20150409 */
|
||||
x1=X_TO_SCREEN(inst_ptr[i].x1);
|
||||
x2=X_TO_SCREEN(inst_ptr[i].x2);
|
||||
y1=Y_TO_SCREEN(inst_ptr[i].y1);
|
||||
y2=Y_TO_SCREEN(inst_ptr[i].y2);
|
||||
|
||||
x1=X_TO_SCREEN(xctx.inst[i].x1);
|
||||
x2=X_TO_SCREEN(xctx.inst[i].x2);
|
||||
y1=Y_TO_SCREEN(xctx.inst[i].y1);
|
||||
y2=Y_TO_SCREEN(xctx.inst[i].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2)) continue;
|
||||
dbg(1, "draw_hilight_net(): instance:%d\n",i);
|
||||
/* 20160414 from draw() */
|
||||
symptr = (inst_ptr[i].ptr+instdef);
|
||||
symptr = (xctx.inst[i].ptr+ xctx.sym);
|
||||
if( c==0 || /*draw_symbol call is needed on layer 0 to avoid redundant work (outside check) */
|
||||
symptr->lines[c] ||
|
||||
symptr->rects[c] ||
|
||||
|
|
@ -1052,7 +1050,7 @@ void print_hilight_net(int show)
|
|||
prepare_netlist_structs(1); /* use full prepare_netlist_structs(1) to recognize pin direction */
|
||||
/* when creating pins from hilight nets 20171221 */
|
||||
|
||||
/* 20180924 */
|
||||
|
||||
if(!(fd = open_tmpfile("hilight_", &filename_ptr)) ) {
|
||||
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
|
||||
return;
|
||||
|
|
@ -1060,7 +1058,7 @@ void print_hilight_net(int show)
|
|||
my_strdup(147, &filetmp2, filename_ptr);
|
||||
fclose(fd);
|
||||
if(!(fd = open_tmpfile("hilight_", &filename_ptr))) {
|
||||
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
|
||||
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
|
||||
my_free(776, &filetmp2);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1079,7 +1077,7 @@ void print_hilight_net(int show)
|
|||
my_free(778, &filetmp2);
|
||||
return;
|
||||
}
|
||||
if(fd==NULL){
|
||||
if(fd==NULL){
|
||||
dbg(1, "print_hilight_net(): problems opening netlist file\n");
|
||||
my_free(779, &filetmp1);
|
||||
my_free(780, &filetmp2);
|
||||
|
|
@ -1091,18 +1089,18 @@ void print_hilight_net(int show)
|
|||
for(i=0;i<HASHSIZE;i++) {
|
||||
entry=hilight_table[i];
|
||||
while(entry) {
|
||||
/* 20111116 */
|
||||
|
||||
node_entry = bus_hash_lookup(entry->token, "", XLOOKUP, 0, "", "", "", "");
|
||||
|
||||
/* 20170926 test for not null node_entry, this may happen if a hilighted net name has been changed */
|
||||
/* before invoking this function, in this case --> skip */
|
||||
if(node_entry && !strcmp(sch_path[currentsch], entry->path)) {
|
||||
if(node_entry && !strcmp(xctx.sch_path[xctx.currsch], entry->path)) {
|
||||
if(show==3) {
|
||||
|
||||
fprintf(fd, "%s%s\n", !strcmp(entry->path, ".") ? "" : entry->path, entry->token); /* 20111106 */
|
||||
|
||||
} else if(show==1) { /* 20120926 */
|
||||
fprintf(fd, "%s\n", entry->token); /* 20120926 */
|
||||
fprintf(fd, "%s%s\n", !strcmp(entry->path, ".") ? "" : entry->path, entry->token);
|
||||
|
||||
} else if(show==1) {
|
||||
fprintf(fd, "%s\n", entry->token);
|
||||
} else {
|
||||
if(node_entry->d.out==0 && node_entry->d.inout==0 )
|
||||
fprintf(fd, "%s %s\n", entry->token, "ipin");
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ proc annotate {} {
|
|||
xschem set no_draw 1
|
||||
|
||||
read_hspice_log [xschem get netlist_dir]/hspice.out
|
||||
set lastinst [xschem get lastinst]
|
||||
set lastinst [xschem get instances]
|
||||
for { set i 0 } { $i < $lastinst } {incr i } {
|
||||
set name [xschem getprop instance $i name]
|
||||
set type [xschem getprop instance $i cell::type]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: icon.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: in_memory_undo.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -31,19 +31,19 @@ typedef struct
|
|||
char *kptr;
|
||||
char *eptr;
|
||||
int *lines;
|
||||
int *boxes;
|
||||
int *rects;
|
||||
int *polygons;
|
||||
int *arcs;
|
||||
int wires;
|
||||
int texts;
|
||||
int instances;
|
||||
Line **lptr;
|
||||
Box **bptr;
|
||||
xPolygon **pptr;
|
||||
xLine **lptr;
|
||||
xRect **bptr;
|
||||
xPoly **pptr;
|
||||
xArc **aptr;
|
||||
Wire *wptr;
|
||||
Text *tptr;
|
||||
Instance *iptr;
|
||||
xWire *wptr;
|
||||
xText *tptr;
|
||||
xInstance *iptr;
|
||||
} Undo_slot;
|
||||
|
||||
static Undo_slot uslot[MAX_UNDO];
|
||||
|
|
@ -52,23 +52,23 @@ static int initialized=0;
|
|||
void init_undo()
|
||||
{
|
||||
int slot;
|
||||
|
||||
|
||||
for(slot=0;slot<MAX_UNDO; slot++) {
|
||||
uslot[slot].lines=my_calloc(165, cadlayers, sizeof(int));
|
||||
uslot[slot].boxes=my_calloc(166, cadlayers, sizeof(int));
|
||||
uslot[slot].rects=my_calloc(166, cadlayers, sizeof(int));
|
||||
uslot[slot].arcs=my_calloc(167, cadlayers, sizeof(int));
|
||||
uslot[slot].polygons=my_calloc(168, cadlayers, sizeof(int));
|
||||
uslot[slot].lptr=my_calloc(169, cadlayers, sizeof(Line *));
|
||||
uslot[slot].bptr=my_calloc(170, cadlayers, sizeof(Box *));
|
||||
uslot[slot].lptr=my_calloc(169, cadlayers, sizeof(xLine *));
|
||||
uslot[slot].bptr=my_calloc(170, cadlayers, sizeof(xRect *));
|
||||
uslot[slot].aptr=my_calloc(171, cadlayers, sizeof(xArc *));
|
||||
uslot[slot].pptr=my_calloc(172, cadlayers, sizeof(xPolygon *));
|
||||
uslot[slot].pptr=my_calloc(172, cadlayers, sizeof(xPoly *));
|
||||
}
|
||||
}
|
||||
|
||||
void free_lines(int slot)
|
||||
{
|
||||
int i, c;
|
||||
|
||||
|
||||
for(c=0;c<cadlayers; c++) {
|
||||
for(i=0;i<uslot[slot].lines[c]; i++) {
|
||||
my_free(783, &uslot[slot].lptr[c][i].prop_ptr);
|
||||
|
|
@ -78,16 +78,16 @@ void free_lines(int slot)
|
|||
}
|
||||
}
|
||||
|
||||
void free_boxes(int slot)
|
||||
void free_rects(int slot)
|
||||
{
|
||||
int i, c;
|
||||
|
||||
for(c=0;c<cadlayers; c++) {
|
||||
for(i=0;i<uslot[slot].boxes[c]; i++) {
|
||||
for(i=0;i<uslot[slot].rects[c]; i++) {
|
||||
my_free(785, &uslot[slot].bptr[c][i].prop_ptr);
|
||||
}
|
||||
my_free(786, &uslot[slot].bptr[c]);
|
||||
uslot[slot].boxes[c] = 0;
|
||||
uslot[slot].rects[c] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,9 +132,9 @@ void free_wires(int slot)
|
|||
}
|
||||
|
||||
void free_texts(int slot)
|
||||
{
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for(i=0;i<uslot[slot].texts; i++) {
|
||||
my_free(796, &uslot[slot].tptr[i].prop_ptr);
|
||||
my_free(797, &uslot[slot].tptr[i].txt_ptr);
|
||||
|
|
@ -157,7 +157,7 @@ void free_instances(int slot)
|
|||
uslot[slot].instances = 0;
|
||||
}
|
||||
|
||||
void clear_undo(void) /* 20150327 */
|
||||
void clear_undo(void)
|
||||
{
|
||||
int slot;
|
||||
cur_undo_ptr = 0;
|
||||
|
|
@ -166,7 +166,7 @@ void clear_undo(void) /* 20150327 */
|
|||
if(!initialized) return;
|
||||
for(slot=0; slot<MAX_UNDO; slot++) {
|
||||
free_lines(slot);
|
||||
free_boxes(slot);
|
||||
free_rects(slot);
|
||||
free_polygons(slot);
|
||||
free_arcs(slot);
|
||||
free_wires(slot);
|
||||
|
|
@ -175,14 +175,14 @@ void clear_undo(void) /* 20150327 */
|
|||
}
|
||||
}
|
||||
|
||||
void delete_undo(void) /* 20150327 */
|
||||
void delete_undo(void)
|
||||
{
|
||||
int slot;
|
||||
|
||||
clear_undo();
|
||||
for(slot=0;slot<MAX_UNDO; slot++) {
|
||||
my_free(804, &uslot[slot].lines);
|
||||
my_free(805, &uslot[slot].boxes);
|
||||
my_free(805, &uslot[slot].rects);
|
||||
my_free(806, &uslot[slot].arcs);
|
||||
my_free(807, &uslot[slot].polygons);
|
||||
my_free(808, &uslot[slot].lptr);
|
||||
|
|
@ -204,14 +204,14 @@ void push_undo(void)
|
|||
}
|
||||
slot = cur_undo_ptr%max_undo;
|
||||
|
||||
my_strdup(173, &uslot[slot].gptr, schvhdlprop);
|
||||
my_strdup(174, &uslot[slot].vptr, schverilogprop);
|
||||
my_strdup(175, &uslot[slot].sptr, schprop);
|
||||
my_strdup(359, &uslot[slot].kptr, schsymbolprop);
|
||||
my_strdup(176, &uslot[slot].eptr, schtedaxprop);
|
||||
my_strdup(173, &uslot[slot].gptr, xctx.schvhdlprop);
|
||||
my_strdup(174, &uslot[slot].vptr, xctx.schverilogprop);
|
||||
my_strdup(175, &uslot[slot].sptr, xctx.schprop);
|
||||
my_strdup(359, &uslot[slot].kptr, xctx.schsymbolprop);
|
||||
my_strdup(176, &uslot[slot].eptr, xctx.schtedaxprop);
|
||||
|
||||
free_lines(slot);
|
||||
free_boxes(slot);
|
||||
free_rects(slot);
|
||||
free_polygons(slot);
|
||||
free_arcs(slot);
|
||||
free_wires(slot);
|
||||
|
|
@ -219,45 +219,45 @@ void push_undo(void)
|
|||
free_instances(slot);
|
||||
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
uslot[slot].lines[c] = lastline[c];
|
||||
uslot[slot].boxes[c] = lastrect[c];
|
||||
uslot[slot].arcs[c] = lastarc[c];
|
||||
uslot[slot].polygons[c] = lastpolygon[c];
|
||||
uslot[slot].lptr[c] = my_calloc(177, lastline[c], sizeof(Line));
|
||||
uslot[slot].bptr[c] = my_calloc(178, lastrect[c], sizeof(Box));
|
||||
uslot[slot].pptr[c] = my_calloc(179, lastpolygon[c], sizeof(xPolygon));
|
||||
uslot[slot].aptr[c] = my_calloc(180, lastarc[c], sizeof(xArc));
|
||||
uslot[slot].lines[c] = xctx.lines[c];
|
||||
uslot[slot].rects[c] = xctx.rects[c];
|
||||
uslot[slot].arcs[c] = xctx.arcs[c];
|
||||
uslot[slot].polygons[c] = xctx.polygons[c];
|
||||
uslot[slot].lptr[c] = my_calloc(177, xctx.lines[c], sizeof(xLine));
|
||||
uslot[slot].bptr[c] = my_calloc(178, xctx.rects[c], sizeof(xRect));
|
||||
uslot[slot].pptr[c] = my_calloc(179, xctx.polygons[c], sizeof(xPoly));
|
||||
uslot[slot].aptr[c] = my_calloc(180, xctx.arcs[c], sizeof(xArc));
|
||||
}
|
||||
uslot[slot].wptr = my_calloc(181, lastwire, sizeof(Wire));
|
||||
uslot[slot].tptr = my_calloc(182, lasttext, sizeof(Text));
|
||||
uslot[slot].iptr = my_calloc(183, lastinst, sizeof(Instance));
|
||||
uslot[slot].texts = lasttext;
|
||||
uslot[slot].instances = lastinst;
|
||||
uslot[slot].wires = lastwire;
|
||||
uslot[slot].wptr = my_calloc(181, xctx.wires, sizeof(xWire));
|
||||
uslot[slot].tptr = my_calloc(182, xctx.texts, sizeof(xText));
|
||||
uslot[slot].iptr = my_calloc(183, xctx.instances, sizeof(xInstance));
|
||||
uslot[slot].texts = xctx.texts;
|
||||
uslot[slot].instances = xctx.instances;
|
||||
uslot[slot].wires = xctx.wires;
|
||||
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
/* lines */
|
||||
for(i=0;i<lastline[c];i++) {
|
||||
uslot[slot].lptr[c][i] = line[c][i];
|
||||
for(i=0;i<xctx.lines[c];i++) {
|
||||
uslot[slot].lptr[c][i] = xctx.line[c][i];
|
||||
uslot[slot].lptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(184, &uslot[slot].lptr[c][i].prop_ptr, line[c][i].prop_ptr);
|
||||
my_strdup(184, &uslot[slot].lptr[c][i].prop_ptr, xctx.line[c][i].prop_ptr);
|
||||
}
|
||||
/* boxes */
|
||||
for(i=0;i<lastrect[c];i++) {
|
||||
uslot[slot].bptr[c][i] = rect[c][i];
|
||||
/* rects */
|
||||
for(i=0;i<xctx.rects[c];i++) {
|
||||
uslot[slot].bptr[c][i] = xctx.rect[c][i];
|
||||
uslot[slot].bptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(185, &uslot[slot].bptr[c][i].prop_ptr, rect[c][i].prop_ptr);
|
||||
my_strdup(185, &uslot[slot].bptr[c][i].prop_ptr, xctx.rect[c][i].prop_ptr);
|
||||
}
|
||||
/* arcs */
|
||||
for(i=0;i<lastarc[c];i++) {
|
||||
uslot[slot].aptr[c][i] = arc[c][i];
|
||||
for(i=0;i<xctx.arcs[c];i++) {
|
||||
uslot[slot].aptr[c][i] = xctx.arc[c][i];
|
||||
uslot[slot].aptr[c][i].prop_ptr = NULL;
|
||||
my_strdup(186, &uslot[slot].aptr[c][i].prop_ptr, arc[c][i].prop_ptr);
|
||||
my_strdup(186, &uslot[slot].aptr[c][i].prop_ptr, xctx.arc[c][i].prop_ptr);
|
||||
}
|
||||
/*polygons */
|
||||
for(i=0;i<lastpolygon[c];i++) {
|
||||
int points = polygon[c][i].points;
|
||||
uslot[slot].pptr[c][i] = polygon[c][i];
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
int points = xctx.poly[c][i].points;
|
||||
uslot[slot].pptr[c][i] = xctx.poly[c][i];
|
||||
uslot[slot].pptr[c][i].prop_ptr = NULL;
|
||||
uslot[slot].pptr[c][i].x = NULL;
|
||||
uslot[slot].pptr[c][i].y = NULL;
|
||||
|
|
@ -265,40 +265,40 @@ void push_undo(void)
|
|||
uslot[slot].pptr[c][i].x = my_malloc(187, points * sizeof(double));
|
||||
uslot[slot].pptr[c][i].y = my_malloc(188, points * sizeof(double));
|
||||
uslot[slot].pptr[c][i].selected_point = my_malloc(189, points * sizeof(unsigned short));
|
||||
memcpy(uslot[slot].pptr[c][i].x, polygon[c][i].x, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].y, polygon[c][i].y, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].selected_point, polygon[c][i].selected_point, points * sizeof(unsigned short));
|
||||
my_strdup(190, &uslot[slot].pptr[c][i].prop_ptr, polygon[c][i].prop_ptr);
|
||||
memcpy(uslot[slot].pptr[c][i].x, xctx.poly[c][i].x, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].y, xctx.poly[c][i].y, points * sizeof(double));
|
||||
memcpy(uslot[slot].pptr[c][i].selected_point, xctx.poly[c][i].selected_point, points * sizeof(unsigned short));
|
||||
my_strdup(190, &uslot[slot].pptr[c][i].prop_ptr, xctx.poly[c][i].prop_ptr);
|
||||
}
|
||||
}
|
||||
/* instances */
|
||||
for(i=0;i<lastinst;i++) {
|
||||
uslot[slot].iptr[i] = inst_ptr[i];
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
uslot[slot].iptr[i] = xctx.inst[i];
|
||||
uslot[slot].iptr[i].prop_ptr = NULL;
|
||||
uslot[slot].iptr[i].name = NULL;
|
||||
uslot[slot].iptr[i].instname = NULL;
|
||||
uslot[slot].iptr[i].node = NULL;
|
||||
my_strdup2(191, &uslot[slot].iptr[i].instname, inst_ptr[i].instname);
|
||||
my_strdup(192, &uslot[slot].iptr[i].prop_ptr, inst_ptr[i].prop_ptr);
|
||||
my_strdup(193, &uslot[slot].iptr[i].name, inst_ptr[i].name);
|
||||
my_strdup2(191, &uslot[slot].iptr[i].instname, xctx.inst[i].instname);
|
||||
my_strdup(192, &uslot[slot].iptr[i].prop_ptr, xctx.inst[i].prop_ptr);
|
||||
my_strdup(193, &uslot[slot].iptr[i].name, xctx.inst[i].name);
|
||||
}
|
||||
/* texts */
|
||||
for(i=0;i<lasttext;i++) {
|
||||
uslot[slot].tptr[i] = textelement[i];
|
||||
for(i=0;i<xctx.texts;i++) {
|
||||
uslot[slot].tptr[i] = xctx.text[i];
|
||||
uslot[slot].tptr[i].prop_ptr = NULL;
|
||||
uslot[slot].tptr[i].txt_ptr = NULL;
|
||||
uslot[slot].tptr[i].font = NULL;
|
||||
my_strdup(194, &uslot[slot].tptr[i].prop_ptr, textelement[i].prop_ptr);
|
||||
my_strdup(195, &uslot[slot].tptr[i].txt_ptr, textelement[i].txt_ptr);
|
||||
my_strdup(196, &uslot[slot].tptr[i].font, textelement[i].font);
|
||||
my_strdup(194, &uslot[slot].tptr[i].prop_ptr, xctx.text[i].prop_ptr);
|
||||
my_strdup(195, &uslot[slot].tptr[i].txt_ptr, xctx.text[i].txt_ptr);
|
||||
my_strdup(196, &uslot[slot].tptr[i].font, xctx.text[i].font);
|
||||
}
|
||||
|
||||
/* wires */
|
||||
for(i=0;i<lastwire;i++) {
|
||||
uslot[slot].wptr[i] = wire[i];
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
uslot[slot].wptr[i] = xctx.wire[i];
|
||||
uslot[slot].wptr[i].prop_ptr = NULL;
|
||||
uslot[slot].wptr[i].node = NULL;
|
||||
my_strdup(197, &uslot[slot].wptr[i].prop_ptr, wire[i].prop_ptr);
|
||||
my_strdup(197, &uslot[slot].wptr[i].prop_ptr, xctx.wire[i].prop_ptr);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -309,7 +309,7 @@ void push_undo(void)
|
|||
|
||||
|
||||
void pop_undo(int redo)
|
||||
{
|
||||
{
|
||||
int slot, i, c;
|
||||
|
||||
if(no_undo)return;
|
||||
|
|
@ -332,99 +332,99 @@ void pop_undo(int redo)
|
|||
slot = cur_undo_ptr%max_undo;
|
||||
clear_drawing();
|
||||
unselect_all();
|
||||
my_strdup(198, &schvhdlprop, uslot[slot].gptr);
|
||||
my_strdup(199, &schverilogprop, uslot[slot].vptr);
|
||||
my_strdup(200, &schprop, uslot[slot].sptr);
|
||||
my_strdup(389, &schsymbolprop, uslot[slot].kptr);
|
||||
my_strdup(201, &schtedaxprop, uslot[slot].eptr);
|
||||
my_strdup(198, &xctx.schvhdlprop, uslot[slot].gptr);
|
||||
my_strdup(199, &xctx.schverilogprop, uslot[slot].vptr);
|
||||
my_strdup(200, &xctx.schprop, uslot[slot].sptr);
|
||||
my_strdup(389, &xctx.schsymbolprop, uslot[slot].kptr);
|
||||
my_strdup(201, &xctx.schtedaxprop, uslot[slot].eptr);
|
||||
for(c=0;c<cadlayers;c++) {
|
||||
/* lines */
|
||||
max_lines[c] = lastline[c] = uslot[slot].lines[c];
|
||||
line[c] = my_calloc(202, lastline[c], sizeof(Line));
|
||||
for(i=0;i<lastline[c];i++) {
|
||||
line[c][i] = uslot[slot].lptr[c][i];
|
||||
line[c][i].prop_ptr=NULL;
|
||||
my_strdup(203, &line[c][i].prop_ptr, uslot[slot].lptr[c][i].prop_ptr);
|
||||
xctx.maxl[c] = xctx.lines[c] = uslot[slot].lines[c];
|
||||
xctx.line[c] = my_calloc(202, xctx.lines[c], sizeof(xLine));
|
||||
for(i=0;i<xctx.lines[c];i++) {
|
||||
xctx.line[c][i] = uslot[slot].lptr[c][i];
|
||||
xctx.line[c][i].prop_ptr=NULL;
|
||||
my_strdup(203, &xctx.line[c][i].prop_ptr, uslot[slot].lptr[c][i].prop_ptr);
|
||||
}
|
||||
/* boxes */
|
||||
max_rects[c] = lastrect[c] = uslot[slot].boxes[c];
|
||||
rect[c] = my_calloc(204, lastrect[c], sizeof(Box));
|
||||
for(i=0;i<lastrect[c];i++) {
|
||||
rect[c][i] = uslot[slot].bptr[c][i];
|
||||
rect[c][i].prop_ptr=NULL;
|
||||
my_strdup(205, &rect[c][i].prop_ptr, uslot[slot].bptr[c][i].prop_ptr);
|
||||
/* rects */
|
||||
xctx.maxr[c] = xctx.rects[c] = uslot[slot].rects[c];
|
||||
xctx.rect[c] = my_calloc(204, xctx.rects[c], sizeof(xRect));
|
||||
for(i=0;i<xctx.rects[c];i++) {
|
||||
xctx.rect[c][i] = uslot[slot].bptr[c][i];
|
||||
xctx.rect[c][i].prop_ptr=NULL;
|
||||
my_strdup(205, &xctx.rect[c][i].prop_ptr, uslot[slot].bptr[c][i].prop_ptr);
|
||||
}
|
||||
/* arcs */
|
||||
max_arcs[c] = lastarc[c] = uslot[slot].arcs[c];
|
||||
arc[c] = my_calloc(206, lastarc[c], sizeof(xArc));
|
||||
for(i=0;i<lastarc[c];i++) {
|
||||
arc[c][i] = uslot[slot].aptr[c][i];
|
||||
arc[c][i].prop_ptr=NULL;
|
||||
my_strdup(207, &arc[c][i].prop_ptr, uslot[slot].aptr[c][i].prop_ptr);
|
||||
xctx.maxa[c] = xctx.arcs[c] = uslot[slot].arcs[c];
|
||||
xctx.arc[c] = my_calloc(206, xctx.arcs[c], sizeof(xArc));
|
||||
for(i=0;i<xctx.arcs[c];i++) {
|
||||
xctx.arc[c][i] = uslot[slot].aptr[c][i];
|
||||
xctx.arc[c][i].prop_ptr=NULL;
|
||||
my_strdup(207, &xctx.arc[c][i].prop_ptr, uslot[slot].aptr[c][i].prop_ptr);
|
||||
}
|
||||
/* polygons */
|
||||
max_polygons[c] = lastpolygon[c] = uslot[slot].polygons[c];
|
||||
polygon[c] = my_calloc(208, lastpolygon[c], sizeof(xPolygon));
|
||||
for(i=0;i<lastpolygon[c];i++) {
|
||||
xctx.maxp[c] = xctx.polygons[c] = uslot[slot].polygons[c];
|
||||
xctx.poly[c] = my_calloc(208, xctx.polygons[c], sizeof(xPoly));
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
int points = uslot[slot].pptr[c][i].points;
|
||||
polygon[c][i] = uslot[slot].pptr[c][i];
|
||||
polygon[c][i].prop_ptr=NULL;
|
||||
polygon[c][i].x=NULL;
|
||||
polygon[c][i].y=NULL;
|
||||
polygon[c][i].selected_point=NULL;
|
||||
my_strdup(209, &polygon[c][i].prop_ptr, uslot[slot].pptr[c][i].prop_ptr);
|
||||
my_realloc(210, &polygon[c][i].x, points * sizeof(double));
|
||||
my_realloc(211, &polygon[c][i].y, points * sizeof(double));
|
||||
my_realloc(212, &polygon[c][i].selected_point, points * sizeof(unsigned short));
|
||||
memcpy(polygon[c][i].x, uslot[slot].pptr[c][i].x, points * sizeof(double));
|
||||
memcpy(polygon[c][i].y, uslot[slot].pptr[c][i].y, points * sizeof(double));
|
||||
memcpy(polygon[c][i].selected_point, uslot[slot].pptr[c][i].selected_point, points * sizeof(unsigned short));
|
||||
xctx.poly[c][i] = uslot[slot].pptr[c][i];
|
||||
xctx.poly[c][i].prop_ptr=NULL;
|
||||
xctx.poly[c][i].x=NULL;
|
||||
xctx.poly[c][i].y=NULL;
|
||||
xctx.poly[c][i].selected_point=NULL;
|
||||
my_strdup(209, &xctx.poly[c][i].prop_ptr, uslot[slot].pptr[c][i].prop_ptr);
|
||||
my_realloc(210, &xctx.poly[c][i].x, points * sizeof(double));
|
||||
my_realloc(211, &xctx.poly[c][i].y, points * sizeof(double));
|
||||
my_realloc(212, &xctx.poly[c][i].selected_point, points * sizeof(unsigned short));
|
||||
memcpy(xctx.poly[c][i].x, uslot[slot].pptr[c][i].x, points * sizeof(double));
|
||||
memcpy(xctx.poly[c][i].y, uslot[slot].pptr[c][i].y, points * sizeof(double));
|
||||
memcpy(xctx.poly[c][i].selected_point, uslot[slot].pptr[c][i].selected_point, points * sizeof(unsigned short));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* instances */
|
||||
max_instances = lastinst = uslot[slot].instances;
|
||||
inst_ptr = my_calloc(213, lastinst, sizeof(Instance));
|
||||
for(i=0;i<lastinst;i++) {
|
||||
inst_ptr[i] = uslot[slot].iptr[i];
|
||||
inst_ptr[i].prop_ptr=NULL;
|
||||
inst_ptr[i].name=NULL;
|
||||
inst_ptr[i].instname=NULL;
|
||||
my_strdup(214, &inst_ptr[i].prop_ptr, uslot[slot].iptr[i].prop_ptr);
|
||||
my_strdup(215, &inst_ptr[i].name, uslot[slot].iptr[i].name);
|
||||
my_strdup2(216, &inst_ptr[i].instname, uslot[slot].iptr[i].instname);
|
||||
xctx.maxi = xctx.instances = uslot[slot].instances;
|
||||
inst_ptr = my_calloc(213, xctx.instances, sizeof(xInstance));
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
xctx.inst[i] = uslot[slot].iptr[i];
|
||||
xctx.inst[i].prop_ptr=NULL;
|
||||
xctx.inst[i].name=NULL;
|
||||
xctx.inst[i].instname=NULL;
|
||||
my_strdup(214, &xctx.inst[i].prop_ptr, uslot[slot].iptr[i].prop_ptr);
|
||||
my_strdup(215, &xctx.inst[i].name, uslot[slot].iptr[i].name);
|
||||
my_strdup2(216, &xctx.inst[i].instname, uslot[slot].iptr[i].instname);
|
||||
}
|
||||
|
||||
/* texts */
|
||||
max_texts = lasttext = uslot[slot].texts;
|
||||
textelement = my_calloc(217, lasttext, sizeof(Text));
|
||||
for(i=0;i<lasttext;i++) {
|
||||
textelement[i] = uslot[slot].tptr[i];
|
||||
textelement[i].txt_ptr=NULL;
|
||||
textelement[i].font=NULL;
|
||||
textelement[i].prop_ptr=NULL;
|
||||
my_strdup(218, &textelement[i].prop_ptr, uslot[slot].tptr[i].prop_ptr);
|
||||
my_strdup(219, &textelement[i].txt_ptr, uslot[slot].tptr[i].txt_ptr);
|
||||
my_strdup(220, &textelement[i].font, uslot[slot].tptr[i].font);
|
||||
xctx.maxt = xctx.texts = uslot[slot].texts;
|
||||
textelement = my_calloc(217, xctx.texts, sizeof(xText));
|
||||
for(i=0;i<xctx.texts;i++) {
|
||||
xctx.text[i] = uslot[slot].tptr[i];
|
||||
xctx.text[i].txt_ptr=NULL;
|
||||
xctx.text[i].font=NULL;
|
||||
xctx.text[i].prop_ptr=NULL;
|
||||
my_strdup(218, &xctx.text[i].prop_ptr, uslot[slot].tptr[i].prop_ptr);
|
||||
my_strdup(219, &xctx.text[i].txt_ptr, uslot[slot].tptr[i].txt_ptr);
|
||||
my_strdup(220, &xctx.text[i].font, uslot[slot].tptr[i].font);
|
||||
}
|
||||
|
||||
/* wires */
|
||||
max_wires = lastwire = uslot[slot].wires;
|
||||
wire = my_calloc(221, lastwire, sizeof(Wire));
|
||||
for(i=0;i<lastwire;i++) {
|
||||
wire[i] = uslot[slot].wptr[i];
|
||||
wire[i].prop_ptr=NULL;
|
||||
wire[i].node=NULL;
|
||||
my_strdup(222, &wire[i].prop_ptr, uslot[slot].wptr[i].prop_ptr);
|
||||
xctx.maxw = xctx.wires = uslot[slot].wires;
|
||||
wire = my_calloc(221, xctx.wires, sizeof(xWire));
|
||||
for(i=0;i<xctx.wires;i++) {
|
||||
xctx.wire[i] = uslot[slot].wptr[i];
|
||||
xctx.wire[i].prop_ptr=NULL;
|
||||
xctx.wire[i].node=NULL;
|
||||
my_strdup(222, &xctx.wire[i].prop_ptr, uslot[slot].wptr[i].prop_ptr);
|
||||
}
|
||||
|
||||
link_symbols_to_instances();
|
||||
set_modify(1);
|
||||
prepared_hash_instances=0; /* 20171224 */
|
||||
prepared_hash_wires=0; /* 20171224 */
|
||||
prepared_netlist_structs=0; /* 20171224 */
|
||||
prepared_hilight_structs=0; /* 20171224 */
|
||||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
prepared_netlist_structs=0;
|
||||
prepared_hilight_structs=0;
|
||||
update_conn_cues(0, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
24
src/main.c
24
src/main.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: main.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -31,7 +31,7 @@ void sig_handler(int s){
|
|||
const char *emergency_dir;
|
||||
#endif
|
||||
|
||||
/* 20150410 */
|
||||
|
||||
if(s==SIGINT) {
|
||||
fprintf(errfp, "Use 'exit' to close the program\n");
|
||||
return;
|
||||
|
|
@ -39,8 +39,8 @@ void sig_handler(int s){
|
|||
|
||||
#ifndef IN_MEMORY_UNDO
|
||||
/* 20180923 no more mkdtemp */
|
||||
my_snprintf(emergency_prefix, S(emergency_prefix), "xschem_emergencysave_%s_",
|
||||
skip_dir(schematic[currentsch]));
|
||||
my_snprintf(emergency_prefix, S(emergency_prefix), "xschem_emergencysave_%s_",
|
||||
skip_dir(xctx.sch[xctx.currsch]));
|
||||
if( !(emergency_dir = create_tmpdir(emergency_prefix)) ) {
|
||||
fprintf(errfp, "xinit(): problems creating emergency save dir\n");
|
||||
/* tcleval( "exit"); */
|
||||
|
|
@ -53,17 +53,17 @@ void sig_handler(int s){
|
|||
fprintf(errfp, "EMERGENCY SAVE DIR: %s\n", emergency_dir);
|
||||
#endif
|
||||
fprintf(errfp, "\nFATAL: signal %d\n", s);
|
||||
fprintf(errfp, "while editing: %s\n", skip_dir(schematic[currentsch]));
|
||||
fprintf(errfp, "while editing: %s\n", skip_dir(xctx.sch[xctx.currsch]));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void child_handler(int signum)
|
||||
{
|
||||
void child_handler(int signum)
|
||||
{
|
||||
/* fprintf(errfp, "SIGCHLD received\n"); */
|
||||
#ifdef __unix__
|
||||
wait(NULL);
|
||||
wait(NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
|
@ -75,13 +75,13 @@ int main(int argc, char **argv)
|
|||
signal(SIGFPE, sig_handler);
|
||||
/* signal(SIGCHLD, child_handler); */ /* avoid zombies 20180925 --> conflicts with tcl exec */
|
||||
|
||||
errfp=stderr;
|
||||
errfp=stderr;
|
||||
/* 20181013 check for empty or non existing DISPLAY *before* calling Tk_Main or Tcl_Main */
|
||||
#ifdef __unix__
|
||||
if(!getenv("DISPLAY") || !getenv("DISPLAY")[0]) has_x=0;
|
||||
#endif
|
||||
process_options(argc, argv);
|
||||
if(debug_var>=1 && !has_x)
|
||||
if(debug_var>=1 && !has_x)
|
||||
fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n");
|
||||
|
||||
/* detach from console (fork a child and close std file descriptors) */
|
||||
|
|
|
|||
916
src/move.c
916
src/move.c
File diff suppressed because it is too large
Load Diff
564
src/netlist.c
564
src/netlist.c
File diff suppressed because it is too large
Load Diff
|
|
@ -90,7 +90,7 @@ proc get_diff_voltage {arr p m } {
|
|||
proc get_current {arr n } {
|
||||
global current_probe
|
||||
upvar $arr var
|
||||
if { [xschem get currentsch] > 0 } {
|
||||
if { [xschem get currsch] > 0 } {
|
||||
set n "i(v.$n)"
|
||||
} else {
|
||||
set n "i($n)"
|
||||
|
|
@ -131,7 +131,7 @@ proc annotate {} {
|
|||
xschem push_undo
|
||||
xschem set no_undo 1
|
||||
xschem set no_draw 1
|
||||
set lastinst [xschem get lastinst]
|
||||
set lastinst [xschem get instances]
|
||||
set path [string range [xschem get sch_path] 1 end]
|
||||
for { set i 0 } { $i < $lastinst } {incr i } {
|
||||
set name [xschem getprop instance $i name]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: node_hash.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -55,7 +55,7 @@ void print_vhdl_signals(FILE *fd)
|
|||
{
|
||||
if(strstr(ptr->token, ".")) {
|
||||
dbg(2, "print_vhdl_signals(): record field, skipping: %s\n", ptr->token);
|
||||
ptr = ptr->next;
|
||||
ptr = ptr->next;
|
||||
continue; /* signal is a record field, no declaration */
|
||||
}
|
||||
if(ptr->d.port == 0 )
|
||||
|
|
@ -65,7 +65,7 @@ void print_vhdl_signals(FILE *fd)
|
|||
{
|
||||
mult=get_unnamed_node(3, 0, atoi((ptr->token)+4) );
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
mult=1;
|
||||
}
|
||||
|
|
@ -80,10 +80,10 @@ void print_vhdl_signals(FILE *fd)
|
|||
if(mult>1)
|
||||
{
|
||||
for(j=mult-1;j>=0;j--)
|
||||
{
|
||||
{
|
||||
fprintf(fd, "%s %s[%d] : ", class, ptr->token[0]=='#' ? ptr->token+1 : ptr->token,j);
|
||||
if(ptr->sig_type && ptr->sig_type[0])
|
||||
{
|
||||
{
|
||||
fprintf(fd, "%s", ptr->sig_type);
|
||||
}
|
||||
else
|
||||
|
|
@ -97,7 +97,7 @@ void print_vhdl_signals(FILE *fd)
|
|||
fprintf(fd, "%s %s : ", class, ptr->token[0]=='#' ? ptr->token+1 : ptr->token);
|
||||
|
||||
if(ptr->sig_type && ptr->sig_type[0])
|
||||
{
|
||||
{
|
||||
fprintf(fd, "%s", ptr->sig_type);
|
||||
}
|
||||
else
|
||||
|
|
@ -135,7 +135,7 @@ void print_verilog_signals(FILE *fd)
|
|||
{
|
||||
mult=get_unnamed_node(3, 0, atoi((ptr->token)+4) );
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
mult=1;
|
||||
}
|
||||
|
|
@ -145,9 +145,9 @@ void print_verilog_signals(FILE *fd)
|
|||
if(mult>1)
|
||||
{
|
||||
for(j=mult-1;j>=0;j--)
|
||||
{
|
||||
if(ptr->verilog_type && ptr->verilog_type[0]) /*09112003 */
|
||||
{
|
||||
{
|
||||
if(ptr->verilog_type && ptr->verilog_type[0])
|
||||
{
|
||||
fprintf(fd, "%s ", ptr->verilog_type);
|
||||
}
|
||||
else
|
||||
|
|
@ -160,8 +160,8 @@ void print_verilog_signals(FILE *fd)
|
|||
else
|
||||
{
|
||||
|
||||
if(ptr->verilog_type && ptr->verilog_type[0]) /*09112003 */
|
||||
{
|
||||
if(ptr->verilog_type && ptr->verilog_type[0])
|
||||
{
|
||||
fprintf(fd, "%s ", ptr->verilog_type);
|
||||
}
|
||||
else
|
||||
|
|
@ -200,7 +200,7 @@ struct node_hashentry *bus_hash_lookup(const char *token, const char *dir, int w
|
|||
dbg(3, "bus_hash_lookup(): done expanding node: %s\n", token);
|
||||
}
|
||||
if(string==NULL) return NULL;
|
||||
string_ptr = start = string;
|
||||
string_ptr = start = string;
|
||||
while(1)
|
||||
{
|
||||
c=(*string_ptr);
|
||||
|
|
@ -225,8 +225,8 @@ struct node_hashentry *bus_hash_lookup(const char *token, const char *dir, int w
|
|||
|
||||
struct node_hashentry *node_hash_lookup(const char *token, const char *dir,int what,int port,
|
||||
char *sig_type, char *verilog_type, char *value, char *class, const char *orig_tok)
|
||||
/* token dir et all what ... action ...
|
||||
* --------------------------------------------------------------------------
|
||||
/* token dir et all what ... action ...
|
||||
* --------------------------------------------------------------------------
|
||||
* "whatever" "in"/"out" 0,XINSERT insert in hash table if not in and return NULL
|
||||
* if already present just return entry address
|
||||
* and update in/out fields sum up port field
|
||||
|
|
@ -250,8 +250,8 @@ struct node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
|
|||
else if(!strcmp(dir,"out") ) d.out=1;
|
||||
else if(!strcmp(dir,"inout") ) d.inout=1;
|
||||
d.port=port;
|
||||
hashcode=hash(token);
|
||||
index=hashcode % HASHSIZE;
|
||||
hashcode=hash(token);
|
||||
index=hashcode % HASHSIZE;
|
||||
entry=node_table[index];
|
||||
preventry=&node_table[index];
|
||||
while(1)
|
||||
|
|
@ -264,14 +264,14 @@ struct node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
|
|||
ptr= my_malloc(281, s );
|
||||
entry=(struct node_hashentry *)ptr;
|
||||
entry->next = NULL;
|
||||
entry->token = entry->sig_type = entry->verilog_type =
|
||||
entry->token = entry->sig_type = entry->verilog_type =
|
||||
entry->value = entry->class = entry->orig_tok = NULL;
|
||||
my_strdup(282, &(entry->token),token);
|
||||
if(sig_type &&sig_type[0]) my_strdup(283, &(entry->sig_type), sig_type); /* 24092001 */
|
||||
if(verilog_type &&verilog_type[0]) my_strdup(284, &(entry->verilog_type), verilog_type); /* 09112003 */
|
||||
if(class && class[0]) my_strdup(285, &(entry->class), class); /* 07102001 */
|
||||
if(orig_tok && orig_tok[0]) my_strdup(286, &(entry->orig_tok), orig_tok); /* 08102001 */
|
||||
if(value && value[0]) my_strdup(287, &(entry->value), value); /* 27092001 */
|
||||
if(sig_type &&sig_type[0]) my_strdup(283, &(entry->sig_type), sig_type);
|
||||
if(verilog_type &&verilog_type[0]) my_strdup(284, &(entry->verilog_type), verilog_type);
|
||||
if(class && class[0]) my_strdup(285, &(entry->class), class);
|
||||
if(orig_tok && orig_tok[0]) my_strdup(286, &(entry->orig_tok), orig_tok);
|
||||
if(value && value[0]) my_strdup(287, &(entry->value), value);
|
||||
entry->d.port=d.port;
|
||||
entry->d.in=d.in;
|
||||
entry->d.out=d.out;
|
||||
|
|
@ -291,11 +291,11 @@ struct node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
|
|||
{
|
||||
saveptr=entry->next;
|
||||
my_free(854, &entry->token);
|
||||
my_free(855, &entry->verilog_type); /* 09112003 */
|
||||
my_free(856, &entry->sig_type); /* 24092001 */
|
||||
my_free(857, &entry->class); /* 07102001 */
|
||||
my_free(858, &entry->orig_tok); /* 07102001 */
|
||||
my_free(859, &entry->value); /* 27092001 */
|
||||
my_free(855, &entry->verilog_type);
|
||||
my_free(856, &entry->sig_type);
|
||||
my_free(857, &entry->class);
|
||||
my_free(858, &entry->orig_tok);
|
||||
my_free(859, &entry->value);
|
||||
my_free(860, &entry);
|
||||
*preventry=saveptr;
|
||||
return NULL;
|
||||
|
|
@ -307,16 +307,16 @@ struct node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
|
|||
entry->d.out+=d.out;
|
||||
entry->d.inout+=d.inout;
|
||||
if(sig_type && sig_type[0] !='\0')
|
||||
my_strdup(288, &(entry->sig_type), sig_type); /* 24092001 */
|
||||
my_strdup(288, &(entry->sig_type), sig_type);
|
||||
if(verilog_type && verilog_type[0] !='\0')
|
||||
my_strdup(289, &(entry->verilog_type), verilog_type); /* 09112003 */
|
||||
my_strdup(289, &(entry->verilog_type), verilog_type);
|
||||
if(value && value[0] !='\0')
|
||||
my_strdup(290, &(entry->value), value); /* 27092001 */
|
||||
my_strdup(290, &(entry->value), value);
|
||||
dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n",
|
||||
entry->token, entry->value? entry->value:"NULL");
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
preventry=&entry->next; /* descend into the list. */
|
||||
entry = entry->next;
|
||||
}
|
||||
|
|
@ -342,7 +342,7 @@ void traverse_node_hash()
|
|||
if(incr_hilight) hilight_color++;
|
||||
statusmsg(str,2);
|
||||
}
|
||||
else if(entry->d.out ==0 && entry->d.inout == 0)
|
||||
else if(entry->d.out ==0 && entry->d.inout == 0)
|
||||
{
|
||||
my_snprintf(str, S(str), "undriven node: %s", entry->token);
|
||||
if(!netlist_count) bus_hilight_lookup(entry->token, hilight_color, XINSERT);
|
||||
|
|
@ -356,7 +356,7 @@ void traverse_node_hash()
|
|||
if(incr_hilight) hilight_color++;
|
||||
statusmsg(str,2);
|
||||
}
|
||||
else if(entry->d.in ==0 && entry->d.inout == 0)
|
||||
else if(entry->d.in ==0 && entry->d.inout == 0)
|
||||
{
|
||||
my_snprintf(str, S(str), "node: %s goes nowhere", entry->token);
|
||||
if(!netlist_count) bus_hilight_lookup(entry->token, hilight_color, XINSERT);
|
||||
|
|
@ -371,7 +371,7 @@ void traverse_node_hash()
|
|||
statusmsg(str,2);
|
||||
}
|
||||
}
|
||||
dbg(1, "traverse_node_hash(): node: %s in=%d out=%d inout=%d port=%d\n",
|
||||
dbg(1, "traverse_node_hash(): node: %s in=%d out=%d inout=%d port=%d\n",
|
||||
entry->token, entry->d.in, entry->d.out, entry->d.inout, entry->d.port);
|
||||
|
||||
entry = entry->next;
|
||||
|
|
@ -389,11 +389,11 @@ static struct node_hashentry *free_hash_entry(struct node_hashentry *entry)
|
|||
n_elements++; collisions++;
|
||||
tmp = entry->next;
|
||||
my_free(861, &entry->token);
|
||||
my_free(862, &entry->verilog_type); /* 09112003 */
|
||||
my_free(863, &entry->sig_type); /* 24092001 */
|
||||
my_free(864, &entry->class); /* 07102001 */
|
||||
my_free(865, &entry->orig_tok); /* 07102001 */
|
||||
my_free(866, &entry->value); /* 27092001 */
|
||||
my_free(862, &entry->verilog_type);
|
||||
my_free(863, &entry->sig_type);
|
||||
my_free(864, &entry->class);
|
||||
my_free(865, &entry->orig_tok);
|
||||
my_free(866, &entry->value);
|
||||
my_free(867, &entry);
|
||||
entry = tmp;
|
||||
}
|
||||
|
|
@ -403,7 +403,7 @@ static struct node_hashentry *free_hash_entry(struct node_hashentry *entry)
|
|||
void free_node_hash(void) /* remove the whole hash table */
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
dbg(2, "free_node_hash(): removing hash table\n");
|
||||
n_elements=0;
|
||||
for(i=0;i<HASHSIZE;i++)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: options.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
|
|||
182
src/paste.c
182
src/paste.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: paste.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "xschem.h"
|
||||
#include "xschem.h"
|
||||
|
||||
|
||||
|
||||
|
|
@ -31,39 +31,39 @@ void merge_text(FILE *fd)
|
|||
int i;
|
||||
const char *str;
|
||||
check_text_storage();
|
||||
i=lasttext;
|
||||
textelement[i].txt_ptr=NULL;
|
||||
load_ascii_string(&textelement[i].txt_ptr,fd);
|
||||
i=xctx.texts;
|
||||
xctx.text[i].txt_ptr=NULL;
|
||||
load_ascii_string(&xctx.text[i].txt_ptr,fd);
|
||||
fscanf(fd, "%lf %lf %d %d %lf %lf ",
|
||||
&textelement[i].x0, &textelement[i].y0, &textelement[i].rot,
|
||||
&textelement[i].flip, &textelement[i].xscale,
|
||||
&textelement[i].yscale);
|
||||
textelement[i].prop_ptr=NULL;
|
||||
textelement[i].font=NULL;
|
||||
textelement[i].sel=0;
|
||||
load_ascii_string(&textelement[i].prop_ptr,fd);
|
||||
my_strdup(302, &textelement[i].font, get_tok_value(textelement[i].prop_ptr, "font", 0));/*20171206 */
|
||||
&xctx.text[i].x0, &xctx.text[i].y0, &xctx.text[i].rot,
|
||||
&xctx.text[i].flip, &xctx.text[i].xscale,
|
||||
&xctx.text[i].yscale);
|
||||
xctx.text[i].prop_ptr=NULL;
|
||||
xctx.text[i].font=NULL;
|
||||
xctx.text[i].sel=0;
|
||||
load_ascii_string(&xctx.text[i].prop_ptr,fd);
|
||||
my_strdup(302, &xctx.text[i].font, get_tok_value(xctx.text[i].prop_ptr, "font", 0));
|
||||
|
||||
|
||||
str = get_tok_value(textelement[i].prop_ptr, "hcenter", 0);
|
||||
textelement[i].hcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(textelement[i].prop_ptr, "vcenter", 0);
|
||||
textelement[i].vcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "hcenter", 0);
|
||||
xctx.text[i].hcenter = strcmp(str, "true") ? 0 : 1;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "vcenter", 0);
|
||||
xctx.text[i].vcenter = strcmp(str, "true") ? 0 : 1;
|
||||
|
||||
str = get_tok_value(textelement[i].prop_ptr, "layer", 0); /*20171206 */
|
||||
if(str[0]) textelement[i].layer = atoi(str);
|
||||
else textelement[i].layer = -1;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "layer", 0);
|
||||
if(str[0]) xctx.text[i].layer = atoi(str);
|
||||
else xctx.text[i].layer = -1;
|
||||
|
||||
textelement[i].flags = 0;
|
||||
str = get_tok_value(textelement[i].prop_ptr, "slant", 0);
|
||||
textelement[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
textelement[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(textelement[i].prop_ptr, "weight", 0);
|
||||
textelement[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
xctx.text[i].flags = 0;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "slant", 0);
|
||||
xctx.text[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
|
||||
xctx.text[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
|
||||
str = get_tok_value(xctx.text[i].prop_ptr, "weight", 0);
|
||||
xctx.text[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
|
||||
|
||||
select_text(i,SELECTED, 1);
|
||||
set_modify(1);
|
||||
lasttext++;
|
||||
xctx.texts++;
|
||||
}
|
||||
|
||||
void merge_wire(FILE *fd)
|
||||
|
|
@ -71,7 +71,7 @@ void merge_wire(FILE *fd)
|
|||
int i;
|
||||
double x1,y1,x2,y2;
|
||||
char *ptr=NULL;
|
||||
i=lastwire;
|
||||
i=xctx.wires;
|
||||
fscanf(fd, "%lf %lf %lf %lf",&x1, &y1, &x2, &y2 );
|
||||
load_ascii_string( &ptr, fd);
|
||||
storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr);
|
||||
|
|
@ -82,24 +82,24 @@ void merge_wire(FILE *fd)
|
|||
void merge_box(FILE *fd)
|
||||
{
|
||||
int i,c;
|
||||
Box *ptr;
|
||||
xRect *ptr;
|
||||
|
||||
fscanf(fd, "%d",&c);
|
||||
if(c>=cadlayers) {
|
||||
fprintf(errfp,"Rectangle layer > defined cadlayers, increase cadlayers\n");
|
||||
c=cadlayers-1;
|
||||
} /* 20150408 */
|
||||
}
|
||||
check_box_storage(c);
|
||||
i=lastrect[c];
|
||||
ptr=rect[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
|
||||
i=xctx.rects[c];
|
||||
ptr=xctx.rect[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
|
||||
&ptr[i].x2, &ptr[i].y2);
|
||||
ptr[i].prop_ptr=NULL;
|
||||
RECTORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2); /* 20180108 */
|
||||
RECTORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
|
||||
ptr[i].sel=0;
|
||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
select_box(c,i, SELECTED, 1);
|
||||
lastrect[c]++;
|
||||
xctx.rects[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -112,21 +112,21 @@ void merge_arc(FILE *fd)
|
|||
if(c>=cadlayers) {
|
||||
fprintf(errfp,"arc layer > defined cadlayers, increase cadlayers\n");
|
||||
c=cadlayers-1;
|
||||
} /* 20150408 */
|
||||
}
|
||||
check_arc_storage(c);
|
||||
i=lastarc[c];
|
||||
ptr=arc[c];
|
||||
i=xctx.arcs[c];
|
||||
ptr=xctx.arc[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf %lf ",&ptr[i].x, &ptr[i].y,
|
||||
&ptr[i].r, &ptr[i].a, &ptr[i].b);
|
||||
ptr[i].prop_ptr=NULL;
|
||||
ptr[i].sel=0;
|
||||
load_ascii_string(&ptr[i].prop_ptr, fd);
|
||||
if( !strcmp(get_tok_value(ptr[i].prop_ptr,"fill",0),"true") ) /* 20181011 */
|
||||
if( !strcmp(get_tok_value(ptr[i].prop_ptr,"fill",0),"true") )
|
||||
ptr[i].fill =1;
|
||||
else
|
||||
ptr[i].fill =0;
|
||||
select_arc(c,i, SELECTED, 1);
|
||||
lastarc[c]++;
|
||||
xctx.arcs[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -134,16 +134,16 @@ void merge_arc(FILE *fd)
|
|||
void merge_polygon(FILE *fd)
|
||||
{
|
||||
int i,c, j, points;
|
||||
xPolygon *ptr;
|
||||
xPoly *ptr;
|
||||
|
||||
fscanf(fd, "%d %d",&c, &points);
|
||||
if(c>=cadlayers) {
|
||||
fprintf(errfp,"Rectangle layer > defined cadlayers, increase cadlayers\n");
|
||||
c=cadlayers-1;
|
||||
} /* 20150408 */
|
||||
}
|
||||
check_polygon_storage(c);
|
||||
i=lastpolygon[c];
|
||||
ptr=polygon[c];
|
||||
i=xctx.polygons[c];
|
||||
ptr=xctx.poly[c];
|
||||
ptr[i].x=NULL;
|
||||
ptr[i].y=NULL;
|
||||
ptr[i].selected_point=NULL;
|
||||
|
|
@ -157,37 +157,37 @@ void merge_polygon(FILE *fd)
|
|||
fscanf(fd, "%lf %lf ",&(ptr[i].x[j]), &(ptr[i].y[j]));
|
||||
}
|
||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
if( !strcmp(get_tok_value(ptr[i].prop_ptr,"fill",0),"true") ) /* 20181011 */
|
||||
if( !strcmp(get_tok_value(ptr[i].prop_ptr,"fill",0),"true") )
|
||||
ptr[i].fill =1;
|
||||
else
|
||||
ptr[i].fill =0;
|
||||
select_polygon(c,i, SELECTED, 1);
|
||||
lastpolygon[c]++;
|
||||
xctx.polygons[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
void merge_line(FILE *fd)
|
||||
{
|
||||
int i,c;
|
||||
Line *ptr;
|
||||
xLine *ptr;
|
||||
|
||||
fscanf(fd, "%d",&c);
|
||||
if(c>=cadlayers) {
|
||||
fprintf(errfp,"Rectangle layer > defined cadlayers, increase cadlayers\n");
|
||||
c=cadlayers-1;
|
||||
} /* 20150408 */
|
||||
}
|
||||
check_line_storage(c);
|
||||
i=lastline[c];
|
||||
ptr=line[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
|
||||
i=xctx.lines[c];
|
||||
ptr=xctx.line[c];
|
||||
fscanf(fd, "%lf %lf %lf %lf ",&ptr[i].x1, &ptr[i].y1,
|
||||
&ptr[i].x2, &ptr[i].y2);
|
||||
ORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2); /* 20180108 */
|
||||
ORDER(ptr[i].x1, ptr[i].y1, ptr[i].x2, ptr[i].y2);
|
||||
|
||||
ptr[i].prop_ptr=NULL;
|
||||
ptr[i].sel=0;
|
||||
load_ascii_string( &ptr[i].prop_ptr, fd);
|
||||
select_line(c,i, SELECTED, 1);
|
||||
lastline[c]++;
|
||||
xctx.lines[c]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -200,10 +200,10 @@ void merge_inst(int k,FILE *fd)
|
|||
int i;
|
||||
char *prop_ptr=NULL;
|
||||
|
||||
Instance *ptr;
|
||||
i=lastinst;
|
||||
xInstance *ptr;
|
||||
i=xctx.instances;
|
||||
check_inst_storage();
|
||||
ptr=inst_ptr;
|
||||
ptr=xctx.inst;
|
||||
ptr[i].name=NULL;
|
||||
load_ascii_string(&ptr[i].name,fd);
|
||||
if(fscanf(fd, "%lf %lf %d %d",&ptr[i].x0, &ptr[i].y0,&ptr[i].rot, &ptr[i].flip) < 4) {
|
||||
|
|
@ -213,18 +213,18 @@ void merge_inst(int k,FILE *fd)
|
|||
}
|
||||
ptr[i].sel=0;
|
||||
ptr[i].flags=0;
|
||||
ptr[i].ptr=-1;
|
||||
ptr[i].ptr=-1;
|
||||
ptr[i].prop_ptr=NULL;
|
||||
ptr[i].instname=NULL; /* 20150411 */
|
||||
ptr[i].instname=NULL;
|
||||
ptr[i].node=NULL;
|
||||
load_ascii_string(&prop_ptr,fd);
|
||||
if(!k) hash_all_names(i);
|
||||
new_prop_string(i, prop_ptr, k, dis_uniq_names);
|
||||
/* the final tmp argument is zero for the 1st call and used in */
|
||||
/* new_prop_string() for cleaning some internal caches. */
|
||||
my_strdup2(306, &inst_ptr[i].instname, get_tok_value(inst_ptr[i].prop_ptr, "name", 0)); /* 20150409 */
|
||||
my_strdup2(306, &xctx.inst[i].instname, get_tok_value(xctx.inst[i].prop_ptr, "name", 0));
|
||||
my_free(871, &prop_ptr);
|
||||
lastinst++;
|
||||
xctx.instances++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -238,42 +238,42 @@ void match_merged_inst(int old)
|
|||
int cond;
|
||||
char *type;
|
||||
missing = 0;
|
||||
for(i=old;i<lastinst;i++)
|
||||
for(i=old;i<xctx.instances;i++)
|
||||
{
|
||||
symbol = match_symbol(inst_ptr[i].name);
|
||||
symbol = match_symbol(xctx.inst[i].name);
|
||||
if(symbol == -1)
|
||||
{
|
||||
dbg(1, "match_merged_inst(): missing symbol, skipping...\n");
|
||||
my_free(872, &inst_ptr[i].prop_ptr); /* 06052001 remove properties */
|
||||
my_free(873, &inst_ptr[i].name); /* 06052001 remove symname */
|
||||
my_free(874, &inst_ptr[i].instname);
|
||||
my_free(872, &xctx.inst[i].prop_ptr); /* 06052001 remove properties */
|
||||
my_free(873, &xctx.inst[i].name); /* 06052001 remove symname */
|
||||
my_free(874, &xctx.inst[i].instname);
|
||||
missing++;
|
||||
continue;
|
||||
}
|
||||
inst_ptr[i].ptr = symbol;
|
||||
xctx.inst[i].ptr = symbol;
|
||||
if(missing)
|
||||
{
|
||||
|
||||
inst_ptr[i-missing] = inst_ptr[i];
|
||||
inst_ptr[i].prop_ptr=NULL;
|
||||
xctx.inst[i-missing] = xctx.inst[i];
|
||||
xctx.inst[i].prop_ptr=NULL;
|
||||
/* delete_inst_node(i); */ /* probably not needed */
|
||||
inst_ptr[i].ptr=-1; /*04112003 was 0 */
|
||||
inst_ptr[i].flags=0;
|
||||
inst_ptr[i].name=NULL;
|
||||
inst_ptr[i].instname=NULL;
|
||||
xctx.inst[i].ptr=-1; /*04112003 was 0 */
|
||||
xctx.inst[i].flags=0;
|
||||
xctx.inst[i].name=NULL;
|
||||
xctx.inst[i].instname=NULL;
|
||||
}
|
||||
}
|
||||
lastinst -= missing;
|
||||
for(i=old;i<lastinst;i++)
|
||||
xctx.instances -= missing;
|
||||
for(i=old;i<xctx.instances;i++)
|
||||
{
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
select_element(i,SELECTED,1, 0);
|
||||
symbol_bbox(i, &inst_ptr[i].x1, &inst_ptr[i].y1,
|
||||
&inst_ptr[i].x2, &inst_ptr[i].y2);
|
||||
type=instdef[inst_ptr[i].ptr].type;
|
||||
symbol_bbox(i, &xctx.inst[i].x1, &xctx.inst[i].y1,
|
||||
&xctx.inst[i].x2, &xctx.inst[i].y2);
|
||||
type=xctx.sym[xctx.inst[i].ptr].type;
|
||||
cond= !type || !IS_LABEL_SH_OR_PIN(type);
|
||||
if(cond) inst_ptr[i].flags|=2;
|
||||
else inst_ptr[i].flags &=~2;
|
||||
if(cond) xctx.inst[i].flags|=2;
|
||||
else xctx.inst[i].flags &=~2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -297,16 +297,16 @@ void merge_file(int selection_load, const char ext[])
|
|||
|
||||
if(selection_load==0)
|
||||
{
|
||||
if(!strcmp(ext,"")) { /* 20071215 */
|
||||
if(!strcmp(ext,"")) {
|
||||
my_snprintf(tmp, S(tmp), "load_file_dialog {Merge file} {.sch.sym} INITIALLOADDIR", ext);
|
||||
tcleval(tmp);
|
||||
if(!strcmp(tclresult(),"")) return;
|
||||
my_strncpy(name, (char *)tclresult(), S(name)); /* 20180925 */
|
||||
}
|
||||
else { /* 20071215 */
|
||||
my_strncpy(name, (char *)tclresult(), S(name));
|
||||
}
|
||||
else {
|
||||
my_strncpy(name, ext, S(name));
|
||||
}
|
||||
dbg(1, "merge_file(): sch=%d name=%s\n",currentsch,name);
|
||||
dbg(1, "merge_file(): sch=%d name=%s\n",xctx.currsch,name);
|
||||
}
|
||||
else if(selection_load==1)
|
||||
{
|
||||
|
|
@ -322,9 +322,9 @@ void merge_file(int selection_load, const char ext[])
|
|||
prepared_hash_instances=0;
|
||||
prepared_hash_wires=0;
|
||||
got_mouse = 0;
|
||||
push_undo(); /* 20150327 */
|
||||
push_undo();
|
||||
unselect_all();
|
||||
old=lastinst;
|
||||
old=xctx.instances;
|
||||
while(!endfile)
|
||||
{
|
||||
if(fscanf(fd," %c",tag)==EOF) break;
|
||||
|
|
@ -336,7 +336,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
case 'V':
|
||||
load_ascii_string(&aux_ptr, fd);
|
||||
break;
|
||||
case 'E': /* 20180912 */
|
||||
case 'E':
|
||||
load_ascii_string(&aux_ptr, fd);
|
||||
break;
|
||||
case 'S':
|
||||
|
|
@ -347,7 +347,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
break;
|
||||
case 'G':
|
||||
load_ascii_string(&aux_ptr, fd);
|
||||
if(selection_load)
|
||||
if(selection_load)
|
||||
{
|
||||
mx_double_save = mousex_snap;
|
||||
my_double_save = mousey_snap;
|
||||
|
|
@ -394,7 +394,7 @@ void merge_file(int selection_load, const char ext[])
|
|||
fclose(fd);
|
||||
ui_state |= STARTMERGE;
|
||||
dbg(1, "merge_file(): loaded file:wire=%d inst=%d ui_state=%ld\n",
|
||||
lastwire , lastinst, ui_state);
|
||||
xctx.wires , xctx.instances, ui_state);
|
||||
move_objects(BEGIN,0,0,0);
|
||||
mousex_snap = mx_double_save;
|
||||
mousey_snap = my_double_save;
|
||||
|
|
|
|||
209
src/psprint.c
209
src/psprint.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: psprint.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -21,10 +21,10 @@
|
|||
*/
|
||||
|
||||
#include "xschem.h"
|
||||
#define X_TO_PS(x) ( (x+xorigin)* mooz )
|
||||
#define Y_TO_PS(y) ( (y+yorigin)* mooz )
|
||||
#define X_TO_PS(x) ( (x+xctx.xorigin)* xctx.mooz )
|
||||
#define Y_TO_PS(y) ( (y+xctx.yorigin)* xctx.mooz )
|
||||
|
||||
static FILE *fd;
|
||||
static FILE *fd;
|
||||
|
||||
typedef struct {
|
||||
int red;
|
||||
|
|
@ -34,7 +34,7 @@ typedef struct {
|
|||
|
||||
static Ps_color *ps_colors;
|
||||
|
||||
static void restore_lw(void)
|
||||
static void restore_lw(void)
|
||||
{
|
||||
if(lw_double==0.0)
|
||||
fprintf(fd, "%.16g setlinewidth\n",0.5);
|
||||
|
|
@ -45,23 +45,23 @@ static void restore_lw(void)
|
|||
|
||||
static void set_ps_colors(unsigned int pixel)
|
||||
{
|
||||
|
||||
if(color_ps) fprintf(fd, "%.16g %.16g %.16g setrgbcolor\n",
|
||||
(double)ps_colors[pixel].red/256.0, (double)ps_colors[pixel].green/256.0,
|
||||
|
||||
if(color_ps) fprintf(fd, "%.16g %.16g %.16g setrgbcolor\n",
|
||||
(double)ps_colors[pixel].red/256.0, (double)ps_colors[pixel].green/256.0,
|
||||
(double)ps_colors[pixel].blue/256.0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ps_xdrawarc(int layer, int fillarc, double x, double y, double r, double a, double b)
|
||||
{
|
||||
if(fill && fillarc)
|
||||
if(fill && fillarc)
|
||||
fprintf(fd, "%.16g %.16g %.16g %.16g %.16g AF\n", x, y, r, -a, -a-b);
|
||||
else
|
||||
fprintf(fd, "%.16g %.16g %.16g %.16g %.16g A\n", x, y, r, -a, -a-b);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void ps_xdrawline(int layer, double x1, double y1, double x2,
|
||||
static void ps_xdrawline(int layer, double x1, double y1, double x2,
|
||||
double y2)
|
||||
{
|
||||
fprintf(fd, "%.16g %.16g %.16g %.16g L\n", x2, y2, x1, y1);
|
||||
|
|
@ -102,7 +102,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in
|
|||
return;
|
||||
}
|
||||
|
||||
psdash = dash / zoom;
|
||||
psdash = dash / xctx.zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, in
|
|||
fprintf(fd, "closepath stroke\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(dash) {
|
||||
fprintf(fd, "[] 0 setdash\n");
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,doub
|
|||
y2=Y_TO_PS(recty2);
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / zoom;
|
||||
psdash = dash / xctx.zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -157,7 +157,7 @@ static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a,
|
|||
|
||||
xx=X_TO_PS(x);
|
||||
yy=Y_TO_PS(y);
|
||||
rr=r*mooz;
|
||||
rr=r*xctx.mooz;
|
||||
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
|
||||
x1=X_TO_PS(x1);
|
||||
y1=Y_TO_PS(y1);
|
||||
|
|
@ -166,7 +166,7 @@ static void ps_drawarc(int gc, int fillarc, double x,double y,double r,double a,
|
|||
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / zoom;
|
||||
psdash = dash / xctx.zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ static void ps_drawline(int gc, double linex1,double liney1,double linex2,double
|
|||
y2=Y_TO_PS(liney2);
|
||||
if( clip(&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
psdash = dash / zoom;
|
||||
psdash = dash / xctx.zoom;
|
||||
if(dash) {
|
||||
fprintf(fd, "[%g %g] 0 setdash\n", psdash, psdash);
|
||||
}
|
||||
|
|
@ -200,15 +200,15 @@ static void ps_drawline(int gc, double linex1,double liney1,double linex2,double
|
|||
}
|
||||
}
|
||||
|
||||
static void ps_draw_string(int gctext, const char *str,
|
||||
int rot, int flip, int hcenter, int vcenter,
|
||||
static void ps_draw_string(int gctext, const char *str,
|
||||
int rot, int flip, int hcenter, int vcenter,
|
||||
double x1,double y1,
|
||||
double xscale, double yscale)
|
||||
double xscale, double yscale)
|
||||
|
||||
{
|
||||
double a,yy,curr_x1,curr_y1,curr_x2,curr_y2,rx1,rx2,ry1,ry2;
|
||||
int pos=0,cc,pos2=0;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if(str==NULL) return;
|
||||
#ifdef HAS_CAIRO
|
||||
|
|
@ -228,13 +228,13 @@ static void ps_draw_string(int gctext, const char *str,
|
|||
while(str[pos2])
|
||||
{
|
||||
cc = (int)str[pos2++];
|
||||
if(cc=='\n')
|
||||
if(cc=='\n')
|
||||
{
|
||||
yy+=(FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*
|
||||
yscale;
|
||||
pos=0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
a = pos*(FONTWIDTH+FONTWHITESPACE);
|
||||
for(i=0;i<character[cc][0]*4;i+=4)
|
||||
{
|
||||
|
|
@ -257,9 +257,9 @@ static void ps_drawgrid()
|
|||
double x,y;
|
||||
double delta,tmp;
|
||||
if(!draw_grid) return;
|
||||
delta=cadgrid* mooz;
|
||||
delta=cadgrid* xctx.mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xorigin* mooz;y = yorigin* mooz;
|
||||
x = xctx.xorigin* xctx.mooz;y = xctx.yorigin* xctx.mooz;
|
||||
set_ps_colors(GRIDLAYER);
|
||||
if(y>areay1 && y<areay2)
|
||||
{
|
||||
|
|
@ -270,8 +270,8 @@ static void ps_drawgrid()
|
|||
ps_xdrawline(GRIDLAYER,(int)x,areay1+1, (int)x, areay2-1);
|
||||
}
|
||||
set_ps_colors(GRIDLAYER);
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-yorigin* mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xorigin* mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx.yorigin* xctx.mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx.xorigin* xctx.mooz,delta);x<areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
{
|
||||
|
|
@ -282,60 +282,60 @@ static void ps_drawgrid()
|
|||
|
||||
|
||||
|
||||
static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
||||
double xoffset, double yoffset)
|
||||
static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
||||
double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers;i++)" loop */
|
||||
int j;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
int flip, textlayer;
|
||||
Line line;
|
||||
Box box;
|
||||
Text text;
|
||||
xLine line;
|
||||
xRect box;
|
||||
xText text;
|
||||
xArc arc;
|
||||
xPolygon polygon;
|
||||
xPoly polygon;
|
||||
|
||||
if(inst_ptr[n].ptr == -1) return;
|
||||
if(xctx.inst[n].ptr == -1) return;
|
||||
if( (layer != PINLAYER && !enable_layer[layer]) ) return;
|
||||
if(layer==0)
|
||||
{
|
||||
x1=X_TO_PS(inst_ptr[n].x1);
|
||||
x2=X_TO_PS(inst_ptr[n].x2);
|
||||
y1=Y_TO_PS(inst_ptr[n].y1);
|
||||
y2=Y_TO_PS(inst_ptr[n].y2);
|
||||
x1=X_TO_PS(xctx.inst[n].x1);
|
||||
x2=X_TO_PS(xctx.inst[n].x2);
|
||||
y1=Y_TO_PS(xctx.inst[n].y1);
|
||||
y2=Y_TO_PS(xctx.inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
{
|
||||
inst_ptr[n].flags|=1;
|
||||
xctx.inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else inst_ptr[n].flags&=~1;
|
||||
else xctx.inst[n].flags&=~1;
|
||||
|
||||
/* following code handles different text color for labels/pins 06112002 */
|
||||
|
||||
}
|
||||
else if(inst_ptr[n].flags&1)
|
||||
else if(xctx.inst[n].flags&1)
|
||||
{
|
||||
dbg(1, "draw_symbol(): skippinginst %d\n", n);
|
||||
return;
|
||||
}
|
||||
|
||||
flip = inst_ptr[n].flip;
|
||||
flip = xctx.inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (inst_ptr[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=inst_ptr[n].x0 + xoffset;
|
||||
y0=inst_ptr[n].y0 + yoffset;
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->lines[layer];j++)
|
||||
rot = (xctx.inst[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=xctx.inst[n].x0 + xoffset;
|
||||
y0=xctx.inst[n].y0 + yoffset;
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->lines[layer];j++)
|
||||
{
|
||||
line = ((inst_ptr[n].ptr+instdef)->lineptr[layer])[j];
|
||||
line = ((xctx.inst[n].ptr+ xctx.sym)->line[layer])[j];
|
||||
ROTATION(0.0,0.0,line.x1,line.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,line.x2,line.y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
ps_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
|
||||
}
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->polygons[layer];j++) /* 20171115 */
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->polygons[layer];j++)
|
||||
{
|
||||
polygon = ((inst_ptr[n].ptr+instdef)->polygonptr[layer])[j];
|
||||
polygon = ((xctx.inst[n].ptr+ xctx.sym)->poly[layer])[j];
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(309, sizeof(double) * polygon.points);
|
||||
|
|
@ -349,12 +349,12 @@ static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
my_free(876, &x);
|
||||
my_free(877, &y);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->arcs[layer];j++)
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->arcs[layer];j++)
|
||||
{
|
||||
double angle;
|
||||
arc = ((inst_ptr[n].ptr+instdef)->arcptr[layer])[j];
|
||||
arc = ((xctx.inst[n].ptr+ xctx.sym)->arc[layer])[j];
|
||||
if(flip) {
|
||||
angle = 270.*rot+180.-arc.b-arc.a;
|
||||
} else {
|
||||
|
|
@ -365,39 +365,39 @@ static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
ROTATION(0.0,0.0,arc.x,arc.y,x1,y1);
|
||||
ps_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
|
||||
}
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (inst_ptr[n].ptr+instdef)->rects[layer];j++)
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->rects[layer];j++)
|
||||
{
|
||||
box = ((inst_ptr[n].ptr+instdef)->boxptr[layer])[j];
|
||||
box = ((xctx.inst[n].ptr+ xctx.sym)->rect[layer])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
ps_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
|
||||
}
|
||||
if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (inst_ptr[n].flags&2) ) )
|
||||
if( (layer==TEXTWIRELAYER && !(xctx.inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx.inst[n].flags&2) ) )
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->texts;j++)
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->texts;j++)
|
||||
{
|
||||
text = (inst_ptr[n].ptr+instdef)->txtptr[j];
|
||||
/* if(text.xscale*FONTWIDTH* mooz<1) continue; */
|
||||
text = (xctx.inst[n].ptr+ xctx.sym)->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx.mooz<1) continue; */
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
textlayer = layer;
|
||||
if( !(layer == PINLAYER && (inst_ptr[n].flags & 4))) {
|
||||
textlayer = (inst_ptr[n].ptr+instdef)->txtptr[j].layer;
|
||||
if( !(layer == PINLAYER && (xctx.inst[n].flags & 4))) {
|
||||
textlayer = (xctx.inst[n].ptr+ xctx.sym)->text[j].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer;
|
||||
}
|
||||
if((layer == PINLAYER && inst_ptr[n].flags & 4) || enable_layer[textlayer]) {
|
||||
if((layer == PINLAYER && xctx.inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
ps_draw_string(textlayer, txtptr,
|
||||
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
|
||||
flip^text.flip, text.hcenter, text.vcenter,
|
||||
x0+x1, y0+y1, text.xscale, text.yscale);
|
||||
x0+x1, y0+y1, text.xscale, text.yscale);
|
||||
}
|
||||
}
|
||||
restore_lw();
|
||||
}
|
||||
Tcl_SetResult(interp,"",TCL_STATIC); /* 26102003 */
|
||||
Tcl_SetResult(interp,"",TCL_STATIC);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ static void fill_ps_colors()
|
|||
char s[200]; /* overflow safe 20161122 */
|
||||
unsigned int i,c;
|
||||
if(debug_var>=1) {
|
||||
tcleval( "puts $ps_colors");
|
||||
tcleval( "puts $ps_colors");
|
||||
}
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
my_snprintf(s, S(s), "lindex $ps_colors %d", i);
|
||||
|
|
@ -417,15 +417,15 @@ static void fill_ps_colors()
|
|||
ps_colors[i].green = (c & 0x00ff00) >> 8;
|
||||
ps_colors[i].blue = (c & 0x0000ff);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ps_draw(void)
|
||||
{
|
||||
double dx, dy, delta,scale;
|
||||
int c,i, textlayer;
|
||||
char *tmp=NULL; /* 20161121 */
|
||||
int c,i, textlayer;
|
||||
char *tmp=NULL;
|
||||
int old_grid;
|
||||
int modified_save;
|
||||
const char *r;
|
||||
|
|
@ -441,13 +441,13 @@ void ps_draw(void)
|
|||
}
|
||||
}
|
||||
modified_save=modified;
|
||||
push_undo(); /* 20161121 */
|
||||
push_undo();
|
||||
trim_wires(); /* 20161121 add connection boxes on wires but undo at end */
|
||||
ps_colors=my_calloc(311, cadlayers, sizeof(Ps_color));
|
||||
if(ps_colors==NULL){
|
||||
fprintf(errfp, "ps_draw(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fill_ps_colors();
|
||||
old_grid=draw_grid;
|
||||
draw_grid=0;
|
||||
|
|
@ -455,7 +455,7 @@ void ps_draw(void)
|
|||
dx=areax2-areax1;
|
||||
dy=areay2-areay1;
|
||||
dbg(1, "ps_draw(): dx=%.16g dy=%.16g\n", dx, dy);
|
||||
|
||||
|
||||
fd=fopen("plot.ps", "w");
|
||||
fprintf(fd, "%%!\n");
|
||||
|
||||
|
|
@ -513,44 +513,47 @@ void ps_draw(void)
|
|||
restore_lw();
|
||||
ps_drawgrid();
|
||||
|
||||
for(i=0;i<lasttext;i++)
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
{
|
||||
textlayer = textelement[i].layer; /*20171206 */
|
||||
textlayer = xctx.text[i].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
ps_draw_string(textlayer, textelement[i].txt_ptr,
|
||||
textelement[i].rot, textelement[i].flip, textelement[i].hcenter, textelement[i].vcenter,
|
||||
textelement[i].x0,textelement[i].y0,
|
||||
textelement[i].xscale, textelement[i].yscale);
|
||||
ps_draw_string(textlayer, xctx.text[i].txt_ptr,
|
||||
xctx.text[i].rot, xctx.text[i].flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0,xctx.text[i].y0,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale);
|
||||
}
|
||||
restore_lw();
|
||||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
set_ps_colors(c);
|
||||
for(i=0;i<lastline[c];i++)
|
||||
ps_drawline(c, line[c][i].x1, line[c][i].y1, line[c][i].x2, line[c][i].y2, line[c][i].dash);
|
||||
for(i=0;i<lastrect[c];i++)
|
||||
for(i=0;i<xctx.lines[c];i++)
|
||||
ps_drawline(c, xctx.line[c][i].x1, xctx.line[c][i].y1,
|
||||
xctx.line[c][i].x2, xctx.line[c][i].y2, xctx.line[c][i].dash);
|
||||
for(i=0;i<xctx.rects[c];i++)
|
||||
{
|
||||
ps_filledrect(c, rect[c][i].x1, rect[c][i].y1, rect[c][i].x2, rect[c][i].y2, rect[c][i].dash);
|
||||
ps_filledrect(c, xctx.rect[c][i].x1, xctx.rect[c][i].y1,
|
||||
xctx.rect[c][i].x2, xctx.rect[c][i].y2, xctx.rect[c][i].dash);
|
||||
}
|
||||
for(i=0;i<lastarc[c];i++)
|
||||
for(i=0;i<xctx.arcs[c];i++)
|
||||
{
|
||||
ps_drawarc(c, arc[c][i].fill, arc[c][i].x, arc[c][i].y, arc[c][i].r, arc[c][i].a, arc[c][i].b, arc[c][i].dash);
|
||||
ps_drawarc(c, xctx.arc[c][i].fill, xctx.arc[c][i].x, xctx.arc[c][i].y,
|
||||
xctx.arc[c][i].r, xctx.arc[c][i].a, xctx.arc[c][i].b, xctx.arc[c][i].dash);
|
||||
}
|
||||
for(i=0;i<lastpolygon[c];i++) {
|
||||
ps_drawpolygon(c, NOW, polygon[c][i].x, polygon[c][i].y, polygon[c][i].points,
|
||||
polygon[c][i].fill, polygon[c][i].dash);
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
ps_drawpolygon(c, NOW, xctx.poly[c][i].x, xctx.poly[c][i].y, xctx.poly[c][i].points,
|
||||
xctx.poly[c][i].fill, xctx.poly[c][i].dash);
|
||||
}
|
||||
|
||||
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
ps_draw_symbol(i,c,0,0,0.0,0.0);
|
||||
|
||||
}
|
||||
set_ps_colors(WIRELAYER);
|
||||
for(i=0;i<lastwire;i++)
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
{
|
||||
ps_drawline(WIRELAYER, wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2, 0);
|
||||
ps_drawline(WIRELAYER, xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2, 0);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -565,16 +568,16 @@ void ps_draw(void)
|
|||
y2 = Y_TO_XSCHEM(areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
ps_drawarc(WIRELAYER, 1, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360, 0);
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
ps_drawarc(WIRELAYER, 1, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360, 0);
|
||||
}
|
||||
if( wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
ps_drawarc(WIRELAYER, 1, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360, 0);
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
ps_drawarc(WIRELAYER, 1, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -586,15 +589,15 @@ void ps_draw(void)
|
|||
draw_grid=old_grid;
|
||||
my_free(879, &ps_colors);
|
||||
if(plotfile[0]) {
|
||||
my_strdup(53, &tmp, "convert_to_pdf plot.ps "); /* 20161121 */
|
||||
my_strdup(53, &tmp, "convert_to_pdf plot.ps ");
|
||||
my_strcat(54, &tmp, plotfile);
|
||||
} else {
|
||||
my_strdup(312, &tmp, "convert_to_pdf plot.ps plot.pdf"); /* 20161121 */
|
||||
my_strdup(312, &tmp, "convert_to_pdf plot.ps plot.pdf");
|
||||
}
|
||||
my_strncpy(plotfile,"", S(plotfile));
|
||||
tcleval( tmp);
|
||||
my_free(880, &tmp);
|
||||
pop_undo(0); /* 20161121 */
|
||||
modified=modified_save; /* 20161121 */
|
||||
pop_undo(0);
|
||||
modified=modified_save;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: rawtovcd.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -52,7 +52,7 @@ void replace_bracket(char *s)
|
|||
/* get a short unique ascii identifier to identify node */
|
||||
const char *get_vcd_id(int idx)
|
||||
{
|
||||
static const char syms[] =
|
||||
static const char syms[] =
|
||||
"0123456789abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ=+-_)(*&^%$#@!~`:;',\"<.>/?|";
|
||||
static const int n = sizeof(syms)-1;
|
||||
|
|
@ -88,11 +88,11 @@ void read_binary_block()
|
|||
if(debug) fprintf(stderr, "done reading binary block\n");
|
||||
}
|
||||
|
||||
/* parse ascii raw header section:
|
||||
/* parse ascii raw header section:
|
||||
* returns: 1 if dataset and variables were read.
|
||||
* 0 if transient sim dataset not found
|
||||
* -1 on EOF
|
||||
* Typical ascii header of raw file looks like:
|
||||
* Typical ascii header of raw file looks like:
|
||||
*
|
||||
* Title: **.subckt poweramp
|
||||
* Date: Thu Nov 21 18:36:25 2019
|
||||
|
|
@ -118,7 +118,7 @@ int read_dataset(void)
|
|||
const char *id;
|
||||
char *ptr;
|
||||
int transient = 0;
|
||||
npoints = 0;
|
||||
npoints = 0;
|
||||
nvars = 0;
|
||||
while((ptr = fgets(line, sizeof(line), fd)) ) {
|
||||
if(!strncmp(line, "Binary:", 7)) break; /* start of binary block */
|
||||
|
|
@ -178,7 +178,7 @@ void write_vcd_header()
|
|||
char t[20];
|
||||
int v;
|
||||
printf("$timescale\n");
|
||||
strcpy(t,
|
||||
strcpy(t,
|
||||
timescale == 1e12 ? "1ps" :
|
||||
timescale == 1e11 ? "10ps" :
|
||||
timescale == 1e10 ? "100ps" :
|
||||
|
|
@ -232,7 +232,7 @@ void dump_vcd_waves()
|
|||
} else {
|
||||
if(
|
||||
(val != 0.0 && fabs((val - lastvalue[v]) / val) > rel_timestep_precision) ||
|
||||
(val == 0.0 && fabs(val - lastvalue[v]) > abs_timestep_precision)
|
||||
(val == 0.0 && fabs(val - lastvalue[v]) > abs_timestep_precision)
|
||||
) {
|
||||
printf("r%.3g %s\n", val, vcd_ids[v]);
|
||||
lastvalue[v] = val;
|
||||
|
|
|
|||
791
src/save.c
791
src/save.c
File diff suppressed because it is too large
Load Diff
451
src/scheduler.c
451
src/scheduler.c
File diff suppressed because it is too large
Load Diff
715
src/select.c
715
src/select.c
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
|||
/* File: spice_netlist.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -35,14 +35,14 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
unsigned int *stored_flags;
|
||||
int i, save_ok;
|
||||
char *type=NULL;
|
||||
char *place=NULL; /*20121223 */
|
||||
char *place=NULL;
|
||||
char netl_filename[PATH_MAX]; /* overflow safe 20161122 */
|
||||
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081211 overflow safe 20161122 */
|
||||
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
|
||||
char *subckt_name;
|
||||
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(schematic[currentsch]);
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
|
|
@ -58,24 +58,24 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
bus_replacement_char[1] = str_tmp[1];
|
||||
}
|
||||
netlist_count=0;
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(schematic[currentsch]), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]), getpid());
|
||||
dbg(1, "global_spice_netlist(): opening %s for writing\n",netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(schematic[currentsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx.sch[xctx.currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL) {
|
||||
if(fd==NULL) {
|
||||
dbg(0, "global_spice_netlist(): problems opening netlist file\n");
|
||||
return;
|
||||
}
|
||||
/* netlist_options */
|
||||
for(i=0;i<lastinst;i++) {
|
||||
if(!(inst_ptr[i].ptr+instdef)->type) continue;
|
||||
if( !strcmp((inst_ptr[i].ptr+instdef)->type,"netlist_options") ) {
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if(!(xctx.inst[i].ptr+ xctx.sym)->type) continue;
|
||||
if( !strcmp((xctx.inst[i].ptr+ xctx.sym)->type,"netlist_options") ) {
|
||||
netlist_options(i);
|
||||
}
|
||||
}
|
||||
|
|
@ -83,24 +83,24 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
if(!strcmp(tclgetvar("spiceprefix"), "0")) spiceprefix = 0;
|
||||
|
||||
if(!top_subckt) fprintf(fd,"**");
|
||||
fprintf(fd,".subckt %s", skip_dir( schematic[currentsch]) );
|
||||
fprintf(fd,".subckt %s", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
|
||||
/* print top subckt ipin/opins */
|
||||
for(i=0;i<lastinst;i++) {
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(380, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
my_strdup(380, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
dbg(1, "global_spice_netlist(): |%s|\n", type);
|
||||
if( type && !strcmp(type,"netlist_options") ) {
|
||||
continue;
|
||||
}
|
||||
if( type && IS_PIN(type)) {
|
||||
str_tmp = expandlabel ( get_tok_value(inst_ptr[i].prop_ptr,"lab",0) ,&mult);
|
||||
dbg(1, "global_spice_netlist(): |%s|\n",
|
||||
get_tok_value(inst_ptr[i].prop_ptr,"lab",0));
|
||||
str_tmp = expandlabel ( get_tok_value(xctx.inst[i].prop_ptr,"lab",0) ,&mult);
|
||||
dbg(1, "global_spice_netlist(): |%s|\n",
|
||||
get_tok_value(xctx.inst[i].prop_ptr,"lab",0));
|
||||
/*must handle invalid node names */
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)" );
|
||||
}
|
||||
|
|
@ -108,21 +108,21 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
fprintf(fd,"\n");
|
||||
|
||||
spice_netlist(fd, 0);
|
||||
|
||||
|
||||
first = 0;
|
||||
for(i=0;i<lastinst;i++) /* print netlist_commands of top level cell with no 'place=end' property */
|
||||
for(i=0;i<xctx.instances;i++) /* print netlist_commands of top level cell with no 'place=end' property */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(381, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
my_strdup(382, &place,get_tok_value((inst_ptr[i].ptr+instdef)->prop_ptr,"place",0)); /* 20121223 */
|
||||
my_strdup(381, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(382, &place,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(!place || strcmp(place, "end" )) { /* 20121223 */
|
||||
my_strdup(383, &place,get_tok_value(inst_ptr[i].prop_ptr,"place",0)); /*20160920 */
|
||||
if(!place || strcmp(place, "end" )) { /*20160920 */
|
||||
if(!place || strcmp(place, "end" )) {
|
||||
my_strdup(383, &place,get_tok_value(xctx.inst[i].prop_ptr,"place",0));
|
||||
if(!place || strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
|
|
@ -133,10 +133,10 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
|
||||
netlist_count++;
|
||||
|
||||
if(schprop && schprop[0]) {
|
||||
if(xctx.schprop && xctx.schprop[0]) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
fprintf(fd, "%s\n", schprop);
|
||||
fprintf(fd, "%s\n", xctx.schprop);
|
||||
}
|
||||
if(first) fprintf(fd,"**** end user architecture code\n");
|
||||
/* /20100217 */
|
||||
|
|
@ -145,7 +145,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
fprintf(fd, ".ends\n");
|
||||
|
||||
|
||||
if(split_files) { /* 20081205 */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -153,52 +153,52 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(146, lastinst, sizeof(unsigned int));
|
||||
for(i=0;i<lastinst;i++) stored_flags[i] = inst_ptr[i].flags & 4;
|
||||
stored_flags = my_calloc(146, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
|
||||
if(global)
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
|
||||
currentsch++;
|
||||
dbg(1, "global_spice_netlist(): last defined symbol=%d\n",lastinstdef);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<lastinstdef;i++)
|
||||
xctx.currsch++;
|
||||
dbg(1, "global_spice_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; /* 20070726 */
|
||||
if(!instdef[i].type) continue;
|
||||
if(strcmp(instdef[i].type,"subcircuit")==0 && check_lib(instdef[i].name)) /* 20150409 */
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name))
|
||||
{
|
||||
/* instdef can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(391, &subckt_name, get_cell(instdef[i].name, 0));
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(391, &subckt_name, get_cell(xctx.sym[i].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
{
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if( split_files && strcmp(get_tok_value(instdef[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
vhdl_block_netlist(fd, i); /* 20081209 */
|
||||
else if(split_files && strcmp(get_tok_value(instdef[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
verilog_block_netlist(fd, i); /* 20081209 */
|
||||
if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
vhdl_block_netlist(fd, i);
|
||||
else if(split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
verilog_block_netlist(fd, i);
|
||||
else
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"spice_primitive",0),"true") )
|
||||
spice_block_netlist(fd, i); /* 20081205 */
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_primitive",0),"true") )
|
||||
spice_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
my_free(944, &subckt_name);
|
||||
/*clear_drawing(); */
|
||||
my_strncpy(schematic[currentsch] , "", S(schematic[currentsch]));
|
||||
currentsch--;
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<lastinst; i++) inst_ptr[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
my_free(945, &stored_flags);
|
||||
|
|
@ -209,26 +209,26 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
/* =================================== 20121223 */
|
||||
first = 0;
|
||||
if(!split_files) {
|
||||
for(i=0;i<lastinst;i++) /* print netlist_commands of top level cell with 'place=end' property */
|
||||
for(i=0;i<xctx.instances;i++) /* print netlist_commands of top level cell with 'place=end' property */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(384, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
my_strdup(385, &place,get_tok_value((inst_ptr[i].ptr+instdef)->prop_ptr,"place",0)); /* 20121223 */
|
||||
my_strdup(384, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
my_strdup(385, &place,get_tok_value((xctx.inst[i].ptr+ xctx.sym)->prop_ptr,"place",0));
|
||||
if( type && !strcmp(type,"netlist_commands") ) {
|
||||
if(place && !strcmp(place, "end" )) { /* 20121223 */
|
||||
if(place && !strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ; /* 20160920 */
|
||||
} else { /* 20160920 */
|
||||
my_strdup(386, &place,get_tok_value(inst_ptr[i].prop_ptr,"place",0)); /*20160920 */
|
||||
if(place && !strcmp(place, "end" )) { /* 20160920 */
|
||||
print_spice_element(fd, i) ;
|
||||
} else {
|
||||
my_strdup(386, &place,get_tok_value(xctx.inst[i].prop_ptr,"place",0));
|
||||
if(place && !strcmp(place, "end" )) {
|
||||
if(first == 0) fprintf(fd,"**** begin user architecture code\n");
|
||||
first++;
|
||||
print_spice_element(fd, i) ; /* 20160920 */
|
||||
print_spice_element(fd, i) ;
|
||||
}
|
||||
}
|
||||
} /* netlist_commands */
|
||||
|
|
@ -250,7 +250,7 @@ void global_spice_netlist(int global) /* netlister driver */
|
|||
|
||||
|
||||
/* 20150922 added split_files check */
|
||||
if(!split_files) fprintf(fd, ".end\n"); /* 20081202 */
|
||||
if(!split_files) fprintf(fd, ".end\n");
|
||||
|
||||
dbg(1, "global_spice_netlist(): starting awk on netlist!\n");
|
||||
|
||||
|
|
@ -290,63 +290,63 @@ static char *model_name(const char *m)
|
|||
return model_name_result;
|
||||
}
|
||||
|
||||
void spice_block_netlist(FILE *fd, int i) /*20081223 */
|
||||
void spice_block_netlist(FILE *fd, int i)
|
||||
{
|
||||
int spice_stop=0; /* 20111113 */
|
||||
int spice_stop=0;
|
||||
char netl_filename[PATH_MAX];
|
||||
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081202 */
|
||||
char cellname[PATH_MAX]; /* 20081202 */
|
||||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
char filename[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
/* int j; */
|
||||
/* int mult; */
|
||||
char *extra=NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(instdef[i].prop_ptr,"spice_stop",0),"true") )
|
||||
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"spice_stop",0),"true") )
|
||||
spice_stop=1;
|
||||
else
|
||||
spice_stop=0;
|
||||
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(instdef[i].name), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sym[i].name), getpid());
|
||||
dbg(1, "spice_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(instdef[i].name));
|
||||
my_snprintf(cellname, S(cellname), "%s.spice", skip_dir(xctx.sym[i].name));
|
||||
}
|
||||
|
||||
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n\n",
|
||||
instdef[i].name,instdef[i].rects[PINLAYER] );
|
||||
|
||||
fprintf(fd, ".subckt %s ",skip_dir(instdef[i].name));
|
||||
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
|
||||
fprintf(fd, ".subckt %s ",skip_dir(xctx.sym[i].name));
|
||||
print_spice_subckt(fd, i);
|
||||
|
||||
my_strdup(387, &extra, get_tok_value(instdef[i].prop_ptr,"extra",0) ); /* 20081206 */
|
||||
my_strdup(387, &extra, get_tok_value(xctx.sym[i].prop_ptr,"extra",0) );
|
||||
fprintf(fd, "%s ", extra ? extra : "" );
|
||||
|
||||
|
||||
/* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */
|
||||
fprintf(fd, "%s", get_sym_template(instdef[i].templ, extra)); /* 20150409 */
|
||||
fprintf(fd, "%s", get_sym_template(xctx.sym[i].templ, extra));
|
||||
my_free(950, &extra);
|
||||
fprintf(fd, "\n");
|
||||
|
||||
if((str_tmp = get_tok_value(instdef[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
load_schematic(1, add_ext(abs_sym_path(instdef[i].name, ""), ".sch") ,0); /* 20190518 */
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch") ,0);
|
||||
}
|
||||
spice_netlist(fd, spice_stop); /* 20111113 added spice_stop */
|
||||
netlist_count++;
|
||||
|
||||
/* 20100217 */
|
||||
if(schprop && schprop[0]) {
|
||||
|
||||
if(xctx.schprop && xctx.schprop[0]) {
|
||||
fprintf(fd,"**** begin user architecture code\n");
|
||||
fprintf(fd, "%s\n", schprop);
|
||||
fprintf(fd, "%s\n", xctx.schprop);
|
||||
fprintf(fd,"**** end user architecture code\n");
|
||||
}
|
||||
/* /20100217 */
|
||||
|
||||
fprintf(fd, ".ends\n\n");
|
||||
if(split_files) { /* 20081204 */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -363,33 +363,33 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
prepare_netlist_structs(1);
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
if(!spice_stop) { /* 20111113 */
|
||||
for(i=0;i<lastinst;i++) /* print first ipin/opin defs ... */
|
||||
if(!spice_stop) {
|
||||
for(i=0;i<xctx.instances;i++) /* print first ipin/opin defs ... */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(388, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
my_strdup(388, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && IS_PIN(type) ) {
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0;i<lastinst;i++) /* ... then print other lines */
|
||||
|
||||
for(i=0;i<xctx.instances;i++) /* ... then print other lines */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "spice_ignore",0 ), "true") ) {/*20070726 */
|
||||
continue; /*20070726 */
|
||||
} /*20070726 */
|
||||
|
||||
my_strdup(390, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"spice_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "spice_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
my_strdup(390, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && !IS_LABEL_OR_PIN(type) ) {
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; /* already done in global_spice_netlist */
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(inst_ptr[i].prop_ptr, "only_toplevel", 0), "true")) continue; /* 20160418 */
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx.inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
if(!strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd,"**** begin user architecture code\n");
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
|
|
@ -398,10 +398,10 @@ void spice_netlist(FILE *fd, int spice_stop )
|
|||
const char *m;
|
||||
print_spice_element(fd, i) ; /* this is the element line */
|
||||
/* hash device_model attribute if any */
|
||||
m = get_tok_value(inst_ptr[i].prop_ptr, "device_model", 2);
|
||||
m = get_tok_value(xctx.inst[i].prop_ptr, "device_model", 2);
|
||||
if(m[0]) hash_lookup(model_table, model_name(m), m, XINSERT);
|
||||
else {
|
||||
m = get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "device_model", 2);
|
||||
m = get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "device_model", 2);
|
||||
if(m[0]) hash_lookup(model_table, model_name(m), m, XINSERT);
|
||||
}
|
||||
my_free(951, &model_name_result);
|
||||
|
|
@ -431,7 +431,7 @@ static unsigned int hash(const char *tok)
|
|||
/* token value what ... what ...
|
||||
* --------------------------------------------------------------------------
|
||||
* "whatever" "whatever" XINSERT insert in hash table if not in.
|
||||
* if already present update value if not NULL,
|
||||
* if already present update value if not NULL,
|
||||
* return entry address.
|
||||
* "whatever" "whatever" XINSERT_NOREPLACE same as XINSERT but do not replace existing value
|
||||
* return NULL if not found.
|
||||
|
|
@ -444,7 +444,7 @@ struct hashentry *hash_lookup(struct hashentry **table, const char *token, const
|
|||
unsigned int hashcode, index;
|
||||
struct hashentry *entry, *saveptr, **preventry;
|
||||
int s ;
|
||||
|
||||
|
||||
if(token==NULL) return NULL;
|
||||
hashcode=hash(token);
|
||||
index=hashcode % HASHSIZE;
|
||||
|
|
@ -518,7 +518,7 @@ void free_hash(struct hashentry **table)
|
|||
/* token value what ... what ...
|
||||
* --------------------------------------------------------------------------
|
||||
* "whatever" "whatever" XINSERT insert in hash table if not in.
|
||||
* if already present update value if not NULL,
|
||||
* if already present update value if not NULL,
|
||||
* return entry address.
|
||||
* "whatever" "whatever" XINSERT_NOREPLACE same as XINSERT but do not replace existing value
|
||||
* return NULL if not found.
|
||||
|
|
@ -531,7 +531,7 @@ struct int_hashentry *int_hash_lookup(struct int_hashentry **table, const char *
|
|||
unsigned int hashcode, index;
|
||||
struct int_hashentry *entry, *saveptr, **preventry;
|
||||
int s ;
|
||||
|
||||
|
||||
if(token==NULL) return NULL;
|
||||
hashcode=hash(token);
|
||||
index=hashcode % HASHSIZE;
|
||||
|
|
|
|||
304
src/store.c
304
src/store.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: store.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -25,10 +25,10 @@
|
|||
|
||||
void check_wire_storage(void)
|
||||
{
|
||||
if(lastwire >= max_wires)
|
||||
if(xctx.wires >= xctx.maxw)
|
||||
{
|
||||
max_wires=(1+lastwire / CADMAXWIRES)*CADMAXWIRES;
|
||||
my_realloc(392, &wire, sizeof(Wire)*max_wires);
|
||||
xctx.maxw=(1+xctx.wires / CADMAXWIRES)*CADMAXWIRES;
|
||||
my_realloc(392, &xctx.wire, sizeof(xWire)*xctx.maxw);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -43,58 +43,58 @@ void check_selected_storage(void)
|
|||
|
||||
void check_text_storage(void)
|
||||
{
|
||||
if(lasttext >= max_texts)
|
||||
if(xctx.texts >= xctx.maxt)
|
||||
{
|
||||
max_texts=(1 + lasttext / CADMAXTEXT) * CADMAXTEXT;
|
||||
my_realloc(394, &textelement, sizeof(Text)*max_texts);
|
||||
xctx.maxt=(1 + xctx.texts / CADMAXTEXT) * CADMAXTEXT;
|
||||
my_realloc(394, &xctx.text, sizeof(xText)*xctx.maxt);
|
||||
}
|
||||
}
|
||||
|
||||
void check_symbol_storage(void)
|
||||
{
|
||||
int i;
|
||||
if(lastinstdef >= max_symbols)
|
||||
if(xctx.symbols >= xctx.maxs)
|
||||
{
|
||||
dbg(1, "check_symbol_storage(): more than max_symbols, %s\n",
|
||||
schematic[currentsch] );
|
||||
max_symbols=(1 + lastinstdef / ELEMDEF) * ELEMDEF;
|
||||
my_realloc(395, &instdef, sizeof(Instdef)*max_symbols);
|
||||
for(i=lastinstdef;i<max_symbols;i++) {
|
||||
instdef[i].polygonptr=my_calloc(68, cadlayers, sizeof(xPolygon *));
|
||||
if(instdef[i].polygonptr==NULL){
|
||||
dbg(1, "check_symbol_storage(): more than xctx.maxs, %s\n",
|
||||
xctx.sch[xctx.currsch] );
|
||||
xctx.maxs=(1 + xctx.symbols / ELEMDEF) * ELEMDEF;
|
||||
my_realloc(395, &xctx.sym, sizeof(xSymbol)*xctx.maxs);
|
||||
for(i=xctx.symbols;i<xctx.maxs;i++) {
|
||||
xctx.sym[i].poly=my_calloc(68, cadlayers, sizeof(xPoly *));
|
||||
if(xctx.sym[i].poly==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
instdef[i].arcptr=my_calloc(396, cadlayers, sizeof(xArc *));
|
||||
if(instdef[i].arcptr==NULL){
|
||||
|
||||
xctx.sym[i].arc=my_calloc(396, cadlayers, sizeof(xArc *));
|
||||
if(xctx.sym[i].arc==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
instdef[i].lineptr=my_calloc(397, cadlayers, sizeof(Line *));
|
||||
if(instdef[i].lineptr==NULL){
|
||||
|
||||
xctx.sym[i].line=my_calloc(397, cadlayers, sizeof(xLine *));
|
||||
if(xctx.sym[i].line==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
instdef[i].boxptr=my_calloc(398, cadlayers, sizeof(Box *));
|
||||
if(instdef[i].boxptr==NULL){
|
||||
|
||||
xctx.sym[i].rect=my_calloc(398, cadlayers, sizeof(xRect *));
|
||||
if(xctx.sym[i].rect==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
instdef[i].lines=my_calloc(399, cadlayers, sizeof(int));
|
||||
if(instdef[i].lines==NULL){
|
||||
|
||||
xctx.sym[i].lines=my_calloc(399, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].lines==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
instdef[i].rects=my_calloc(400, cadlayers, sizeof(int));
|
||||
if(instdef[i].rects==NULL){
|
||||
|
||||
xctx.sym[i].rects=my_calloc(400, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].rects==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
instdef[i].polygons=my_calloc(401, cadlayers, sizeof(int)); /* 20171115 */
|
||||
if(instdef[i].polygons==NULL){
|
||||
xctx.sym[i].polygons=my_calloc(401, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].polygons==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
instdef[i].arcs=my_calloc(66, cadlayers, sizeof(int)); /* 20171115 */
|
||||
if(instdef[i].arcs==NULL){
|
||||
xctx.sym[i].arcs=my_calloc(66, cadlayers, sizeof(int));
|
||||
if(xctx.sym[i].arcs==NULL){
|
||||
fprintf(errfp, "check_symbol_storage(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
}
|
||||
|
|
@ -104,132 +104,132 @@ void check_symbol_storage(void)
|
|||
|
||||
void check_inst_storage(void)
|
||||
{
|
||||
if(lastinst >= max_instances)
|
||||
if(xctx.instances >= xctx.maxi)
|
||||
{
|
||||
max_instances=(1 + lastinst / ELEMINST) * ELEMINST;
|
||||
my_realloc(402, &inst_ptr, sizeof(Instance)*max_instances);
|
||||
xctx.maxi=(1 + xctx.instances / ELEMINST) * ELEMINST;
|
||||
my_realloc(402, &xctx.inst, sizeof(xInstance)*xctx.maxi);
|
||||
}
|
||||
}
|
||||
|
||||
void check_arc_storage(int c)
|
||||
{
|
||||
if(lastarc[c] >= max_arcs[c])
|
||||
if(xctx.arcs[c] >= xctx.maxa[c])
|
||||
{
|
||||
max_arcs[c]=(1 + lastarc[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(403, &arc[c], sizeof(xArc)*max_arcs[c]);
|
||||
xctx.maxa[c]=(1 + xctx.arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(403, &xctx.arc[c], sizeof(xArc)*xctx.maxa[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void check_box_storage(int c)
|
||||
{
|
||||
if(lastrect[c] >= max_rects[c])
|
||||
if(xctx.rects[c] >= xctx.maxr[c])
|
||||
{
|
||||
max_rects[c]=(1 + lastrect[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(404, &rect[c], sizeof(Box)*max_rects[c]);
|
||||
xctx.maxr[c]=(1 + xctx.rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(404, &xctx.rect[c], sizeof(xRect)*xctx.maxr[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void check_line_storage(int c)
|
||||
{
|
||||
if(lastline[c] >= max_lines[c])
|
||||
if(xctx.lines[c] >= xctx.maxl[c])
|
||||
{
|
||||
max_lines[c]=(1 + lastline[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(405, &line[c], sizeof(Line)*max_lines[c]);
|
||||
xctx.maxl[c]=(1 + xctx.lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(405, &xctx.line[c], sizeof(xLine)*xctx.maxl[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void check_polygon_storage(int c) /*20171115 */
|
||||
void check_polygon_storage(int c)
|
||||
{
|
||||
if(lastpolygon[c] >= max_polygons[c])
|
||||
if(xctx.polygons[c] >= xctx.maxp[c])
|
||||
{
|
||||
max_polygons[c]=(1 + lastpolygon[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(406, &polygon[c], sizeof(xPolygon)*max_polygons[c]);
|
||||
xctx.maxp[c]=(1 + xctx.polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
|
||||
my_realloc(406, &xctx.poly[c], sizeof(xPoly)*xctx.maxp[c]);
|
||||
}
|
||||
}
|
||||
|
||||
void store_arc(int pos, double x, double y, double r, double a, double b,
|
||||
void store_arc(int pos, double x, double y, double r, double a, double b,
|
||||
unsigned int rectcolor, unsigned short sel, char *prop_ptr)
|
||||
{
|
||||
int n, j;
|
||||
const char *dash;
|
||||
check_arc_storage(rectcolor);
|
||||
if(pos==-1) n=lastarc[rectcolor];
|
||||
if(pos==-1) n=xctx.arcs[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=lastarc[rectcolor];j>pos;j--)
|
||||
for(j=xctx.arcs[rectcolor];j>pos;j--)
|
||||
{
|
||||
arc[rectcolor][j]=arc[rectcolor][j-1];
|
||||
xctx.arc[rectcolor][j]=xctx.arc[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
arc[rectcolor][n].x = x;
|
||||
arc[rectcolor][n].y = y;
|
||||
arc[rectcolor][n].r = r;
|
||||
arc[rectcolor][n].a = a;
|
||||
arc[rectcolor][n].b = b;
|
||||
arc[rectcolor][n].prop_ptr = NULL;
|
||||
my_strdup(407, &arc[rectcolor][n].prop_ptr, prop_ptr);
|
||||
arc[rectcolor][n].sel = sel;
|
||||
if( !strcmp(get_tok_value(arc[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
arc[rectcolor][n].fill =1;
|
||||
xctx.arc[rectcolor][n].x = x;
|
||||
xctx.arc[rectcolor][n].y = y;
|
||||
xctx.arc[rectcolor][n].r = r;
|
||||
xctx.arc[rectcolor][n].a = a;
|
||||
xctx.arc[rectcolor][n].b = b;
|
||||
xctx.arc[rectcolor][n].prop_ptr = NULL;
|
||||
my_strdup(407, &xctx.arc[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx.arc[rectcolor][n].sel = sel;
|
||||
if( !strcmp(get_tok_value(xctx.arc[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
xctx.arc[rectcolor][n].fill =1;
|
||||
else
|
||||
arc[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(arc[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx.arc[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(xctx.arc[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
arc[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx.arc[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
arc[rectcolor][n].dash = 0;
|
||||
xctx.arc[rectcolor][n].dash = 0;
|
||||
|
||||
lastarc[rectcolor]++;
|
||||
xctx.arcs[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
void store_polygon(int pos, double *x, double *y, int points, unsigned int rectcolor, unsigned short sel, char *prop_ptr)
|
||||
void store_poly(int pos, double *x, double *y, int points, unsigned int rectcolor, unsigned short sel, char *prop_ptr)
|
||||
{
|
||||
int n, j;
|
||||
const char *dash;
|
||||
check_polygon_storage(rectcolor);
|
||||
if(pos==-1) n=lastpolygon[rectcolor];
|
||||
if(pos==-1) n=xctx.polygons[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=lastpolygon[rectcolor];j>pos;j--)
|
||||
for(j=xctx.polygons[rectcolor];j>pos;j--)
|
||||
{
|
||||
polygon[rectcolor][j]=polygon[rectcolor][j-1];
|
||||
xctx.poly[rectcolor][j]=xctx.poly[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "store_polygon(): storing POLYGON %d\n",n);
|
||||
|
||||
polygon[rectcolor][n].x=NULL;
|
||||
polygon[rectcolor][n].y=NULL;
|
||||
polygon[rectcolor][n].selected_point=NULL;
|
||||
polygon[rectcolor][n].prop_ptr=NULL;
|
||||
polygon[rectcolor][n].x= my_calloc(408, points, sizeof(double));
|
||||
polygon[rectcolor][n].y= my_calloc(409, points, sizeof(double));
|
||||
polygon[rectcolor][n].selected_point= my_calloc(410, points, sizeof(unsigned short));
|
||||
my_strdup(411, &polygon[rectcolor][n].prop_ptr, prop_ptr);
|
||||
for(j=0;j<points; j++) {
|
||||
polygon[rectcolor][n].x[j] = x[j];
|
||||
polygon[rectcolor][n].y[j] = y[j];
|
||||
}
|
||||
polygon[rectcolor][n].points = points;
|
||||
polygon[rectcolor][n].sel = sel;
|
||||
dbg(2, "store_poly(): storing POLYGON %d\n",n);
|
||||
|
||||
/* 20181002 */
|
||||
if( !strcmp(get_tok_value(polygon[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
polygon[rectcolor][n].fill =1;
|
||||
xctx.poly[rectcolor][n].x=NULL;
|
||||
xctx.poly[rectcolor][n].y=NULL;
|
||||
xctx.poly[rectcolor][n].selected_point=NULL;
|
||||
xctx.poly[rectcolor][n].prop_ptr=NULL;
|
||||
xctx.poly[rectcolor][n].x= my_calloc(408, points, sizeof(double));
|
||||
xctx.poly[rectcolor][n].y= my_calloc(409, points, sizeof(double));
|
||||
xctx.poly[rectcolor][n].selected_point= my_calloc(410, points, sizeof(unsigned short));
|
||||
my_strdup(411, &xctx.poly[rectcolor][n].prop_ptr, prop_ptr);
|
||||
for(j=0;j<points; j++) {
|
||||
xctx.poly[rectcolor][n].x[j] = x[j];
|
||||
xctx.poly[rectcolor][n].y[j] = y[j];
|
||||
}
|
||||
xctx.poly[rectcolor][n].points = points;
|
||||
xctx.poly[rectcolor][n].sel = sel;
|
||||
|
||||
|
||||
if( !strcmp(get_tok_value(xctx.poly[rectcolor][n].prop_ptr,"fill",0),"true") )
|
||||
xctx.poly[rectcolor][n].fill =1;
|
||||
else
|
||||
polygon[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(polygon[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx.poly[rectcolor][n].fill =0;
|
||||
dash = get_tok_value(xctx.poly[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
polygon[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx.poly[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
polygon[rectcolor][n].dash = 0;
|
||||
xctx.poly[rectcolor][n].dash = 0;
|
||||
|
||||
|
||||
lastpolygon[rectcolor]++;
|
||||
xctx.polygons[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
|
||||
|
|
@ -243,92 +243,92 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
{
|
||||
check_line_storage(rectcolor);
|
||||
|
||||
if(pos==-1) n=lastline[rectcolor];
|
||||
if(pos==-1) n=xctx.lines[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=lastline[rectcolor];j>pos;j--)
|
||||
for(j=xctx.lines[rectcolor];j>pos;j--)
|
||||
{
|
||||
line[rectcolor][j]=line[rectcolor][j-1];
|
||||
xctx.line[rectcolor][j]=xctx.line[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "storeobject(): storing LINE %d\n",n);
|
||||
line[rectcolor][n].x1=x1;
|
||||
line[rectcolor][n].x2=x2;
|
||||
line[rectcolor][n].y1=y1;
|
||||
line[rectcolor][n].y2=y2;
|
||||
line[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(412, &line[rectcolor][n].prop_ptr, prop_ptr);
|
||||
line[rectcolor][n].sel=sel;
|
||||
if( !strcmp(get_tok_value(line[rectcolor][n].prop_ptr, "bus", 0), "true") )
|
||||
line[rectcolor][n].bus = 1;
|
||||
xctx.line[rectcolor][n].x1=x1;
|
||||
xctx.line[rectcolor][n].x2=x2;
|
||||
xctx.line[rectcolor][n].y1=y1;
|
||||
xctx.line[rectcolor][n].y2=y2;
|
||||
xctx.line[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(412, &xctx.line[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx.line[rectcolor][n].sel=sel;
|
||||
if( !strcmp(get_tok_value(xctx.line[rectcolor][n].prop_ptr, "bus", 0), "true") )
|
||||
xctx.line[rectcolor][n].bus = 1;
|
||||
else
|
||||
line[rectcolor][n].bus = 0;
|
||||
dash = get_tok_value(line[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx.line[rectcolor][n].bus = 0;
|
||||
dash = get_tok_value(xctx.line[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
line[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx.line[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
line[rectcolor][n].dash = 0;
|
||||
lastline[rectcolor]++;
|
||||
xctx.line[rectcolor][n].dash = 0;
|
||||
xctx.lines[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
if(type == xRECT)
|
||||
{
|
||||
check_box_storage(rectcolor);
|
||||
if(pos==-1) n=lastrect[rectcolor];
|
||||
if(pos==-1) n=xctx.rects[rectcolor];
|
||||
else
|
||||
{
|
||||
for(j=lastrect[rectcolor];j>pos;j--)
|
||||
for(j=xctx.rects[rectcolor];j>pos;j--)
|
||||
{
|
||||
rect[rectcolor][j]=rect[rectcolor][j-1];
|
||||
xctx.rect[rectcolor][j]=xctx.rect[rectcolor][j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "storeobject(): storing RECT %d\n",n);
|
||||
rect[rectcolor][n].x1=x1;
|
||||
rect[rectcolor][n].x2=x2;
|
||||
rect[rectcolor][n].y1=y1;
|
||||
rect[rectcolor][n].y2=y2;
|
||||
rect[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(413, &rect[rectcolor][n].prop_ptr, prop_ptr);
|
||||
rect[rectcolor][n].sel=sel;
|
||||
dash = get_tok_value(rect[rectcolor][n].prop_ptr,"dash",0);
|
||||
xctx.rect[rectcolor][n].x1=x1;
|
||||
xctx.rect[rectcolor][n].x2=x2;
|
||||
xctx.rect[rectcolor][n].y1=y1;
|
||||
xctx.rect[rectcolor][n].y2=y2;
|
||||
xctx.rect[rectcolor][n].prop_ptr=NULL;
|
||||
my_strdup(413, &xctx.rect[rectcolor][n].prop_ptr, prop_ptr);
|
||||
xctx.rect[rectcolor][n].sel=sel;
|
||||
dash = get_tok_value(xctx.rect[rectcolor][n].prop_ptr,"dash",0);
|
||||
if( strcmp(dash, "") ) {
|
||||
int d = atoi(dash);
|
||||
rect[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
xctx.rect[rectcolor][n].dash = d >= 0 ? d : 0;
|
||||
} else
|
||||
rect[rectcolor][n].dash = 0;
|
||||
lastrect[rectcolor]++;
|
||||
xctx.rect[rectcolor][n].dash = 0;
|
||||
xctx.rects[rectcolor]++;
|
||||
set_modify(1);
|
||||
}
|
||||
if(type == WIRE)
|
||||
{
|
||||
check_wire_storage();
|
||||
if(pos==-1) n=lastwire;
|
||||
if(pos==-1) n=xctx.wires;
|
||||
else
|
||||
{
|
||||
for(j=lastwire;j>pos;j--)
|
||||
for(j=xctx.wires;j>pos;j--)
|
||||
{
|
||||
wire[j]=wire[j-1];
|
||||
xctx.wire[j]=xctx.wire[j-1];
|
||||
}
|
||||
n=pos;
|
||||
}
|
||||
dbg(2, "storeobject(): storing WIRE %d\n",n);
|
||||
wire[n].x1=x1;
|
||||
wire[n].y1=y1;
|
||||
wire[n].x2=x2;
|
||||
wire[n].y2=y2;
|
||||
wire[n].prop_ptr=NULL;
|
||||
wire[n].node=NULL;
|
||||
wire[n].end1=0;
|
||||
wire[n].end2=0;
|
||||
my_strdup(414, &wire[n].prop_ptr, prop_ptr);
|
||||
if(!strcmp(get_tok_value(wire[n].prop_ptr,"bus",0), "true")) wire[n].bus=1; /* 20171201 */
|
||||
else wire[n].bus=0;
|
||||
xctx.wire[n].x1=x1;
|
||||
xctx.wire[n].y1=y1;
|
||||
xctx.wire[n].x2=x2;
|
||||
xctx.wire[n].y2=y2;
|
||||
xctx.wire[n].prop_ptr=NULL;
|
||||
xctx.wire[n].node=NULL;
|
||||
xctx.wire[n].end1=0;
|
||||
xctx.wire[n].end2=0;
|
||||
my_strdup(414, &xctx.wire[n].prop_ptr, prop_ptr);
|
||||
if(!strcmp(get_tok_value(xctx.wire[n].prop_ptr,"bus",0), "true")) xctx.wire[n].bus=1;
|
||||
else xctx.wire[n].bus=0;
|
||||
|
||||
wire[n].sel=sel;
|
||||
lastwire++;
|
||||
xctx.wire[n].sel=sel;
|
||||
xctx.wires++;
|
||||
set_modify(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -336,14 +336,14 @@ void storeobject(int pos, double x1,double y1,double x2,double y2,
|
|||
void freenet_nocheck(int i)
|
||||
{
|
||||
int j;
|
||||
my_free(959, &wire[i].prop_ptr);
|
||||
my_free(960, &wire[i].node);
|
||||
for(j=i+1;j<lastwire;j++)
|
||||
my_free(959, &xctx.wire[i].prop_ptr);
|
||||
my_free(960, &xctx.wire[i].node);
|
||||
for(j=i+1;j<xctx.wires;j++)
|
||||
{
|
||||
wire[j-1] = wire[j];
|
||||
wire[j].prop_ptr=NULL;
|
||||
wire[j].node=NULL;
|
||||
xctx.wire[j-1] = xctx.wire[j];
|
||||
xctx.wire[j].prop_ptr=NULL;
|
||||
xctx.wire[j].node=NULL;
|
||||
} /*end for j */
|
||||
lastwire--;
|
||||
xctx.wires--;
|
||||
}
|
||||
|
||||
|
|
|
|||
212
src/svgdraw.c
212
src/svgdraw.c
|
|
@ -1,7 +1,7 @@
|
|||
/* File: svgdraw.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -21,10 +21,10 @@
|
|||
*/
|
||||
|
||||
#include "xschem.h"
|
||||
#define X_TO_SVG(x) ( (x+xorigin)* mooz )
|
||||
#define Y_TO_SVG(y) ( (y+yorigin)* mooz )
|
||||
#define X_TO_SVG(x) ( (x+xctx.xorigin)* xctx.mooz )
|
||||
#define Y_TO_SVG(y) ( (y+xctx.yorigin)* xctx.mooz )
|
||||
|
||||
static FILE *fd;
|
||||
static FILE *fd;
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -38,7 +38,7 @@ static Svg_color *svg_colors;
|
|||
static double svg_linew; /* current width of lines / rectangles */
|
||||
static Svg_color svg_stroke;
|
||||
|
||||
static void restore_lw(void)
|
||||
static void restore_lw(void)
|
||||
{
|
||||
svg_linew = lw_double*0.7;
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ static void set_svg_colors(unsigned int pixel)
|
|||
static void svg_xdrawline(int layer, double x1, double y1, double x2, double y2, int dash)
|
||||
{
|
||||
fprintf(fd,"<path class=\"l%d\" ", layer);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/zoom, 1.4*dash/zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
fprintf(fd,"d=\"M%g %gL%g %g\"/>\n", x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ static void svg_xdrawpoint(int layer, double x1, double y1)
|
|||
static void svg_xfillrectangle(int layer, double x1, double y1, double x2, double y2, int dash)
|
||||
{
|
||||
fprintf(fd,"<path class=\"l%d\" ", layer);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/zoom, 1.4*dash/zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
fprintf(fd,"d=\"M%g %gL%g %gL%g %gL%g %gL%g %gz\"/>\n", x1, y1, x2, y1, x2, y2, x1, y2, x1, y1);
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ static void svg_drawpolygon(int c, int what, double *x, double *y, int points, i
|
|||
return;
|
||||
}
|
||||
fprintf(fd, "<path class=\"l%d\" ", c);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/zoom, 1.4*dash/zoom);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(fill) {
|
||||
fprintf(fd,"style=\"fill:#%02x%02x%02x;\" d=\"", svg_stroke.red, svg_stroke.green, svg_stroke.blue);
|
||||
} else {
|
||||
|
|
@ -134,7 +134,7 @@ static void svg_drawcircle(int gc, int fillarc, double x,double y,double r,doubl
|
|||
|
||||
xx=X_TO_SVG(x);
|
||||
yy=Y_TO_SVG(y);
|
||||
rr=r*mooz;
|
||||
rr=r*xctx.mooz;
|
||||
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
|
||||
x1=X_TO_SVG(x1);
|
||||
y1=Y_TO_SVG(y1);
|
||||
|
|
@ -143,9 +143,9 @@ static void svg_drawcircle(int gc, int fillarc, double x,double y,double r,doubl
|
|||
|
||||
if( rectclip(areax1,areay1,areax2,areay2,&x1,&y1,&x2,&y2) )
|
||||
{
|
||||
fprintf(fd,
|
||||
fprintf(fd,
|
||||
"<circle cx=\"%g\" cy=\"%g\" r=\"%g\" stroke=\"rgb(%d,%d,%d)\" fill=\"rgb(%d,%d,%d)\" stroke-width=\"%g\"/>\n",
|
||||
xx, yy, rr, svg_stroke.red, svg_stroke.green, svg_stroke.blue,
|
||||
xx, yy, rr, svg_stroke.red, svg_stroke.green, svg_stroke.blue,
|
||||
svg_stroke.red, svg_stroke.green, svg_stroke.blue, svg_linew/4);
|
||||
}
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
|
||||
xx=X_TO_SVG(x);
|
||||
yy=Y_TO_SVG(y);
|
||||
rr=r*mooz;
|
||||
rr=r*xctx.mooz;
|
||||
arc_bbox(x, y, r, a, b, &x1,&y1,&x2,&y2);
|
||||
x1=X_TO_SVG(x1);
|
||||
y1=Y_TO_SVG(y1);
|
||||
|
|
@ -170,11 +170,11 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
{
|
||||
if(b == 360.) {
|
||||
fprintf(fd, "<circle cx=\"%g\" cy=\"%g\" r=\"%g\" ", xx, yy, rr);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/zoom, 1.4*dash/zoom);
|
||||
if(fillarc)
|
||||
fprintf(fd,
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(fillarc)
|
||||
fprintf(fd,
|
||||
"fill=\"rgb(%d,%d,%d)\" stroke=\"rgb(%d,%d,%d)\" stroke-width=\"%g\"/>\n",
|
||||
svg_stroke.red, svg_stroke.green, svg_stroke.blue,
|
||||
svg_stroke.red, svg_stroke.green, svg_stroke.blue,
|
||||
svg_stroke.red, svg_stroke.green, svg_stroke.blue, svg_linew);
|
||||
else
|
||||
fprintf(fd, "stroke=\"rgb(%d,%d,%d)\" fill=\"none\" stroke-width=\"%g\"/>\n",
|
||||
|
|
@ -186,10 +186,10 @@ static void svg_drawarc(int gc, int fillarc, double x,double y,double r,double a
|
|||
yy2 = -rr * sin((a + b) * XSCH_PI / 180.) + yy;
|
||||
fa = b > 180 ? 1 : 0;
|
||||
fs = b > 0 ? 0 : 1;
|
||||
|
||||
|
||||
fprintf(fd,"<path class=\"l%d\" ", gc);
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/zoom, 1.4*dash/zoom);
|
||||
if(fillarc)
|
||||
if(dash) fprintf(fd, "stroke-dasharray=\"%g,%g\" ", 1.4*dash/xctx.zoom, 1.4*dash/xctx.zoom);
|
||||
if(fillarc)
|
||||
fprintf(fd,"style=\"fill:%02x%02x%02x;\" d=\"", svg_stroke.red, svg_stroke.green, svg_stroke.blue);
|
||||
else
|
||||
fprintf(fd,"style=\"fill:none\" d=\"");
|
||||
|
|
@ -213,15 +213,15 @@ static void svg_drawline(int gc, double linex1,double liney1,double linex2,doubl
|
|||
}
|
||||
}
|
||||
|
||||
static void svg_draw_string(int gctext, const char *str,
|
||||
int rot, int flip, int hcenter, int vcenter,
|
||||
static void svg_draw_string(int gctext, const char *str,
|
||||
int rot, int flip, int hcenter, int vcenter,
|
||||
double x1,double y1,
|
||||
double xscale, double yscale)
|
||||
double xscale, double yscale)
|
||||
|
||||
{
|
||||
double a,yy,curr_x1,curr_y1,curr_x2,curr_y2,rx1,rx2,ry1,ry2;
|
||||
int pos=0,cc,pos2=0;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if(str==NULL) return;
|
||||
#ifdef HAS_CAIRO
|
||||
|
|
@ -239,13 +239,13 @@ static void svg_draw_string(int gctext, const char *str,
|
|||
while(str[pos2])
|
||||
{
|
||||
cc = (int)str[pos2++];
|
||||
if(cc=='\n')
|
||||
if(cc=='\n')
|
||||
{
|
||||
yy+=(FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*
|
||||
yscale;
|
||||
pos=0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
a = pos*(FONTWIDTH+FONTWHITESPACE);
|
||||
for(i=0;i<character[cc][0]*4;i+=4)
|
||||
{
|
||||
|
|
@ -268,9 +268,9 @@ static void svg_drawgrid()
|
|||
double x,y;
|
||||
double delta,tmp;
|
||||
if(!draw_grid) return;
|
||||
delta=cadgrid* mooz;
|
||||
delta=cadgrid* xctx.mooz;
|
||||
while(delta<CADGRIDTHRESHOLD) delta*=CADGRIDMULTIPLY; /* <-- to be improved,but works */
|
||||
x = xorigin* mooz;y = yorigin* mooz;
|
||||
x = xctx.xorigin* xctx.mooz;y = xctx.yorigin* xctx.mooz;
|
||||
set_svg_colors(GRIDLAYER);
|
||||
if(y>areay1 && y<areay2)
|
||||
{
|
||||
|
|
@ -281,8 +281,8 @@ static void svg_drawgrid()
|
|||
svg_xdrawline(GRIDLAYER,(int)x,areay1+1, (int)x, areay2-1, 0);
|
||||
}
|
||||
set_svg_colors(GRIDLAYER);
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-yorigin* mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xorigin* mooz,delta);x<areax2;x+=delta)
|
||||
tmp = floor((areay1+1)/delta)*delta-fmod(-xctx.yorigin* xctx.mooz,delta);
|
||||
for(x=floor((areax1+1)/delta)*delta-fmod(-xctx.xorigin* xctx.mooz,delta);x<areax2;x+=delta)
|
||||
{
|
||||
for(y=tmp;y<areay2;y+=delta)
|
||||
{
|
||||
|
|
@ -293,61 +293,61 @@ static void svg_drawgrid()
|
|||
|
||||
|
||||
|
||||
static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
||||
double xoffset, double yoffset)
|
||||
static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
||||
double xoffset, double yoffset)
|
||||
/* draws current layer only, should be called within */
|
||||
{ /* a "for(i=0;i<cadlayers;i++)" loop */
|
||||
int j;
|
||||
double x0,y0,x1,y1,x2,y2;
|
||||
int flip, textlayer;
|
||||
Line line;
|
||||
Box box;
|
||||
Text text;
|
||||
xLine line;
|
||||
xRect box;
|
||||
xText text;
|
||||
xArc arc;
|
||||
xPolygon polygon;
|
||||
xPoly polygon;
|
||||
|
||||
if(inst_ptr[n].ptr == -1) return;
|
||||
if(xctx.inst[n].ptr == -1) return;
|
||||
if( (layer != PINLAYER && !enable_layer[layer]) ) return;
|
||||
if(layer==0)
|
||||
{
|
||||
x1=X_TO_SVG(inst_ptr[n].x1);
|
||||
x2=X_TO_SVG(inst_ptr[n].x2);
|
||||
y1=Y_TO_SVG(inst_ptr[n].y1);
|
||||
y2=Y_TO_SVG(inst_ptr[n].y2);
|
||||
x1=X_TO_SVG(xctx.inst[n].x1);
|
||||
x2=X_TO_SVG(xctx.inst[n].x2);
|
||||
y1=Y_TO_SVG(xctx.inst[n].y1);
|
||||
y2=Y_TO_SVG(xctx.inst[n].y2);
|
||||
if(OUTSIDE(x1,y1,x2,y2,areax1,areay1,areax2,areay2))
|
||||
{
|
||||
inst_ptr[n].flags|=1;
|
||||
xctx.inst[n].flags|=1;
|
||||
return;
|
||||
}
|
||||
else inst_ptr[n].flags&=~1;
|
||||
else xctx.inst[n].flags&=~1;
|
||||
|
||||
/* following code handles different text color for labels/pins 06112002 */
|
||||
|
||||
}
|
||||
else if(inst_ptr[n].flags&1)
|
||||
else if(xctx.inst[n].flags&1)
|
||||
{
|
||||
dbg(1, "draw_symbol(): skippinginst %d\n", n);
|
||||
return;
|
||||
}
|
||||
|
||||
flip = inst_ptr[n].flip;
|
||||
flip = xctx.inst[n].flip;
|
||||
if(tmp_flip) flip = !flip;
|
||||
rot = (inst_ptr[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=inst_ptr[n].x0 + xoffset;
|
||||
y0=inst_ptr[n].y0 + yoffset;
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->lines[layer];j++)
|
||||
rot = (xctx.inst[n].rot + rot ) & 0x3;
|
||||
|
||||
x0=xctx.inst[n].x0 + xoffset;
|
||||
y0=xctx.inst[n].y0 + yoffset;
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->lines[layer];j++)
|
||||
{
|
||||
line = ((inst_ptr[n].ptr+instdef)->lineptr[layer])[j];
|
||||
line = ((xctx.inst[n].ptr+ xctx.sym)->line[layer])[j];
|
||||
ROTATION(0.0,0.0,line.x1,line.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,line.x2,line.y2,x2,y2);
|
||||
ORDER(x1,y1,x2,y2);
|
||||
svg_drawline(layer, x0+x1, y0+y1, x0+x2, y0+y2, line.dash);
|
||||
}
|
||||
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->polygons[layer];j++) /* 20171115 */
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->polygons[layer];j++)
|
||||
{
|
||||
polygon = ((inst_ptr[n].ptr+instdef)->polygonptr[layer])[j];
|
||||
polygon = ((xctx.inst[n].ptr+ xctx.sym)->poly[layer])[j];
|
||||
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
|
||||
int k;
|
||||
double *x = my_malloc(417, sizeof(double) * polygon.points);
|
||||
|
|
@ -362,10 +362,10 @@ static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
my_free(962, &y);
|
||||
}
|
||||
}
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->arcs[layer];j++)
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->arcs[layer];j++)
|
||||
{
|
||||
double angle;
|
||||
arc = ((inst_ptr[n].ptr+instdef)->arcptr[layer])[j];
|
||||
arc = ((xctx.inst[n].ptr+ xctx.sym)->arc[layer])[j];
|
||||
if(flip) {
|
||||
angle = 270.*rot+180.-arc.b-arc.a;
|
||||
} else {
|
||||
|
|
@ -377,38 +377,38 @@ static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot,
|
|||
svg_drawarc(layer, arc.fill, x0+x1, y0+y1, arc.r, angle, arc.b, arc.dash);
|
||||
}
|
||||
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (inst_ptr[n].ptr+instdef)->rects[layer];j++)
|
||||
if( (layer != PINLAYER || enable_layer[layer]) ) for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->rects[layer];j++)
|
||||
{
|
||||
box = ((inst_ptr[n].ptr+instdef)->boxptr[layer])[j];
|
||||
box = ((xctx.inst[n].ptr+ xctx.sym)->rect[layer])[j];
|
||||
ROTATION(0.0,0.0,box.x1,box.y1,x1,y1);
|
||||
ROTATION(0.0,0.0,box.x2,box.y2,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
RECTORDER(x1,y1,x2,y2);
|
||||
svg_filledrect(layer, x0+x1, y0+y1, x0+x2, y0+y2, box.dash);
|
||||
}
|
||||
if( (layer==TEXTWIRELAYER && !(inst_ptr[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (inst_ptr[n].flags&2) ) )
|
||||
if( (layer==TEXTWIRELAYER && !(xctx.inst[n].flags&2) ) ||
|
||||
(sym_txt && (layer==TEXTLAYER) && (xctx.inst[n].flags&2) ) )
|
||||
{
|
||||
const char *txtptr;
|
||||
for(j=0;j< (inst_ptr[n].ptr+instdef)->texts;j++)
|
||||
for(j=0;j< (xctx.inst[n].ptr+ xctx.sym)->texts;j++)
|
||||
{
|
||||
text = (inst_ptr[n].ptr+instdef)->txtptr[j];
|
||||
/* if(text.xscale*FONTWIDTH* mooz<1) continue; */
|
||||
text = (xctx.inst[n].ptr+ xctx.sym)->text[j];
|
||||
/* if(text.xscale*FONTWIDTH* xctx.mooz<1) continue; */
|
||||
txtptr= translate(n, text.txt_ptr);
|
||||
ROTATION(0.0,0.0,text.x0,text.y0,x1,y1);
|
||||
textlayer = layer;
|
||||
if( !(layer == PINLAYER && (inst_ptr[n].flags & 4))) {
|
||||
textlayer = (inst_ptr[n].ptr+instdef)->txtptr[j].layer;
|
||||
if( !(layer == PINLAYER && (xctx.inst[n].flags & 4))) {
|
||||
textlayer = (xctx.inst[n].ptr+ xctx.sym)->text[j].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = layer;
|
||||
}
|
||||
if((layer == PINLAYER && inst_ptr[n].flags & 4) || enable_layer[textlayer]) {
|
||||
if((layer == PINLAYER && xctx.inst[n].flags & 4) || enable_layer[textlayer]) {
|
||||
svg_draw_string(textlayer, txtptr,
|
||||
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
|
||||
flip^text.flip, text.hcenter, text.vcenter,
|
||||
x0+x1, y0+y1, text.xscale, text.yscale);
|
||||
flip^text.flip, text.hcenter, text.vcenter,
|
||||
x0+x1, y0+y1, text.xscale, text.yscale);
|
||||
}
|
||||
}
|
||||
}
|
||||
Tcl_SetResult(interp,"",TCL_STATIC); /*26102003 */
|
||||
Tcl_SetResult(interp,"",TCL_STATIC);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ static void fill_svg_colors()
|
|||
char s[200]; /* overflow safe 20161122 */
|
||||
unsigned int i,c;
|
||||
if(debug_var>=1) {
|
||||
tcleval( "puts $svg_colors");
|
||||
tcleval( "puts $svg_colors");
|
||||
}
|
||||
for(i=0;i<cadlayers;i++) {
|
||||
if(color_ps) {
|
||||
|
|
@ -438,20 +438,20 @@ static void fill_svg_colors()
|
|||
svg_colors[i].blue = 0;
|
||||
}
|
||||
if(debug_var>=1) {
|
||||
fprintf(errfp, "svg_colors: %d %d %d\n", svg_colors[i].red, svg_colors[i].green, svg_colors[i].blue);
|
||||
fprintf(errfp, "svg_colors: %d %d %d\n", svg_colors[i].red, svg_colors[i].green, svg_colors[i].blue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void svg_draw(void)
|
||||
{
|
||||
double dx, dy;
|
||||
int c,i, textlayer;
|
||||
int c,i, textlayer;
|
||||
int filledrect;
|
||||
int old_grid;
|
||||
int modified_save; /* 20161121 */
|
||||
int modified_save;
|
||||
char *tmpstring=NULL;
|
||||
const char *r;
|
||||
|
||||
|
|
@ -470,8 +470,8 @@ void svg_draw(void)
|
|||
svg_colors=my_calloc(419, cadlayers, sizeof(Svg_color));
|
||||
if(svg_colors==NULL){
|
||||
fprintf(errfp, "svg_draw(): calloc error\n");tcleval( "exit");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fill_svg_colors();
|
||||
|
||||
old_grid=draw_grid;
|
||||
|
|
@ -483,10 +483,10 @@ void svg_draw(void)
|
|||
|
||||
|
||||
modified_save=modified;
|
||||
push_undo(); /* 20161121 */
|
||||
push_undo();
|
||||
trim_wires(); /* 20161121 add connection boxes on wires but undo at end */
|
||||
|
||||
|
||||
|
||||
|
||||
if(plotfile[0]) fd=fopen(plotfile, "w");
|
||||
else fd=fopen("plot.svg", "w");
|
||||
my_strncpy(plotfile,"", S(plotfile));
|
||||
|
|
@ -496,7 +496,7 @@ void svg_draw(void)
|
|||
|
||||
fprintf(fd, "<style type=\"text/css\">\n"); /* use css stylesheet 20121119 */
|
||||
for(i=0;i<cadlayers;i++){
|
||||
|
||||
|
||||
filledrect=0;
|
||||
if( (i==PINLAYER || i==WIRELAYER || i==4) && fill) {
|
||||
filledrect=1;
|
||||
|
|
@ -528,44 +528,46 @@ void svg_draw(void)
|
|||
}
|
||||
svg_drawgrid();
|
||||
set_svg_colors(TEXTLAYER);
|
||||
for(i=0;i<lasttext;i++)
|
||||
for(i=0;i<xctx.texts;i++)
|
||||
{
|
||||
textlayer = textelement[i].layer; /*20171206 */
|
||||
textlayer = xctx.text[i].layer;
|
||||
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
|
||||
svg_draw_string(textlayer, textelement[i].txt_ptr,
|
||||
textelement[i].rot, textelement[i].flip, textelement[i].hcenter, textelement[i].vcenter,
|
||||
textelement[i].x0,textelement[i].y0,
|
||||
textelement[i].xscale, textelement[i].yscale);
|
||||
svg_draw_string(textlayer, xctx.text[i].txt_ptr,
|
||||
xctx.text[i].rot, xctx.text[i].flip, xctx.text[i].hcenter, xctx.text[i].vcenter,
|
||||
xctx.text[i].x0,xctx.text[i].y0,
|
||||
xctx.text[i].xscale, xctx.text[i].yscale);
|
||||
}
|
||||
|
||||
for(c=0;c<cadlayers;c++)
|
||||
{
|
||||
set_svg_colors(c);
|
||||
for(i=0;i<lastline[c];i++)
|
||||
svg_drawline(c, line[c][i].x1, line[c][i].y1, line[c][i].x2, line[c][i].y2, line[c][i].dash);
|
||||
for(i=0;i<lastrect[c];i++)
|
||||
for(i=0;i<xctx.lines[c];i++)
|
||||
svg_drawline(c, xctx.line[c][i].x1, xctx.line[c][i].y1,
|
||||
xctx.line[c][i].x2, xctx.line[c][i].y2, xctx.line[c][i].dash);
|
||||
for(i=0;i<xctx.rects[c];i++)
|
||||
{
|
||||
svg_filledrect(c, rect[c][i].x1, rect[c][i].y1, rect[c][i].x2, rect[c][i].y2, rect[c][i].dash);
|
||||
svg_filledrect(c, xctx.rect[c][i].x1, xctx.rect[c][i].y1,
|
||||
xctx.rect[c][i].x2, xctx.rect[c][i].y2, xctx.rect[c][i].dash);
|
||||
}
|
||||
for(i=0;i<lastarc[c];i++)
|
||||
for(i=0;i<xctx.arcs[c];i++)
|
||||
{
|
||||
svg_drawarc(c, arc[c][i].fill, arc[c][i].x, arc[c][i].y, arc[c][i].r,
|
||||
arc[c][i].a, arc[c][i].b, arc[c][i].dash);
|
||||
svg_drawarc(c, xctx.arc[c][i].fill, xctx.arc[c][i].x, xctx.arc[c][i].y, xctx.arc[c][i].r,
|
||||
xctx.arc[c][i].a, xctx.arc[c][i].b, xctx.arc[c][i].dash);
|
||||
}
|
||||
for(i=0;i<lastpolygon[c];i++) {
|
||||
svg_drawpolygon(c, NOW, polygon[c][i].x, polygon[c][i].y, polygon[c][i].points,
|
||||
polygon[c][i].fill, polygon[c][i].dash);
|
||||
for(i=0;i<xctx.polygons[c];i++) {
|
||||
svg_drawpolygon(c, NOW, xctx.poly[c][i].x, xctx.poly[c][i].y, xctx.poly[c][i].points,
|
||||
xctx.poly[c][i].fill, xctx.poly[c][i].dash);
|
||||
}
|
||||
for(i=0;i<lastinst;i++) {
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
svg_draw_symbol(i,c,0,0,0.0,0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
set_svg_colors(WIRELAYER);
|
||||
for(i=0;i<lastwire;i++)
|
||||
for(i=0;i<xctx.wires;i++)
|
||||
{
|
||||
svg_drawline(WIRELAYER, wire[i].x1,wire[i].y1,wire[i].x2,wire[i].y2, 0);
|
||||
svg_drawline(WIRELAYER, xctx.wire[i].x1,xctx.wire[i].y1,xctx.wire[i].x2,xctx.wire[i].y2, 0);
|
||||
}
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
|
|
@ -579,11 +581,11 @@ void svg_draw(void)
|
|||
y2 = Y_TO_XSCHEM(areay2);
|
||||
for(init_wire_iterator(x1, y1, x2, y2); ( wireptr = wire_iterator_next() ) ;) {
|
||||
i = wireptr->n;
|
||||
if( wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, wire[i].x1, wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
if( xctx.wire[i].end1 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, xctx.wire[i].x1, xctx.wire[i].y1, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
if( wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, wire[i].x2, wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
if( xctx.wire[i].end2 >1 ) { /* 20150331 draw_dots */
|
||||
svg_drawcircle(WIRELAYER, 1, xctx.wire[i].x2, xctx.wire[i].y2, cadhalfdotsize, 0, 360);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -594,8 +596,8 @@ void svg_draw(void)
|
|||
draw_grid=old_grid;
|
||||
my_free(964, &svg_colors);
|
||||
|
||||
pop_undo(0); /* 20161121 */
|
||||
modified=modified_save; /* 20161121 */
|
||||
pop_undo(0);
|
||||
modified=modified_save;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: tedax_netlist.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -32,74 +32,74 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
char cellname[PATH_MAX]; /* 20081211 overflow safe 20161122 */
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(schematic[currentsch]);
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
statusmsg("",2); /* clear infowindow */
|
||||
record_global_node(2, NULL, NULL); /* delete list of global nodes */
|
||||
netlist_count=0;
|
||||
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(schematic[currentsch]), getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]), getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.tdx", skip_dir(schematic[currentsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.tdx", skip_dir(xctx.sch[xctx.currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL){
|
||||
if(fd==NULL){
|
||||
dbg(0, "global_tedax_netlist(): problems opening netlist file\n");
|
||||
return;
|
||||
}
|
||||
dbg(1, "global_tedax_netlist(): opening %s for writing\n",netl_filename);
|
||||
fprintf(fd,"tEDAx v1\nbegin netlist v1 %s\n", skip_dir( schematic[currentsch]) );
|
||||
fprintf(fd,"tEDAx v1\nbegin netlist v1 %s\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
|
||||
tedax_netlist(fd, 0);
|
||||
|
||||
/* 20100217 */
|
||||
|
||||
/*fprintf(fd,"**** begin user architecture code\n"); */
|
||||
/*netlist_count++; */
|
||||
/*if(schprop && schprop[0]) fprintf(fd, "%s\n", schprop); */
|
||||
/*if(xctx.schprop && xctx.schprop[0]) fprintf(fd, "%s\n", xctx.schprop); */
|
||||
/*fprintf(fd,"**** end user architecture code\n"); */
|
||||
/* /20100217 */
|
||||
|
||||
fprintf(fd, "end netlist\n");
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(149, lastinst, sizeof(unsigned int));
|
||||
for(i=0;i<lastinst;i++) stored_flags[i] = inst_ptr[i].flags & 4;
|
||||
stored_flags = my_calloc(149, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
|
||||
if(0) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
|
||||
currentsch++;
|
||||
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",lastinstdef);
|
||||
for(i=0;i<lastinstdef;i++)
|
||||
xctx.currsch++;
|
||||
dbg(2, "global_tedax_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue; /* 20070726 */
|
||||
if(!instdef[i].type) continue;
|
||||
if(strcmp(instdef[i].type,"subcircuit")==0 && check_lib(instdef[i].name)) /* 20150409 */
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name))
|
||||
{
|
||||
tedax_block_netlist(fd, i); /* 20081205 */
|
||||
tedax_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
/*clear_drawing(); */
|
||||
my_strncpy(schematic[currentsch] , "", S(schematic[currentsch]));
|
||||
currentsch--;
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<lastinst; i++) inst_ptr[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
|
|
@ -124,53 +124,53 @@ void global_tedax_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
|
||||
void tedax_block_netlist(FILE *fd, int i) /*20081223 */
|
||||
void tedax_block_netlist(FILE *fd, int i)
|
||||
{
|
||||
int j;
|
||||
int tedax_stop=0; /* 20111113 */
|
||||
int tedax_stop=0;
|
||||
char filename[PATH_MAX];
|
||||
char netl_filename[PATH_MAX];
|
||||
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081202 */
|
||||
char cellname[PATH_MAX]; /* 20081202 */
|
||||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
int mult;
|
||||
char *extra=NULL;
|
||||
if(!strcmp( get_tok_value(instdef[i].prop_ptr,"tedax_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"tedax_stop",0),"true") )
|
||||
tedax_stop=1;
|
||||
else
|
||||
tedax_stop=0;
|
||||
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n\n",
|
||||
instdef[i].name,instdef[i].rects[PINLAYER] );
|
||||
fprintf(fd, ".subckt %s ",skip_dir(instdef[i].name));
|
||||
for(j=0;j<instdef[i].rects[PINLAYER];j++)
|
||||
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
fprintf(fd, ".subckt %s ",skip_dir(xctx.sym[i].name));
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
str_tmp=
|
||||
expandlabel(get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"name",0), &mult);
|
||||
expandlabel(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0), &mult);
|
||||
if(str_tmp)
|
||||
fprintf(fd,"%s ",str_tmp);
|
||||
else
|
||||
else
|
||||
fprintf(fd,"<NULL> ");
|
||||
}
|
||||
my_strdup(420, &extra, get_tok_value(instdef[i].prop_ptr,"extra",0) ); /* 20081206 */
|
||||
my_strdup(420, &extra, get_tok_value(xctx.sym[i].prop_ptr,"extra",0) );
|
||||
fprintf(fd, "%s ", extra ? extra : "" );
|
||||
/* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */
|
||||
fprintf(fd, "%s", get_sym_template(instdef[i].templ, extra)); /* 20150409 */
|
||||
fprintf(fd, "%s", get_sym_template(xctx.sym[i].templ, extra));
|
||||
my_free(966, &extra);
|
||||
fprintf(fd, "\n");
|
||||
/*clear_drawing(); */
|
||||
if((str_tmp = get_tok_value(instdef[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
load_schematic(1, add_ext(abs_sym_path(instdef[i].name, ""), ".sch"), 0); /* 20190518 */
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0);
|
||||
}
|
||||
tedax_netlist(fd, tedax_stop); /* 20111113 added tedax_stop */
|
||||
netlist_count++;
|
||||
fprintf(fd,"**** begin user architecture code\n");
|
||||
if(schprop && schprop[0]) fprintf(fd, "%s\n", schprop);
|
||||
if(xctx.schprop && xctx.schprop[0]) fprintf(fd, "%s\n", xctx.schprop);
|
||||
fprintf(fd,"**** end user architecture code\n");
|
||||
fprintf(fd, ".ends\n\n");
|
||||
if(split_files) { /* 20081204 */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -182,36 +182,36 @@ void tedax_netlist(FILE *fd, int tedax_stop )
|
|||
{
|
||||
int i;
|
||||
char *type=NULL;
|
||||
|
||||
|
||||
prepared_netlist_structs = 0;
|
||||
prepare_netlist_structs(1);
|
||||
/* set_modify(1); */ /* 20160302 prepare_netlist_structs could change schematic (wire node naming for example) */
|
||||
traverse_node_hash(); /* print all warnings about unconnected floatings etc */
|
||||
if(!tedax_stop) {
|
||||
for(i=0;i<lastinst;i++) /* print first ipin/opin defs ... */
|
||||
for(i=0;i<xctx.instances;i++) /* print first ipin/opin defs ... */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(421, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
my_strdup(421, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && IS_PIN(type) ) {
|
||||
print_tedax_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
for(i=0;i<lastinst;i++) /* ... then print other lines */
|
||||
for(i=0;i<xctx.instances;i++) /* ... then print other lines */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "tedax_ignore",0 ), "true") ) {/*20070726 */
|
||||
continue; /*20070726 */
|
||||
} /*20070726 */
|
||||
my_strdup(423, &type,(inst_ptr[i].ptr+instdef)->type); /* 20150409 */
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"tedax_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "tedax_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(423, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && !IS_PIN(type) ) {
|
||||
if(!strcmp(type,"netlist_commands") && netlist_count==0) continue; /* already done in global_tedax_netlist */
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(inst_ptr[i].prop_ptr, "only_toplevel", 0), "true")) continue; /* 20160418 */
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx.inst[i].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
print_tedax_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
}
|
||||
|
|
|
|||
810
src/token.c
810
src/token.c
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
|||
/* File: verilog_netlist.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -40,25 +40,25 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
char *subckt_name;
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(schematic[currentsch]);
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
statusmsg("",2); /* clear infowindow */
|
||||
netlist_count=0;
|
||||
netlist_count=0;
|
||||
/* top sch properties used for library use declarations and type definitions */
|
||||
/* to be printed before any entity declarations */
|
||||
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(schematic[currentsch]),getpid());
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]),getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(schematic[currentsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx.sch[xctx.currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL){
|
||||
if(fd==NULL){
|
||||
dbg(0, "global_verilog_netlist(): problems opening netlist file\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -67,17 +67,17 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
|
||||
/* print verilog timescale 10102004 */
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(105, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(105, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
|
||||
{
|
||||
str_tmp = get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr ,"verilog_format",0);
|
||||
str_tmp = get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr ,"verilog_format",0);
|
||||
my_strdup(106, &tmp_string, str_tmp);
|
||||
fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "(NULL)");
|
||||
}
|
||||
|
|
@ -86,68 +86,68 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level entity\n");
|
||||
fprintf(fd,"module %s (\n", skip_dir( schematic[currentsch]) );
|
||||
fprintf(fd,"module %s (\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
/* flush data structures (remove unused symbols) */
|
||||
unselect_all();
|
||||
remove_symbols(); /* removed 25122002, readded 04112003 */
|
||||
|
||||
dbg(1, "global_verilog_netlist(): schematic[currentsch]=%s\n", schematic[currentsch]);
|
||||
|
||||
load_schematic(1,schematic[currentsch] ,0); /* 20180927 */
|
||||
dbg(1, "global_verilog_netlist(): xctx.sch[xctx.currsch]=%s\n", xctx.sch[xctx.currsch]);
|
||||
|
||||
load_schematic(1,xctx.sch[xctx.currsch] ,0);
|
||||
|
||||
|
||||
/* print top subckt port directions */
|
||||
dbg(1, "global_verilog_netlist(): printing top level out pins\n");
|
||||
tmp=0;
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(546, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(546, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)");
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level inout pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(547, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(547, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)");
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level input pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(548, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(548, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " %s", str_tmp ? str_tmp : "<NULL>");
|
||||
}
|
||||
}
|
||||
|
|
@ -155,11 +155,11 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
fprintf(fd,"\n);\n");
|
||||
|
||||
/* 20071006 print top level params if defined in symbol */
|
||||
str_tmp = add_ext(schematic[currentsch], ".sym");
|
||||
str_tmp = add_ext(xctx.sch[xctx.currsch], ".sym");
|
||||
if(!stat(str_tmp, &buf)) {
|
||||
load_sym_def(str_tmp, NULL );
|
||||
print_verilog_param(fd,lastinstdef-1); /* added print top level params */
|
||||
remove_symbol(lastinstdef - 1);
|
||||
print_verilog_param(fd,xctx.symbols-1); /* added print top level params */
|
||||
remove_symbol(xctx.symbols - 1);
|
||||
}
|
||||
/* 20071006 end */
|
||||
|
||||
|
|
@ -167,69 +167,69 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
|
||||
/* print top subckt port types */
|
||||
dbg(1, "global_verilog_netlist(): printing top level out pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(549, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(549, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
my_strdup(550, &port_value,get_tok_value(inst_ptr[i].prop_ptr,"value",0));
|
||||
my_strdup(551, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(550, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",0));
|
||||
my_strdup(551, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(552, &sig_type,"wire"); /* 20070720 changed reg to wire */
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "(NULL)");
|
||||
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
|
||||
/* 20140410 */
|
||||
|
||||
if(port_value && port_value[0]) fprintf(fd," = %s", port_value);
|
||||
fprintf(fd, ";\n");
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level inout pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(553, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(553, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
my_strdup(554, &port_value,get_tok_value(inst_ptr[i].prop_ptr,"value",0));
|
||||
my_strdup(555, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(554, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",0));
|
||||
my_strdup(555, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(556, &sig_type,"wire");
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "(NULL)");
|
||||
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
|
||||
/* 20140410 */
|
||||
|
||||
if(port_value && port_value[0]) fprintf(fd," = %s", port_value);
|
||||
fprintf(fd, ";\n");
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_verilog_netlist(): printing top level input pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(557, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(557, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
my_strdup(558, &port_value,get_tok_value(inst_ptr[i].prop_ptr,"value",0));
|
||||
my_strdup(559, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"verilog_type",0));
|
||||
my_strdup(558, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",0));
|
||||
my_strdup(559, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"verilog_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(560, &sig_type,"wire");
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
fprintf(fd, " input %s ;\n", str_tmp ? str_tmp : "<NULL>");
|
||||
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "<NULL>");
|
||||
/* 20140410 */
|
||||
|
||||
if(port_value && port_value[0]) fprintf(fd," = %s", port_value);
|
||||
fprintf(fd, ";\n");
|
||||
}
|
||||
|
|
@ -239,27 +239,27 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
verilog_netlist(fd, 0);
|
||||
netlist_count++;
|
||||
fprintf(fd,"---- begin user architecture code\n");
|
||||
/* 20180124 */
|
||||
for(i=0;i<lastinst;i++) {
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(561, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(561, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(inst_ptr[i].prop_ptr,"value",2)); /* 20180124 */
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[i].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(schverilogprop && schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", schverilogprop);
|
||||
if(xctx.schverilogprop && xctx.schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx.schverilogprop);
|
||||
}
|
||||
fprintf(fd,"---- end user architecture code\n");
|
||||
fprintf(fd, "endmodule\n");
|
||||
|
||||
if(split_files) { /* 20081205 */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -267,52 +267,52 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(150, lastinst, sizeof(unsigned int));
|
||||
for(i=0;i<lastinst;i++) stored_flags[i] = inst_ptr[i].flags & 4;
|
||||
stored_flags = my_calloc(150, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
|
||||
if(global)
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
|
||||
currentsch++;
|
||||
dbg(2, "global_verilog_netlist(): last defined symbol=%d\n",lastinstdef);
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
|
||||
xctx.currsch++;
|
||||
dbg(2, "global_verilog_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<lastinstdef;i++)
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20070726 */
|
||||
if(!instdef[i].type) continue;
|
||||
if(strcmp(instdef[i].type,"subcircuit")==0 && check_lib(instdef[i].name)) {
|
||||
/* instdef can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(328, &subckt_name, get_cell(instdef[i].name, 0));
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name)) {
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(328, &subckt_name, get_cell(xctx.sym[i].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if( split_files && strcmp(get_tok_value(instdef[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
vhdl_block_netlist(fd, i); /* 20081209 */
|
||||
else if(split_files && strcmp(get_tok_value(instdef[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
spice_block_netlist(fd, i); /* 20081209 */
|
||||
else
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"verilog_primitive",0), "true"))
|
||||
verilog_block_netlist(fd, i); /* 20081205 */
|
||||
if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_netlist",0),"true")==0 )
|
||||
vhdl_block_netlist(fd, i);
|
||||
else if(split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
spice_block_netlist(fd, i);
|
||||
else
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_primitive",0), "true"))
|
||||
verilog_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
my_free(1073, &subckt_name);
|
||||
my_strncpy(schematic[currentsch] , "", S(schematic[currentsch]));
|
||||
currentsch--;
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1,schematic[currentsch], 0);
|
||||
load_schematic(1,xctx.sch[xctx.currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<lastinst; i++) inst_ptr[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
|
|
@ -339,7 +339,7 @@ void global_verilog_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
|
||||
void verilog_block_netlist(FILE *fd, int i) /*20081205 */
|
||||
void verilog_block_netlist(FILE *fd, int i)
|
||||
{
|
||||
int j, l, tmp;
|
||||
int verilog_stop=0;
|
||||
|
|
@ -350,75 +350,75 @@ void verilog_block_netlist(FILE *fd, int i) /*20081205 */
|
|||
char *tmp_string = NULL;
|
||||
char filename[PATH_MAX];
|
||||
char netl_filename[PATH_MAX];
|
||||
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081202 */
|
||||
char cellname[PATH_MAX]; /* 20081202 */
|
||||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
|
||||
if(!strcmp( get_tok_value(instdef[i].prop_ptr,"verilog_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"verilog_stop",0),"true") )
|
||||
verilog_stop=1;
|
||||
else
|
||||
verilog_stop=0;
|
||||
|
||||
|
||||
if(split_files) { /* 20081203 */
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(instdef[i].name), getpid());
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sym[i].name), getpid());
|
||||
dbg(1, "global_vhdl_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(instdef[i].name) );
|
||||
my_snprintf(cellname, S(cellname), "%s.v", skip_dir(xctx.sym[i].name) );
|
||||
|
||||
}
|
||||
|
||||
dbg(1, "verilog_block_netlist(): expanding %s\n", instdef[i].name);
|
||||
fprintf(fd, "\n// expanding symbol: %s # of pins=%d\n\n",
|
||||
instdef[i].name,instdef[i].rects[PINLAYER] );
|
||||
dbg(1, "verilog_block_netlist(): expanding %s\n", xctx.sym[i].name);
|
||||
fprintf(fd, "\n// expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
|
||||
|
||||
if((str_tmp = get_tok_value(instdef[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
verilog_stop? load_schematic(0, add_ext(abs_sym_path(instdef[i].name, ""), ".sch"), 0) : /* 20190518 */
|
||||
load_schematic(1, add_ext(abs_sym_path(instdef[i].name, ""), ".sch"), 0);
|
||||
verilog_stop? load_schematic(0, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0) :
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0);
|
||||
}
|
||||
|
||||
|
||||
/* print verilog timescale and preprocessor directives 10102004 */
|
||||
|
||||
for(j=0;j<lastinst;j++)
|
||||
for(j=0;j<xctx.instances;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[j].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(inst_ptr[j].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[j].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[j].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[j].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[j].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(544, &type,(inst_ptr[j].ptr+instdef)->type);
|
||||
my_strdup(544, &type,(xctx.inst[j].ptr+ xctx.sym)->type);
|
||||
if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
|
||||
{
|
||||
str_tmp = get_tok_value( (inst_ptr[j].ptr+instdef)->prop_ptr ,"verilog_format",0);
|
||||
str_tmp = get_tok_value( (xctx.inst[j].ptr+ xctx.sym)->prop_ptr ,"verilog_format",0);
|
||||
my_strdup(545, &tmp_string, str_tmp);
|
||||
fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "(NULL)");
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(fd, "module %s (\n", skip_dir(instdef[i].name));
|
||||
/*print_generic(fd, "entity", i); */ /* 02112003 */
|
||||
fprintf(fd, "module %s (\n", skip_dir(xctx.sym[i].name));
|
||||
/*print_generic(fd, "entity", i); */
|
||||
|
||||
dbg(1, "verilog_block_netlist(): entity ports\n");
|
||||
|
||||
/* print ports directions */
|
||||
tmp=0;
|
||||
for(j=0;j<instdef[i].rects[PINLAYER];j++)
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
if(strcmp(get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
str_tmp = get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
if(strcmp(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
str_tmp = get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(tmp) fprintf(fd, " ,\n");
|
||||
tmp++;
|
||||
fprintf(fd," %s", str_tmp ? str_tmp : "<NULL>");
|
||||
}
|
||||
}
|
||||
fprintf(fd, "\n);\n");
|
||||
|
||||
/*16112003 */
|
||||
|
||||
dbg(1, "verilog_block_netlist(): entity generics\n");
|
||||
/* print module default parameters */
|
||||
print_verilog_param(fd,i);
|
||||
|
|
@ -428,25 +428,25 @@ void verilog_block_netlist(FILE *fd, int i) /*20081205 */
|
|||
|
||||
/* print port types */
|
||||
tmp=0;
|
||||
for(j=0;j<instdef[i].rects[PINLAYER];j++)
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
if(strcmp(get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
|
||||
my_strdup(564, &sig_type,get_tok_value(
|
||||
instdef[i].boxptr[PINLAYER][j].prop_ptr,"verilog_type",0));
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0));
|
||||
my_strdup(565, &port_value, get_tok_value(
|
||||
instdef[i].boxptr[PINLAYER][j].prop_ptr,"value",2) );
|
||||
my_strdup(566, &dir_tmp, get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"value",2) );
|
||||
my_strdup(566, &dir_tmp, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
if(strcmp(dir_tmp,"in")){
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(567, &sig_type,"wire"); /* 20070720 changed reg to wire */
|
||||
} else {
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(568, &sig_type,"wire");
|
||||
}
|
||||
str_tmp = get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"name",0);
|
||||
fprintf(fd," %s %s ;\n",
|
||||
str_tmp = get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
fprintf(fd," %s %s ;\n",
|
||||
strcmp(dir_tmp,"in")? ( strcmp(dir_tmp,"out")? "inout" :"output" ) : "input",
|
||||
str_tmp ? str_tmp : "<NULL>");
|
||||
fprintf(fd," %s %s",
|
||||
sig_type,
|
||||
fprintf(fd," %s %s",
|
||||
sig_type,
|
||||
str_tmp ? str_tmp : "<NULL>");
|
||||
if(port_value &&port_value[0])
|
||||
fprintf(fd," = %s", port_value);
|
||||
|
|
@ -454,31 +454,31 @@ void verilog_block_netlist(FILE *fd, int i) /*20081205 */
|
|||
}
|
||||
}
|
||||
|
||||
dbg(1, "verilog_block_netlist(): netlisting %s\n", skip_dir( schematic[currentsch]));
|
||||
dbg(1, "verilog_block_netlist(): netlisting %s\n", skip_dir( xctx.sch[xctx.currsch]));
|
||||
verilog_netlist(fd, verilog_stop);
|
||||
netlist_count++;
|
||||
fprintf(fd,"---- begin user architecture code\n");
|
||||
for(l=0;l<lastinst;l++) {
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
for(l=0;l<xctx.instances;l++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(inst_ptr[l].prop_ptr, "only_toplevel", 0), "true")) continue; /* 20160418 */
|
||||
!strcmp(get_tok_value(xctx.inst[l].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
|
||||
my_strdup(569, &type,(inst_ptr[l].ptr+instdef)->type);
|
||||
my_strdup(569, &type,(xctx.inst[l].ptr+ xctx.sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(inst_ptr[l].prop_ptr,"value",2)); /* 20180124 */
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[l].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
if(schverilogprop && schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", schverilogprop);
|
||||
if(xctx.schverilogprop && xctx.schverilogprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx.schverilogprop);
|
||||
}
|
||||
fprintf(fd,"---- end user architecture code\n");
|
||||
fprintf(fd, "endmodule\n");
|
||||
if(split_files) { /* 20081204 */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -511,26 +511,26 @@ void verilog_netlist(FILE *fd , int verilog_stop)
|
|||
|
||||
if(!verilog_stop)
|
||||
{
|
||||
for(i=0;i<lastinst;i++) /* ... print all element except ipin opin labels use package */
|
||||
for(i=0;i<xctx.instances;i++) /* ... print all element except ipin opin labels use package */
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "verilog_ignore",0 ), "true") ) { /*20070726 */
|
||||
continue; /*20070726 */
|
||||
} /*20070726 */
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"verilog_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "verilog_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dbg(2, "verilog_netlist(): into the netlisting loop\n");
|
||||
my_strdup(570, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
if( type &&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"netlist_commands")&& /* 20180124 */
|
||||
my_strdup(570, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type &&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"netlist_commands")&&
|
||||
strcmp(type,"timescale")&&
|
||||
strcmp(type,"verilog_preprocessor")
|
||||
))
|
||||
{
|
||||
if(lastselected)
|
||||
if(lastselected)
|
||||
{
|
||||
if(inst_ptr[i].sel==SELECTED) print_verilog_element(fd, i) ;
|
||||
if(xctx.inst[i].sel==SELECTED) print_verilog_element(fd, i) ;
|
||||
}
|
||||
else print_verilog_element(fd, i) ; /* this is the element line */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* File: vhdl_netlist.c
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -44,84 +44,84 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* to be printed before any entity declarations */
|
||||
|
||||
if(modified) {
|
||||
save_ok = save_schematic(schematic[currentsch]);
|
||||
save_ok = save_schematic(xctx.sch[xctx.currsch]);
|
||||
if(save_ok == -1) return;
|
||||
}
|
||||
netlist_count=0;
|
||||
free_hash(subckt_table);
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(schematic[currentsch]), getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sch[xctx.currsch]), getpid());
|
||||
fd=fopen(netl_filename, "w");
|
||||
|
||||
|
||||
if(user_top_netl_name[0]) {
|
||||
my_snprintf(cellname, S(cellname), "%s", get_cell(user_top_netl_name, 0));
|
||||
} else {
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(schematic[currentsch]));
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx.sch[xctx.currsch]));
|
||||
}
|
||||
|
||||
if(fd==NULL){
|
||||
if(fd==NULL){
|
||||
dbg(0, "global_vhdl_netlist(): problems opening netlist file\n");
|
||||
return;
|
||||
}
|
||||
dbg(1, "global_vhdl_netlist(): opening %s for writing\n",netl_filename);
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level packages\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
my_strdup(571, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(571, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"package"))==0)
|
||||
{
|
||||
if(inst_ptr[i].prop_ptr) { /* */
|
||||
if(xctx.inst[i].prop_ptr) { /* */
|
||||
fprintf(fd, "//// begin package\n"); /* 20080213 mark start of packages */
|
||||
fprintf(fd, "%s\n", inst_ptr[i].prop_ptr);
|
||||
fprintf(fd, "%s\n", xctx.inst[i].prop_ptr);
|
||||
fprintf(fd, "//// end package\n"); /* 20080213 mark end of packages */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level use statements\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(572, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(572, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"use"))==0)
|
||||
{
|
||||
if(inst_ptr[i].prop_ptr) fprintf(fd, "%s\n", inst_ptr[i].prop_ptr);
|
||||
if(xctx.inst[i].prop_ptr) fprintf(fd, "%s\n", xctx.inst[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level entity\n");
|
||||
|
||||
/* 20071015 already done in print_generic() */
|
||||
/* fprintf(fd," --- entity %s is\n", skip_dir( schematic[currentsch]) ); */
|
||||
/* fprintf(fd," --- entity %s is\n", skip_dir( xctx.sch[xctx.currsch]) ); */
|
||||
/* 20071015 end */
|
||||
|
||||
/* flush data structures (remove unused symbols) */
|
||||
unselect_all();
|
||||
remove_symbols(); /* removed 25122002, readded 04112003.. this removes unused symbols */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
|
||||
|
||||
/* 20071009 print top level generics if defined in symbol */
|
||||
|
||||
str_tmp = add_ext(schematic[currentsch], ".sym");
|
||||
str_tmp = add_ext(xctx.sch[xctx.currsch], ".sym");
|
||||
if(!stat(str_tmp, &buf)) {
|
||||
load_sym_def(str_tmp, NULL );
|
||||
print_generic(fd,"entity", lastinstdef-1); /* added print top level params */
|
||||
remove_symbol(lastinstdef - 1);
|
||||
print_generic(fd,"entity", xctx.symbols-1); /* added print top level params */
|
||||
remove_symbol(xctx.symbols - 1);
|
||||
} else {
|
||||
fprintf(fd,"entity %s is\n", skip_dir( schematic[currentsch]) );
|
||||
fprintf(fd,"entity %s is\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
}
|
||||
/* 20071009 end */
|
||||
|
||||
|
|
@ -130,16 +130,16 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* print top subckt generics */
|
||||
/* dbg(1, "global_vhdl_netlist(): printing top level generic pins\n"); */
|
||||
/* tmp=0; */
|
||||
/* for(i=0;i<lastinst;i++) */
|
||||
/* for(i=0;i<xctx.instances;i++) */
|
||||
/* { */
|
||||
/* if(inst_ptr[i].ptr<0) continue; */
|
||||
/* my_strdup(573, &type,(inst_ptr[i].ptr+instdef)->type); */
|
||||
/* my_strdup(574, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"generic_type",0)); */
|
||||
/* if(xctx.inst[i].ptr<0) continue; */
|
||||
/* my_strdup(573, &type,(xctx.inst[i].ptr+ xctx.sym)->type); */
|
||||
/* my_strdup(574, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"generic_type",0)); */
|
||||
/* if(!sig_type || sig_type[0]=='\0') my_strdup(575, &sig_type,"std_logic"); */
|
||||
/* if( type && (strcmp(type,"generic"))==0) */
|
||||
/* { */
|
||||
/* my_strdup(576, &port_value,get_tok_value(inst_ptr[i].prop_ptr,"value",2)); */
|
||||
/* str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0); */
|
||||
/* my_strdup(576, &port_value,get_tok_value(xctx.inst[i].prop_ptr,"value",2)); */
|
||||
/* str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0); */
|
||||
/* if(!tmp) fprintf(fd,"generic (\n"); */
|
||||
/* if(tmp) fprintf(fd," ;\n"); */
|
||||
/* fprintf(fd, " %s : %s", str_tmp ? str_tmp : "(NULL)", sig_type ); */
|
||||
|
|
@ -156,19 +156,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
/* print top subckt ipin/opins */
|
||||
dbg(1, "global_vhdl_netlist(): printing top level out pins\n");
|
||||
tmp=0;
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(577, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(577, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(578, &sig_type,"std_logic");
|
||||
my_strdup(579, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(579, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"opin"))==0)
|
||||
{
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
if(!tmp) fprintf(fd,"port(\n");
|
||||
if(tmp) fprintf(fd," ;\n");
|
||||
fprintf(fd, " %s : out %s", str_tmp ? str_tmp : "(NULL)", sig_type );
|
||||
|
|
@ -177,19 +177,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level inout pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(580, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(580, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(581, &sig_type,"std_logic");
|
||||
my_strdup(582, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(582, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"iopin"))==0)
|
||||
{
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
if(!tmp) fprintf(fd,"port(\n");
|
||||
if(tmp) fprintf(fd," ;\n");
|
||||
fprintf(fd, " %s : inout %s", str_tmp ? str_tmp : "(NULL)", sig_type );
|
||||
|
|
@ -198,19 +198,19 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level input pins\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(583, &sig_type,get_tok_value(inst_ptr[i].prop_ptr,"sig_type",0));
|
||||
my_strdup(583, &sig_type,get_tok_value(xctx.inst[i].prop_ptr,"sig_type",0));
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(584, &sig_type,"std_logic");
|
||||
my_strdup(585, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(585, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"ipin"))==0)
|
||||
{
|
||||
str_tmp = get_tok_value(inst_ptr[i].prop_ptr,"lab",0);
|
||||
str_tmp = get_tok_value(xctx.inst[i].prop_ptr,"lab",0);
|
||||
if(!tmp) fprintf(fd,"port(\n");
|
||||
if(tmp) fprintf(fd," ;\n");
|
||||
fprintf(fd, " %s : in %s", str_tmp ? str_tmp : "<NULL>", sig_type );
|
||||
|
|
@ -220,61 +220,61 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
if(tmp) fprintf(fd,"\n);\n");
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level port attributes\n");
|
||||
for(i=0;i<lastinst;i++)
|
||||
for(i=0;i<xctx.instances;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(586, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(586, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"port_attributes"))==0)
|
||||
{
|
||||
if(inst_ptr[i].prop_ptr) fprintf(fd, "%s\n", inst_ptr[i].prop_ptr);
|
||||
if(xctx.inst[i].prop_ptr) fprintf(fd, "%s\n", xctx.inst[i].prop_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir( schematic[currentsch]) );
|
||||
fprintf(fd,"architecture arch_%s of %s is\n\n",
|
||||
skip_dir( schematic[currentsch]) , skip_dir( schematic[currentsch]));
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
fprintf(fd,"architecture arch_%s of %s is\n\n",
|
||||
skip_dir( xctx.sch[xctx.currsch]) , skip_dir( xctx.sch[xctx.currsch]));
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): printing top level used components\n");
|
||||
/* print all components */
|
||||
subckt_name=NULL;
|
||||
for(j=0;j<lastinstdef;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(instdef[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if( strcmp(get_tok_value(instdef[j].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!instdef[j].type || (strcmp(instdef[j].type,"primitive")!=0 &&
|
||||
strcmp(instdef[j].type,"subcircuit")!=0)) continue;
|
||||
for(j=0;j<xctx.symbols;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(xctx.sym[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if( strcmp(get_tok_value(xctx.sym[j].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[j].type || (strcmp(xctx.sym[j].type,"primitive")!=0 &&
|
||||
strcmp(xctx.sym[j].type,"subcircuit")!=0)) continue;
|
||||
if((
|
||||
strcmp(instdef[j].type,"subcircuit")==0 ||
|
||||
strcmp(instdef[j].type,"primitive")==0
|
||||
) && check_lib(instdef[j].name)
|
||||
)
|
||||
strcmp(xctx.sym[j].type,"subcircuit")==0 ||
|
||||
strcmp(xctx.sym[j].type,"primitive")==0
|
||||
) && check_lib(xctx.sym[j].name)
|
||||
)
|
||||
{
|
||||
/* instdef can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(317, &subckt_name, get_cell(instdef[j].name, 0));
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(317, &subckt_name, get_cell(xctx.sym[j].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL) {
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
/* component generics */
|
||||
print_generic(fd,"component", j);
|
||||
|
||||
|
||||
/* component ports */
|
||||
tmp=0;
|
||||
for(i=0;i<instdef[j].rects[PINLAYER];i++)
|
||||
for(i=0;i<xctx.sym[j].rects[PINLAYER];i++)
|
||||
{
|
||||
if(strcmp(get_tok_value(instdef[j].boxptr[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx.sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(587, &sig_type,get_tok_value(
|
||||
instdef[j].boxptr[PINLAYER][i].prop_ptr,"sig_type",0));
|
||||
xctx.sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0));
|
||||
my_strdup(588, &port_value, get_tok_value(
|
||||
instdef[j].boxptr[PINLAYER][i].prop_ptr,"value",2) );
|
||||
xctx.sym[j].rect[PINLAYER][i].prop_ptr,"value",2) );
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(589, &sig_type,"std_logic");
|
||||
my_strdup(590, &dir_tmp, get_tok_value(instdef[j].boxptr[PINLAYER][i].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(instdef[j].boxptr[PINLAYER][i].prop_ptr,"name",0);
|
||||
my_strdup(590, &dir_tmp, get_tok_value(xctx.sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx.sym[j].rect[PINLAYER][i].prop_ptr,"name",0);
|
||||
if(!tmp) fprintf(fd, "port (\n");
|
||||
if(tmp) fprintf(fd, " ;\n");
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
dir_tmp ? dir_tmp : "<NULL>", sig_type);
|
||||
my_free(1085, &dir_tmp);
|
||||
if(port_value &&port_value[0])
|
||||
|
|
@ -289,29 +289,29 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
free_hash(subckt_table);
|
||||
my_free(1086, &subckt_name);
|
||||
|
||||
|
||||
dbg(1, "global_vhdl_netlist(): netlisting top level\n");
|
||||
vhdl_netlist(fd, 0);
|
||||
fprintf(fd,"//// begin user architecture code\n");
|
||||
/* 20180124 */
|
||||
for(i=0;i<lastinst;i++) {
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
|
||||
for(i=0;i<xctx.instances;i++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(591, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
my_strdup(591, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(inst_ptr[i].prop_ptr,"value",2)); /* 20180124 */
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[i].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
if(schvhdlprop && schvhdlprop[0]) {
|
||||
fprintf(fd, "%s\n", schvhdlprop);
|
||||
if(xctx.schvhdlprop && xctx.schvhdlprop[0]) {
|
||||
fprintf(fd, "%s\n", xctx.schvhdlprop);
|
||||
}
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir( schematic[currentsch]) );
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir( xctx.sch[xctx.currsch]) );
|
||||
|
||||
if(split_files) { /* 20081204 */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -320,52 +320,52 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
netlist_count++;
|
||||
|
||||
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */
|
||||
stored_flags = my_calloc(151, lastinst, sizeof(unsigned int));
|
||||
for(i=0;i<lastinst;i++) stored_flags[i] = inst_ptr[i].flags & 4;
|
||||
stored_flags = my_calloc(151, xctx.instances, sizeof(unsigned int));
|
||||
for(i=0;i<xctx.instances;i++) stored_flags[i] = xctx.inst[i].flags & 4;
|
||||
|
||||
if(global)
|
||||
{
|
||||
unselect_all();
|
||||
remove_symbols(); /* 20161205 ensure all unused symbols purged before descending hierarchy */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
|
||||
currentsch++;
|
||||
dbg(2, "global_vhdl_netlist(): last defined symbol=%d\n",lastinstdef);
|
||||
xctx.currsch++;
|
||||
dbg(2, "global_vhdl_netlist(): last defined symbol=%d\n",xctx.symbols);
|
||||
subckt_name=NULL;
|
||||
for(i=0;i<lastinstdef;i++)
|
||||
for(i=0;i<xctx.symbols;i++)
|
||||
{
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20070726 */
|
||||
if(!instdef[i].type) continue;
|
||||
if(strcmp(instdef[i].type,"subcircuit")==0 && check_lib(instdef[i].name))
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[i].type) continue;
|
||||
if(strcmp(xctx.sym[i].type,"subcircuit")==0 && check_lib(xctx.sym[i].name))
|
||||
{
|
||||
/* instdef can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(327, &subckt_name, get_cell(instdef[i].name, 0));
|
||||
/* xctx.sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
|
||||
my_strdup(327, &subckt_name, get_cell(xctx.sym[i].name, 0));
|
||||
if (hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if( split_files && strcmp(get_tok_value(instdef[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
verilog_block_netlist(fd, i); /* 20081209 */
|
||||
else if( split_files && strcmp(get_tok_value(instdef[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
spice_block_netlist(fd, i); /* 20081209 */
|
||||
if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"verilog_netlist",0),"true")==0 )
|
||||
verilog_block_netlist(fd, i);
|
||||
else if( split_files && strcmp(get_tok_value(xctx.sym[i].prop_ptr,"spice_netlist",0),"true")==0 )
|
||||
spice_block_netlist(fd, i);
|
||||
else
|
||||
if( strcmp(get_tok_value(instdef[i].prop_ptr,"vhdl_primitive",0),"true"))
|
||||
vhdl_block_netlist(fd, i); /* 20081205 */
|
||||
if( strcmp(get_tok_value(xctx.sym[i].prop_ptr,"vhdl_primitive",0),"true"))
|
||||
vhdl_block_netlist(fd, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
free_hash(subckt_table);
|
||||
my_free(1087, &subckt_name);
|
||||
my_strncpy(schematic[currentsch] , "", S(schematic[currentsch]));
|
||||
currentsch--;
|
||||
my_strncpy(xctx.sch[xctx.currsch] , "", S(xctx.sch[xctx.currsch]));
|
||||
xctx.currsch--;
|
||||
unselect_all();
|
||||
/* remove_symbols(); */
|
||||
load_schematic(1, schematic[currentsch], 0); /* 20180927 */
|
||||
load_schematic(1, xctx.sch[xctx.currsch], 0);
|
||||
prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
|
||||
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
|
||||
sym_vs_sch_pins();
|
||||
|
||||
/* restore hilight flags from errors found analyzing top level before descending hierarchy */
|
||||
for(i=0;i<lastinst; i++) inst_ptr[i].flags |= stored_flags[i];
|
||||
for(i=0;i<xctx.instances; i++) xctx.inst[i].flags |= stored_flags[i];
|
||||
|
||||
draw_hilight_net(1);
|
||||
}
|
||||
|
|
@ -375,11 +375,11 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
fclose(fd);
|
||||
if(netlist_show) {
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} show {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist); /* 20081202 */
|
||||
tcleval(tcl_cmd_netlist);
|
||||
}
|
||||
else {
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist); /* 20081202 */
|
||||
tcleval(tcl_cmd_netlist);
|
||||
}
|
||||
if(!debug_var) xunlink(netl_filename);
|
||||
}
|
||||
|
|
@ -390,7 +390,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
|
|||
}
|
||||
|
||||
|
||||
void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
|
||||
void vhdl_block_netlist(FILE *fd, int i)
|
||||
{
|
||||
int j,k,l, tmp, found;
|
||||
int vhdl_stop=0;
|
||||
|
|
@ -400,57 +400,57 @@ void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
|
|||
char *type=NULL;
|
||||
char filename[PATH_MAX];
|
||||
char netl_filename[PATH_MAX];
|
||||
char tcl_cmd_netlist[PATH_MAX + 100]; /* 20081202 */
|
||||
char cellname[PATH_MAX]; /* 20081202 */
|
||||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
|
||||
if(!strcmp( get_tok_value(instdef[i].prop_ptr,"vhdl_stop",0),"true") )
|
||||
if(!strcmp( get_tok_value(xctx.sym[i].prop_ptr,"vhdl_stop",0),"true") )
|
||||
vhdl_stop=1;
|
||||
else
|
||||
vhdl_stop=0;
|
||||
|
||||
if(split_files) { /* 20081202 */
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(instdef[i].name), getpid());
|
||||
if(split_files) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx.sym[i].name), getpid());
|
||||
dbg(1, "vhdl_block_netlist(): split_files: netl_filename=%s\n", netl_filename);
|
||||
fd=fopen(netl_filename, "w");
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(instdef[i].name) );
|
||||
my_snprintf(cellname, S(cellname), "%s.vhdl", skip_dir(xctx.sym[i].name) );
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): expanding %s\n", instdef[i].name);
|
||||
fprintf(fd, "\n-- expanding symbol: %s # of pins=%d\n\n",
|
||||
instdef[i].name,instdef[i].rects[PINLAYER] );
|
||||
dbg(1, "vhdl_block_netlist(): expanding %s\n", xctx.sym[i].name);
|
||||
fprintf(fd, "\n-- expanding symbol: %s # of pins=%d\n\n",
|
||||
xctx.sym[i].name,xctx.sym[i].rects[PINLAYER] );
|
||||
|
||||
if((str_tmp = get_tok_value(instdef[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
if((str_tmp = get_tok_value(xctx.sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strncpy(filename, abs_sym_path(str_tmp, ""), S(filename));
|
||||
load_schematic(1,filename, 0);
|
||||
} else {
|
||||
load_schematic(1, add_ext(abs_sym_path(instdef[i].name, ""), ".sch"), 0); /* 20190518 */
|
||||
load_schematic(1, add_ext(abs_sym_path(xctx.sym[i].name, ""), ".sch"), 0);
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): packages\n");
|
||||
for(l=0;l<lastinst;l++)
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
{
|
||||
if(!(inst_ptr[l].ptr+instdef)->type) continue;
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if(!(xctx.inst[l].ptr+ xctx.sym)->type) continue;
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if( !strcmp((inst_ptr[l].ptr+instdef)->type, "package") )
|
||||
fprintf(fd, "%s\n", inst_ptr[l].prop_ptr);
|
||||
if( !strcmp((xctx.inst[l].ptr+ xctx.sym)->type, "package") )
|
||||
fprintf(fd, "%s\n", xctx.inst[l].prop_ptr);
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): use statements\n");
|
||||
for(l=0;l<lastinst;l++)
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!(inst_ptr[l].ptr+instdef)->type) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!(xctx.inst[l].ptr+ xctx.sym)->type) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if( !strcmp((inst_ptr[l].ptr+instdef)->type, "use") )
|
||||
fprintf(fd, "%s\n", inst_ptr[l].prop_ptr);
|
||||
if( !strcmp((xctx.inst[l].ptr+ xctx.sym)->type, "use") )
|
||||
fprintf(fd, "%s\n", xctx.inst[l].prop_ptr);
|
||||
}
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): entity generics\n");
|
||||
|
|
@ -460,19 +460,19 @@ void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
|
|||
dbg(1, "vhdl_block_netlist(): entity ports\n");
|
||||
/* print entity ports */
|
||||
tmp=0;
|
||||
for(j=0;j<instdef[i].rects[PINLAYER];j++)
|
||||
for(j=0;j<xctx.sym[i].rects[PINLAYER];j++)
|
||||
{
|
||||
if(strcmp(get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(592, &sig_type,get_tok_value(
|
||||
instdef[i].boxptr[PINLAYER][j].prop_ptr,"sig_type",0));
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0));
|
||||
my_strdup(593, &port_value, get_tok_value(
|
||||
instdef[i].boxptr[PINLAYER][j].prop_ptr,"value",2) );
|
||||
xctx.sym[i].rect[PINLAYER][j].prop_ptr,"value",2) );
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(594, &sig_type,"std_logic");
|
||||
my_strdup(595, &dir_tmp, get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(instdef[i].boxptr[PINLAYER][j].prop_ptr,"name",0);
|
||||
my_strdup(595, &dir_tmp, get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx.sym[i].rect[PINLAYER][j].prop_ptr,"name",0);
|
||||
if(tmp) fprintf(fd, " ;\n");
|
||||
if(!tmp) fprintf(fd,"port (\n");
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
dir_tmp ? dir_tmp : "<NULL>", sig_type);
|
||||
my_free(1092, &dir_tmp);
|
||||
if(port_value &&port_value[0])
|
||||
|
|
@ -483,77 +483,77 @@ void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
|
|||
if(tmp) fprintf(fd, "\n);\n");
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): port attributes\n");
|
||||
for(l=0;l<lastinst;l++)
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(596, &type,(inst_ptr[l].ptr+instdef)->type);
|
||||
my_strdup(596, &type,(xctx.inst[l].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"port_attributes"))==0)
|
||||
{
|
||||
if(inst_ptr[l].prop_ptr) fprintf(fd, "%s\n", inst_ptr[l].prop_ptr);
|
||||
if(xctx.inst[l].prop_ptr) fprintf(fd, "%s\n", xctx.inst[l].prop_ptr);
|
||||
}
|
||||
}
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir(instdef[i].name) );
|
||||
fprintf(fd,"end %s ;\n\n", skip_dir(xctx.sym[i].name) );
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): architecture\n");
|
||||
fprintf(fd,"architecture arch_%s of %s is\n\n",
|
||||
skip_dir(instdef[i].name), skip_dir(instdef[i].name) );
|
||||
/* skip_dir( schematic[currentsch]), skip_dir( schematic[currentsch])); */
|
||||
fprintf(fd,"architecture arch_%s of %s is\n\n",
|
||||
skip_dir(xctx.sym[i].name), skip_dir(xctx.sym[i].name) );
|
||||
/* skip_dir( xctx.sch[xctx.currsch]), skip_dir( xctx.sch[xctx.currsch])); */
|
||||
/* load current schematic to print used components */
|
||||
|
||||
dbg(1, "vhdl_block_netlist(): used components\n");
|
||||
/* print all components */
|
||||
if(!vhdl_stop)
|
||||
for(j=0;j<lastinstdef;j++)
|
||||
for(j=0;j<xctx.symbols;j++)
|
||||
{
|
||||
if( strcmp(get_tok_value(instdef[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if(!instdef[j].type || (strcmp(instdef[j].type,"primitive")!=0 && strcmp(instdef[j].type,"subcircuit")!=0))
|
||||
if( strcmp(get_tok_value(xctx.sym[j].prop_ptr,"vhdl_primitive",0),"true")==0 ) continue;
|
||||
if(!xctx.sym[j].type || (strcmp(xctx.sym[j].type,"primitive")!=0 && strcmp(xctx.sym[j].type,"subcircuit")!=0))
|
||||
continue;
|
||||
if((
|
||||
strcmp(instdef[j].type,"subcircuit")==0 ||
|
||||
strcmp(instdef[j].type,"primitive")==0
|
||||
) && check_lib(instdef[j].name)
|
||||
strcmp(xctx.sym[j].type,"subcircuit")==0 ||
|
||||
strcmp(xctx.sym[j].type,"primitive")==0
|
||||
) && check_lib(xctx.sym[j].name)
|
||||
)
|
||||
{
|
||||
|
||||
/* only print component declaration if used in current subcircuit */
|
||||
found=0;
|
||||
for(l=0;l<lastinst;l++)
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(!strcmp(instdef[j].name,inst_ptr[l].name))
|
||||
{
|
||||
if(!strcmp(xctx.sym[j].name,xctx.inst[l].name))
|
||||
{
|
||||
found=1; break;
|
||||
}
|
||||
}
|
||||
if(!found) continue;
|
||||
|
||||
|
||||
/* component generics */
|
||||
print_generic(fd, "component",j);
|
||||
|
||||
|
||||
/* component ports */
|
||||
tmp=0;
|
||||
for(k=0;k<instdef[j].rects[PINLAYER];k++)
|
||||
for(k=0;k<xctx.sym[j].rects[PINLAYER];k++)
|
||||
{
|
||||
if(strcmp(get_tok_value(instdef[j].boxptr[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
if(strcmp(get_tok_value(xctx.sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) {
|
||||
my_strdup(597, &sig_type,get_tok_value(
|
||||
instdef[j].boxptr[PINLAYER][k].prop_ptr,"sig_type",0));
|
||||
xctx.sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0));
|
||||
my_strdup(598, &port_value, get_tok_value(
|
||||
instdef[j].boxptr[PINLAYER][k].prop_ptr,"value",2) );
|
||||
|
||||
xctx.sym[j].rect[PINLAYER][k].prop_ptr,"value",2) );
|
||||
|
||||
if(!sig_type || sig_type[0]=='\0') my_strdup(599, &sig_type,"std_logic");
|
||||
my_strdup(600, &dir_tmp, get_tok_value(instdef[j].boxptr[PINLAYER][k].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(instdef[j].boxptr[PINLAYER][k].prop_ptr,"name",0);
|
||||
my_strdup(600, &dir_tmp, get_tok_value(xctx.sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) );
|
||||
str_tmp = get_tok_value(xctx.sym[j].rect[PINLAYER][k].prop_ptr,"name",0);
|
||||
if(!tmp) fprintf(fd, "port (\n");
|
||||
if(tmp) fprintf(fd, " ;\n");
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
fprintf(fd," %s : %s %s",str_tmp ? str_tmp : "<NULL>",
|
||||
dir_tmp ? dir_tmp : "<NULL>", sig_type);
|
||||
my_free(1093, &dir_tmp);
|
||||
if(port_value &&port_value[0])
|
||||
|
|
@ -565,32 +565,32 @@ void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
|
|||
fprintf(fd, "end component ;\n\n");
|
||||
}
|
||||
}
|
||||
dbg(1, "vhdl_block_netlist(): netlisting %s\n",
|
||||
skip_dir( schematic[currentsch]));
|
||||
dbg(1, "vhdl_block_netlist(): netlisting %s\n",
|
||||
skip_dir( xctx.sch[xctx.currsch]));
|
||||
vhdl_netlist(fd, vhdl_stop);
|
||||
fprintf(fd,"//// begin user architecture code\n");
|
||||
|
||||
|
||||
/* 20180124 */
|
||||
for(l=0;l<lastinst;l++) {
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(inst_ptr[l].prop_ptr, "only_toplevel", 0), "true")) continue; /* 20160418 */
|
||||
|
||||
my_strdup(601, &type,(inst_ptr[l].ptr+instdef)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(inst_ptr[l].prop_ptr,"value",2)); /* 20180124 */
|
||||
for(l=0;l<xctx.instances;l++) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(netlist_count &&
|
||||
!strcmp(get_tok_value(xctx.inst[l].prop_ptr, "only_toplevel", 0), "true")) continue;
|
||||
|
||||
my_strdup(601, &type,(xctx.inst[l].ptr+ xctx.sym)->type);
|
||||
if(type && !strcmp(type,"netlist_commands")) {
|
||||
fprintf(fd, "%s\n", get_tok_value(xctx.inst[l].prop_ptr,"value",2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(schvhdlprop && schvhdlprop[0]) fprintf(fd, "%s\n", schvhdlprop);
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir(instdef[i].name) ); /* skip_dir( schematic[currentsch]) ); */
|
||||
if(split_files) { /* 20081204 */
|
||||
if(xctx.schvhdlprop && xctx.schvhdlprop[0]) fprintf(fd, "%s\n", xctx.schvhdlprop);
|
||||
fprintf(fd, "end arch_%s ;\n\n", skip_dir(xctx.sym[i].name) ); /* skip_dir( xctx.sch[xctx.currsch]) ); */
|
||||
if(split_files) {
|
||||
fclose(fd);
|
||||
my_snprintf(tcl_cmd_netlist, S(tcl_cmd_netlist), "netlist {%s} noshow {%s}", netl_filename, cellname);
|
||||
tcleval(tcl_cmd_netlist);
|
||||
|
|
@ -600,7 +600,7 @@ void vhdl_block_netlist(FILE *fd, int i) /*20081204 */
|
|||
my_free(1094, &sig_type);
|
||||
my_free(1095, &port_value);
|
||||
my_free(1096, &type);
|
||||
}
|
||||
}
|
||||
|
||||
void vhdl_netlist(FILE *fd , int vhdl_stop)
|
||||
{
|
||||
|
|
@ -615,16 +615,16 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
|
||||
dbg(1, "vhdl_netlist(): architecture declarations\n");
|
||||
fprintf(fd, "//// begin user declarations\n");
|
||||
for(l=0;l<lastinst;l++)
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(!(inst_ptr[l].ptr+instdef)->type) continue;
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(!(xctx.inst[l].ptr+ xctx.sym)->type) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
if(!strcmp((inst_ptr[l].ptr+instdef)->type, "arch_declarations") )
|
||||
fprintf(fd, "%s\n", inst_ptr[l].prop_ptr? inst_ptr[l].prop_ptr: "");
|
||||
}
|
||||
if(!strcmp((xctx.inst[l].ptr+ xctx.sym)->type, "arch_declarations") )
|
||||
fprintf(fd, "%s\n", xctx.inst[l].prop_ptr? xctx.inst[l].prop_ptr: "");
|
||||
}
|
||||
fprintf(fd, "//// end user declarations\n");
|
||||
|
||||
|
|
@ -634,17 +634,17 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
|
||||
dbg(1, "vhdl_netlist(): attributes\n");
|
||||
fprintf(fd, "//// begin user attributes\n");
|
||||
for(l=0;l<lastinst;l++)
|
||||
for(l=0;l<xctx.instances;l++)
|
||||
{
|
||||
if( strcmp(get_tok_value(inst_ptr[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[l].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
if( strcmp(get_tok_value(xctx.inst[l].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[l].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[l].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
my_strdup(602, &type,(inst_ptr[l].ptr+instdef)->type);
|
||||
}
|
||||
my_strdup(602, &type,(xctx.inst[l].ptr+ xctx.sym)->type);
|
||||
if( type && (strcmp(type,"attributes"))==0)
|
||||
{
|
||||
if(inst_ptr[l].prop_ptr) fprintf(fd, "\n%s\n", inst_ptr[l].prop_ptr);
|
||||
if(xctx.inst[l].prop_ptr) fprintf(fd, "\n%s\n", xctx.inst[l].prop_ptr);
|
||||
}
|
||||
}
|
||||
fprintf(fd, "//// end user attributes\n");
|
||||
|
|
@ -653,29 +653,29 @@ void vhdl_netlist(FILE *fd , int vhdl_stop)
|
|||
fprintf(fd, "begin\n"); /* begin reintroduced 09122003 */
|
||||
if(!vhdl_stop)
|
||||
{
|
||||
for(i=0;i<lastinst;i++) /* ... print all element except ipin opin labels use package */
|
||||
for(i=0;i<xctx.instances;i++) /* ... print all element except ipin opin labels use package */
|
||||
{ /* dont print elements with vhdl_ignore=true set in symbol */
|
||||
if( strcmp(get_tok_value(inst_ptr[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue; /* 20140416 */
|
||||
if(inst_ptr[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (inst_ptr[i].ptr+instdef)->prop_ptr, "vhdl_ignore",0 ), "true") ) { /*20070726 */
|
||||
continue; /*20070726 */
|
||||
} /*20070726 */
|
||||
if( strcmp(get_tok_value(xctx.inst[i].prop_ptr,"vhdl_ignore",0),"true")==0 ) continue;
|
||||
if(xctx.inst[i].ptr<0) continue;
|
||||
if(!strcmp(get_tok_value( (xctx.inst[i].ptr+ xctx.sym)->prop_ptr, "vhdl_ignore",0 ), "true") ) {
|
||||
continue;
|
||||
}
|
||||
dbg(2, "vhdl_netlist(): into the netlisting loop\n");
|
||||
my_strdup(603, &type,(inst_ptr[i].ptr+instdef)->type);
|
||||
if( type &&
|
||||
my_strdup(603, &type,(xctx.inst[i].ptr+ xctx.sym)->type);
|
||||
if( type &&
|
||||
( !IS_LABEL_OR_PIN(type) &&
|
||||
strcmp(type,"generic")&&
|
||||
strcmp(type,"use")&&
|
||||
strcmp(type,"netlist_commands")&& /* 20180124 */
|
||||
strcmp(type,"netlist_commands")&&
|
||||
strcmp(type,"package") &&
|
||||
strcmp(type,"attributes") &&
|
||||
strcmp(type,"port_attributes") &&
|
||||
strcmp(type,"arch_declarations")
|
||||
strcmp(type,"arch_declarations")
|
||||
))
|
||||
{
|
||||
if(lastselected)
|
||||
if(lastselected)
|
||||
{
|
||||
if(inst_ptr[i].sel==SELECTED) {
|
||||
if(xctx.inst[i].sel==SELECTED) {
|
||||
print_vhdl_element(fd, i) ;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
552
src/xinit.c
552
src/xinit.c
File diff suppressed because it is too large
Load Diff
275
src/xschem.h
275
src/xschem.h
|
|
@ -1,7 +1,7 @@
|
|||
/* File: xschem.h
|
||||
*
|
||||
*
|
||||
* This file is part of XSCHEM,
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* a schematic capture and Spice/Vhdl/Verilog netlisting tool for circuit
|
||||
* simulation.
|
||||
* Copyright (C) 1998-2020 Stefan Frederik Schippers
|
||||
*
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
|
||||
/* #include <sys/time.h> for gettimeofday(). use time() instead */
|
||||
#include <signal.h>
|
||||
#ifdef __unix__
|
||||
|
|
@ -137,7 +137,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#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 EMBEDDED 1 /* used for embedded symbols marking in Instdef.flags */
|
||||
#define EMBEDDED 1 /* used for embedded symbols marking in Symbol.flags */
|
||||
#define CADMAXGRIDPOINTS 512
|
||||
#define CADMAXHIER 80
|
||||
#define CADCHUNKALLOC 512 /* was 256 20102004 */
|
||||
|
|
@ -145,7 +145,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
|
||||
/* when x-width of drawing area s below this threshold use spatial */
|
||||
/* hash table for drawing wires and instances (for faster lookup) instead of */
|
||||
/* looping through the whole wire[] and inst_ptr[] arrays */
|
||||
/* looping through the whole wire[] and inst[] arrays */
|
||||
/* when drawing area is very big using spatial hash table may take longer than */
|
||||
/* a simple for() loop through the big arrays + clip check. */
|
||||
#define ITERATOR_THRESHOLD 42000.0
|
||||
|
|
@ -181,7 +181,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define MENUSTARTARC 1048576
|
||||
#define MENUSTARTCIRCLE 2097152
|
||||
#define PLACE_SYMBOL 4194304 /* used in move_objects after place_symbol to avoid storing intermediate undo state */
|
||||
#define START_SYMPIN 8388608
|
||||
#define START_SYMPIN 8388608
|
||||
#define SELECTED 1 /* used in the .sel field for selected objs. */
|
||||
#define SELECTED1 2 /* first point selected... */
|
||||
#define SELECTED2 4 /* second point selected... */
|
||||
|
|
@ -240,7 +240,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
#define XINSERT 0
|
||||
#define XLOOKUP 1
|
||||
#define XDELETE 2
|
||||
#define XINSERT_NOREPLACE 3 /* do not replace token value in hash if already present */
|
||||
#define XINSERT_NOREPLACE 3 /* do not replace token value in hash if already present */
|
||||
|
||||
/* Cairo text flags */
|
||||
#define TEXT_BOLD 1
|
||||
|
|
@ -275,7 +275,7 @@ extern char win_temp_dir[PATH_MAX];
|
|||
double xxtmp; \
|
||||
if(x2 < x1) {xxtmp = x1; x1 = x2; x2 = xxtmp;} \
|
||||
if(y2 < y1) {xxtmp = y1; y1 = y2; y2 = xxtmp;} \
|
||||
}
|
||||
}
|
||||
|
||||
#define OUTSIDE(xa,ya,xb,yb,x1,y1,x2,y2) \
|
||||
(xa>x2 || xb<x1 || ya>y2 || yb<y1 )
|
||||
|
|
@ -292,12 +292,12 @@ extern char win_temp_dir[PATH_MAX];
|
|||
strcmp(type,"show_label") && strcmp(type,"iopin")))
|
||||
#define IS_LABEL_OR_PIN(type) (!(strcmp(type,"label") && strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
#define IS_PIN(type) (!(strcmp(type,"ipin") && strcmp(type,"opin") && strcmp(type,"iopin")))
|
||||
|
||||
|
||||
#define X_TO_SCREEN(x) ( floor((x+xorigin)* mooz) )
|
||||
#define Y_TO_SCREEN(y) ( floor((y+yorigin)* mooz) )
|
||||
#define X_TO_XSCHEM(x) ((x)*zoom -xorigin)
|
||||
#define Y_TO_XSCHEM(y) ((y)*zoom -yorigin)
|
||||
|
||||
#define X_TO_SCREEN(x) ( floor((x+xctx.xorigin)* xctx.mooz) )
|
||||
#define Y_TO_SCREEN(y) ( floor((y+xctx.yorigin)* xctx.mooz) )
|
||||
#define X_TO_XSCHEM(x) ((x)*xctx.zoom -xctx.xorigin)
|
||||
#define Y_TO_XSCHEM(y) ((y)*xctx.zoom -xctx.yorigin)
|
||||
|
||||
|
||||
typedef struct
|
||||
|
|
@ -307,7 +307,7 @@ typedef struct
|
|||
unsigned short col;
|
||||
} Selected;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
double x1;
|
||||
double x2;
|
||||
|
|
@ -319,7 +319,7 @@ typedef struct
|
|||
char *node;
|
||||
char *prop_ptr;
|
||||
int bus; /* 20171201 cache here wire "bus" property, to avoid too many get_tok_value() calls */
|
||||
} Wire;
|
||||
} xWire;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -331,7 +331,7 @@ typedef struct
|
|||
char *prop_ptr;
|
||||
int dash;
|
||||
int bus;
|
||||
} Line;
|
||||
} xLine;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -342,9 +342,9 @@ typedef struct
|
|||
unsigned short sel;
|
||||
char *prop_ptr;
|
||||
int dash;
|
||||
} Box;
|
||||
} xRect;
|
||||
|
||||
typedef struct /* 20171115 */
|
||||
typedef struct
|
||||
{
|
||||
/* last point coincident to first, added by program if needed. */
|
||||
/* XDrawLines needs first and last point to close the polygon */
|
||||
|
|
@ -354,11 +354,11 @@ typedef struct /* 20171115 */
|
|||
unsigned short *selected_point;
|
||||
unsigned short sel;
|
||||
char *prop_ptr;
|
||||
int fill; /* 20180914 */
|
||||
int fill;
|
||||
int dash;
|
||||
} xPolygon;
|
||||
} xPoly;
|
||||
|
||||
typedef struct /* 20181012 */
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
|
|
@ -385,7 +385,7 @@ typedef struct
|
|||
int hcenter, vcenter;
|
||||
char *font; /* 20171201 for cairo */
|
||||
int flags;
|
||||
} Text;
|
||||
} xText;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -394,21 +394,21 @@ typedef struct
|
|||
double maxx;
|
||||
double miny;
|
||||
double maxy;
|
||||
Line **lineptr; /* array of [cadlayers] pointers to Line */
|
||||
Box **boxptr;
|
||||
xPolygon **polygonptr; /* 20171115 */
|
||||
xArc **arcptr; /* 20181012 */
|
||||
Text *txtptr;
|
||||
xLine **line; /* array of [cadlayers] pointers to Line */
|
||||
xRect **rect;
|
||||
xPoly **poly;
|
||||
xArc **arc;
|
||||
xText *text;
|
||||
int *lines; /* array of [cadlayers] integers */
|
||||
int *rects;
|
||||
int *polygons; /* 20171115 */
|
||||
int *arcs; /* 20181012 */
|
||||
int *polygons;
|
||||
int *arcs;
|
||||
int texts;
|
||||
char *prop_ptr;
|
||||
char *type; /* 20150409 */
|
||||
char *templ; /* 20150409 */
|
||||
char *type;
|
||||
char *templ;
|
||||
unsigned int flags; /* currently only used for embedded symbols (EMBEDDED) */
|
||||
} Instdef;
|
||||
} xSymbol;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -428,44 +428,63 @@ typedef struct
|
|||
int flip;
|
||||
int sel;
|
||||
int flags; /* bit 0: skip field, bit 1: flag for different textlayer for pin/labels
|
||||
* bit 2 : hilight flag.
|
||||
* bit 2 : hilight flag.
|
||||
*/
|
||||
char *prop_ptr;
|
||||
char **node;
|
||||
char *instname; /* 20150409 instance name (example: I23) */
|
||||
} Instance;
|
||||
} xInstance;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double zoom;
|
||||
} Zoom;
|
||||
|
||||
typedef struct {
|
||||
Wire *wire;
|
||||
Text *textelement;
|
||||
Box **rect;
|
||||
Line **line;
|
||||
xPolygon **polygon;
|
||||
xWire *wire;
|
||||
xText *text;
|
||||
xRect **rect;
|
||||
xLine **line;
|
||||
xPoly **poly;
|
||||
xArc **arc;
|
||||
Instance *inst_ptr;
|
||||
Instdef *instdef;
|
||||
int lastwire;
|
||||
int lastinst;
|
||||
int lastinstdef;
|
||||
int lasttext;
|
||||
int *lastrect;
|
||||
int *lastpolygon;
|
||||
int *lastarc;
|
||||
int *lastline;
|
||||
int *max_rects;
|
||||
int *max_polygons;
|
||||
int *max_arcs;
|
||||
int *max_lines;
|
||||
int max_texts;
|
||||
int max_wires;
|
||||
int max_instances;
|
||||
int max_symbols;
|
||||
xInstance *inst;
|
||||
xSymbol *sym;
|
||||
int wires;
|
||||
int instances;
|
||||
int symbols;
|
||||
int texts;
|
||||
int *rects;
|
||||
int *polygons;
|
||||
int *arcs;
|
||||
int *lines;
|
||||
int *maxr;
|
||||
int *maxp;
|
||||
int *maxa;
|
||||
int *maxl;
|
||||
int maxt;
|
||||
int maxw;
|
||||
int maxi;
|
||||
int maxs;
|
||||
char *schprop;
|
||||
char *schtedaxprop;
|
||||
char *schvhdlprop;
|
||||
char *schsymbolprop;
|
||||
char *schverilogprop;
|
||||
char *xschem_version_string;
|
||||
char sch[CADMAXHIER][PATH_MAX];
|
||||
int currsch;
|
||||
char *version_string;
|
||||
char current_name[PATH_MAX];
|
||||
char file_version[100];
|
||||
char *sch_path[CADMAXHIER];
|
||||
int sch_inst_number[CADMAXHIER];
|
||||
int previous_instance[CADMAXHIER]; /* to remember the instance we came from when going up the hier. */
|
||||
Zoom zoom_array[CADMAXHIER];
|
||||
double xorigin,yorigin;
|
||||
double zoom;
|
||||
double mooz;
|
||||
} Xschem_ctx;
|
||||
|
||||
struct Lcc { /* used for symbols containing schematics as instances (LCC, Local Custom Cell) */
|
||||
|
|
@ -478,14 +497,6 @@ struct Lcc { /* used for symbols containing schematics as instances (LCC, Local
|
|||
char *symname;
|
||||
};
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double zoom;
|
||||
} Zoom;
|
||||
|
||||
struct drivers {
|
||||
int in;
|
||||
int out;
|
||||
|
|
@ -548,7 +559,8 @@ struct instentry {
|
|||
};
|
||||
|
||||
/* GLOBAL VARIABLES */
|
||||
extern int help; /* 20140406 */
|
||||
extern Xschem_ctx xctx;
|
||||
extern int help;
|
||||
extern char *cad_icon[];
|
||||
extern int semaphore;
|
||||
extern int a3page;
|
||||
|
|
@ -563,11 +575,11 @@ extern int prepared_netlist_structs;
|
|||
extern int prepared_hilight_structs;
|
||||
extern int prepared_hash_instances;
|
||||
extern int prepared_hash_wires;
|
||||
extern int has_x;
|
||||
extern int has_x;
|
||||
extern int no_draw;
|
||||
extern int sym_txt;
|
||||
extern int event_reporting;
|
||||
extern int rainbow_colors;
|
||||
extern int event_reporting;
|
||||
extern int rainbow_colors;
|
||||
extern FILE *errfp;
|
||||
extern int no_readline;
|
||||
extern char *filename;
|
||||
|
|
@ -583,10 +595,9 @@ extern int persistent_command;
|
|||
extern int dis_uniq_names;
|
||||
|
||||
extern int tcp_port;
|
||||
extern int debug_var;
|
||||
extern int debug_var;
|
||||
extern char **color_array;
|
||||
extern Colormap colormap;
|
||||
extern char current_name[PATH_MAX];
|
||||
extern unsigned int color_index[];
|
||||
extern int lw; /* line width */
|
||||
extern int bus_width; /* line width */
|
||||
|
|
@ -600,7 +611,7 @@ extern int draw_grid;
|
|||
extern double cadgrid;
|
||||
extern double cadhalfdotsize;
|
||||
extern int draw_pixmap; /* pixmap used as 2nd buffer */
|
||||
extern int draw_window; /* 20181009 */
|
||||
extern int draw_window;
|
||||
extern int need_rebuild_selected_array;
|
||||
extern unsigned int rectcolor;
|
||||
extern XEvent xev;
|
||||
|
|
@ -608,45 +619,13 @@ extern KeySym key;
|
|||
extern unsigned short enable_stretch;
|
||||
extern unsigned int button;
|
||||
extern unsigned int state; /* status of shift,ctrl etc.. */
|
||||
extern Wire *wire;
|
||||
extern Box **rect;
|
||||
extern xPolygon **polygon; /* 20171115 */
|
||||
extern xArc **arc; /* 20181012 */
|
||||
extern Line **line;
|
||||
extern XPoint *gridpoint;
|
||||
extern XRectangle *rectangle;
|
||||
extern Selected *selectedgroup; /* array of selected objs to draw while moving */
|
||||
extern int lastwire;
|
||||
extern int lastselected;
|
||||
extern int *lastrect;
|
||||
extern int *lastpolygon; /* 20171115 */
|
||||
extern int *lastarc; /* 20181012 */
|
||||
extern int *lastline;
|
||||
extern int lastinst ;
|
||||
extern int lastinstdef ;
|
||||
extern int lasttext;
|
||||
extern Instance *inst_ptr; /* Pointer to element INSTANCE */
|
||||
extern Instdef *instdef; /* Pointer to element definition */
|
||||
extern Text *textelement;
|
||||
extern char schematic[CADMAXHIER][PATH_MAX];
|
||||
extern int currentsch;
|
||||
extern char *schtedaxprop;
|
||||
extern char *schprop;
|
||||
extern char *schvhdlprop;
|
||||
extern char *schsymbolprop;
|
||||
extern char *xschem_version_string;
|
||||
extern char file_version[100];
|
||||
extern char *schverilogprop;
|
||||
extern int max_texts;
|
||||
extern int max_wires;
|
||||
extern int max_instances;
|
||||
extern int max_symbols;
|
||||
extern char *xschem_version_string;
|
||||
extern int max_selected;
|
||||
extern int *max_rects;
|
||||
extern int *max_polygons; /* 20171115 */
|
||||
extern int *max_arcs; /* 20181012 */
|
||||
extern int *max_lines;
|
||||
extern int previous_instance[];
|
||||
extern int split_files;
|
||||
extern char *netlist_dir;
|
||||
extern char user_top_netl_name[PATH_MAX];
|
||||
|
|
@ -655,14 +634,14 @@ extern char bus_replacement_char[];
|
|||
extern unsigned long ui_state ; /* this signals that we are doing a net place, */
|
||||
/* panning etc... */
|
||||
|
||||
extern char *undo_dirname; /* 20150327 */
|
||||
extern char *undo_dirname;
|
||||
extern int cur_undo_ptr;
|
||||
extern int tail_undo_ptr;
|
||||
extern int head_undo_ptr;
|
||||
extern int max_undo;
|
||||
extern int draw_dots;
|
||||
extern int draw_single_layer; /* 20151117 */
|
||||
extern int check_version;
|
||||
extern int draw_single_layer;
|
||||
extern int check_version;
|
||||
extern int yyparse_error;
|
||||
extern Window window;
|
||||
extern Window pre_window;
|
||||
|
|
@ -679,14 +658,11 @@ extern Display *display;
|
|||
extern Tcl_Interp *interp;
|
||||
extern XRectangle xrect[];
|
||||
extern int xschem_h, xschem_w; /* 20171130 window size */
|
||||
extern double xorigin,yorigin;
|
||||
extern double zoom;
|
||||
extern double mooz;
|
||||
extern double mousex,mousey; /* mouse coord. */
|
||||
extern double mousex_snap,mousey_snap; /* mouse coord. snapped to grid */
|
||||
extern double cadsnap;
|
||||
extern int horizontal_move; /* 20171023 */
|
||||
extern int vertical_move; /* 20171023 */
|
||||
extern int horizontal_move;
|
||||
extern int vertical_move;
|
||||
extern double *character[256];
|
||||
extern int netlist_show;
|
||||
extern int flat_netlist;
|
||||
|
|
@ -700,24 +676,21 @@ extern int spiceprefix;
|
|||
extern int quit;
|
||||
extern int show_erc;
|
||||
extern int hilight_nets;
|
||||
extern char *sch_path[];
|
||||
extern int sch_inst_number[CADMAXHIER];
|
||||
extern int modified;
|
||||
extern int color_ps;
|
||||
extern int only_probes; /* 20110112 */
|
||||
extern Zoom zoom_array[];
|
||||
extern int only_probes;
|
||||
extern int pending_fullzoom;
|
||||
extern int fullscreen;
|
||||
extern int unzoom_nodrift;
|
||||
extern XColor xcolor_array[];/* 20171109 */
|
||||
extern XColor xcolor_array[];
|
||||
extern Visual *visual;
|
||||
extern int dark_colorscheme; /* 20171113 */
|
||||
extern int dark_colorscheme;
|
||||
extern double color_dim;
|
||||
extern int no_undo; /* 20171204 */
|
||||
extern int no_undo;
|
||||
extern int enable_drill;
|
||||
extern struct wireentry *wiretable[NBOXES][NBOXES];
|
||||
extern struct instpinentry *instpintable[NBOXES][NBOXES];
|
||||
extern double mx_double_save, my_double_save; /* 20070322 */
|
||||
extern double mx_double_save, my_double_save;
|
||||
extern struct instentry *insttable[NBOXES][NBOXES];
|
||||
extern size_t get_tok_value_size;
|
||||
extern size_t get_tok_size;
|
||||
|
|
@ -727,8 +700,8 @@ extern int show_pin_net_names;
|
|||
|
||||
/* FUNCTIONS */
|
||||
extern void enable_layers(void);
|
||||
extern void set_snap(double); /* 20161212 */
|
||||
extern void set_grid(double); /* 20161212 */
|
||||
extern void set_snap(double);
|
||||
extern void set_grid(double);
|
||||
extern void create_plot_cmd(int viewer);
|
||||
extern void set_modify(int mod);
|
||||
extern void dbg(int level, char *fmt, ...);
|
||||
|
|
@ -751,7 +724,7 @@ extern struct hilight_hashentry *bus_hilight_lookup(const char *token, int value
|
|||
extern int name_strcmp(char *s, char *d) ;
|
||||
extern int search(const char *tok, const char *val, int sub, int sel, int what);
|
||||
extern int process_options(int argc, char **argv);
|
||||
extern void calc_drawing_bbox(Box *boundbox, int selected);
|
||||
extern void calc_drawing_bbox(xRect *boundbox, int selected);
|
||||
extern void ps_draw(void);
|
||||
extern void svg_draw(void);
|
||||
extern void print_image();
|
||||
|
|
@ -764,14 +737,14 @@ extern const char *add_ext(const char *f, const char *ext);
|
|||
extern void make_symbol(void);
|
||||
extern const char *get_sym_template(char *s, char *extra);
|
||||
extern void zoom_full(int draw, int sel);
|
||||
extern void updatebbox(int count,Box *boundbox,Box *tmp);
|
||||
extern void updatebbox(int count,xRect *boundbox,xRect *tmp);
|
||||
extern void draw_selection(GC g, int interruptable);
|
||||
extern void delete(void);
|
||||
extern void delete_only_rect_line_arc_poly(void);
|
||||
extern void polygon_bbox(double *x, double *y, int points, double *bx1, double *by1, double *bx2, double *by2);
|
||||
extern void arc_bbox(double x, double y, double r, double a, double b, double *bx1, double *by1, double *bx2, double *by2);
|
||||
extern void bbox(int what,double x1,double y1, double x2, double y2);
|
||||
extern int set_text_custom_font(Text *txt);
|
||||
extern int set_text_custom_font(xText *txt);
|
||||
extern int text_bbox(const char * str,double xscale, double yscale,
|
||||
int rot, int flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1,
|
||||
double *rx2, double *ry2);
|
||||
|
|
@ -790,12 +763,12 @@ extern int text_bbox_nocairo(const char * str,double xscale, double yscale,
|
|||
double *rx2, double *ry2);
|
||||
#endif
|
||||
|
||||
extern unsigned short select_object(double mx,double my, unsigned short sel_mode,
|
||||
extern unsigned short select_object(double mx,double my, unsigned short sel_mode,
|
||||
int override_lock); /* return type 20160503 */
|
||||
extern void unselect_all(void);
|
||||
extern void select_inside(double x1,double y1, double x2, double y2, int sel);
|
||||
extern void xwin_exit(void);
|
||||
extern int Tcl_AppInit(Tcl_Interp *interp);
|
||||
extern int Tcl_AppInit(Tcl_Interp *interp);
|
||||
extern int source_tcl_file(char *s);
|
||||
extern int callback(int event, int mx, int my, KeySym key,
|
||||
int button, int aux, int state);
|
||||
|
|
@ -805,13 +778,13 @@ extern void find_closest_box(double mx,double my);
|
|||
extern void find_closest_arc(double mx,double my);
|
||||
extern void find_closest_element(double mx,double my);
|
||||
extern void find_closest_line(double mx,double my);
|
||||
extern void find_closest_polygon(double mx,double my);/* 20171115 */
|
||||
extern void find_closest_polygon(double mx,double my);
|
||||
extern void find_closest_text(double mx,double my);
|
||||
extern Selected find_closest_obj(double mx,double my);
|
||||
extern void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y);
|
||||
|
||||
extern void drawline(int c, int what, double x1,double y1,double x2,double y2, int dash);
|
||||
extern void draw_string(int layer,int what, const char *str, int rot, int flip, int hcenter, int vcenter,
|
||||
extern void draw_string(int layer,int what, const char *str, int rot, int flip, int hcenter, int vcenter,
|
||||
double x1, double y1, double xscale, double yscale);
|
||||
extern void draw_symbol(int what,int c, int n,int layer,
|
||||
int tmp_flip, int tmp_rot, double xoffset, double yoffset);
|
||||
|
|
@ -832,7 +805,7 @@ extern void drawtemppolygon(GC gc, int what, double *x, double *y, int points);
|
|||
extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash);
|
||||
extern void draw_temp_symbol(int what, GC gc, int n,int layer,
|
||||
int tmp_flip, int tmp_rot, double xoffset, double yoffset);
|
||||
extern void draw_temp_string(GC gc,int what, const char *str, int rot, int flip, int hcenter, int vcenter,
|
||||
extern void draw_temp_string(GC gc,int what, const char *str, int rot, int flip, int hcenter, int vcenter,
|
||||
double x1, double y1, double xscale, double yscale);
|
||||
|
||||
|
||||
|
|
@ -840,7 +813,7 @@ extern void draw(void);
|
|||
extern int clip( double*,double*,double*,double*);
|
||||
extern int textclip(int x1,int y1,int x2,int y2,
|
||||
double xa,double ya,double xb,double yb);
|
||||
extern double dist_from_rect(double mx,
|
||||
extern double dist_from_rect(double mx,
|
||||
double my, double x1, double y1, double x2, double y2);
|
||||
extern double dist(double x1,double y1,double x2,double y2,double xa,double ya);
|
||||
extern double rectdist(double x1,double y1,double x2,double y2,double xa,double ya);
|
||||
|
|
@ -860,7 +833,7 @@ extern void check_touch(int i, int j,
|
|||
extern void storeobject(int pos, double x1,double y1,double x2,double y2,
|
||||
unsigned short type,unsigned int rectcolor,
|
||||
unsigned short sel, const char *prop_ptr);
|
||||
extern void store_polygon(int pos, double *x, double *y, int points, /* 20171115 */
|
||||
extern void store_poly(int pos, double *x, double *y, int points,
|
||||
unsigned int rectcolor, unsigned short sel, char *prop_ptr);
|
||||
extern void store_arc(int pos, double x, double y, double r, double a, double b,
|
||||
unsigned int rectcolor, unsigned short sel, char *prop_ptr);
|
||||
|
|
@ -883,7 +856,7 @@ extern void remove_symbol(int i);
|
|||
extern void clear_drawing(void);
|
||||
extern int load_sym_def(const char name[], FILE *embed_fd);
|
||||
extern void descend_symbol(void);
|
||||
extern int place_symbol(int pos, const char *symbol_name, double x, double y, int rot, int flip,
|
||||
extern int place_symbol(int pos, const char *symbol_name, double x, double y, int rot, int flip,
|
||||
const char *inst_props, int draw_sym, int first_call);
|
||||
extern void attach_labels_to_inst(void);
|
||||
extern int sym_vs_sch_pins(void);
|
||||
|
|
@ -896,7 +869,7 @@ extern void clear_undo(void);
|
|||
extern void load_schematic(int load_symbol, const char *abs_name, int reset_undo);
|
||||
extern void link_symbols_to_instances(void);
|
||||
extern void load_ascii_string(char **ptr, FILE *fd);
|
||||
extern void read_xschem_file(FILE *fd); /* 20180912 */
|
||||
extern void read_xschem_file(FILE *fd);
|
||||
extern char *read_line(FILE *fp, int dbg_level);
|
||||
extern void read_record(int firstchar, FILE *fp, int dbg_level);
|
||||
extern void create_sch_from_sym(void);
|
||||
|
|
@ -919,12 +892,12 @@ extern void pan2(int what, int mx, int my);
|
|||
extern void zoom_box(int what);
|
||||
extern void select_rect(int what, int select);
|
||||
extern void new_rect(int what);
|
||||
extern void new_polygon(int what); /* 20171115 */
|
||||
extern void new_polygon(int what);
|
||||
extern void compile_font(void);
|
||||
extern void rebuild_selected_array(void);
|
||||
|
||||
extern void edit_property(int x);
|
||||
extern int xschem(ClientData clientdata, Tcl_Interp *interp,
|
||||
extern int xschem(ClientData clientdata, Tcl_Interp *interp,
|
||||
int argc, const char * argv[]);
|
||||
extern void tcleval(const char str[]);
|
||||
extern const char *tclresult(void);
|
||||
|
|
@ -989,7 +962,7 @@ extern void check_selected_storage(void);
|
|||
extern void check_box_storage(int c);
|
||||
extern void check_arc_storage(int c);
|
||||
extern void check_line_storage(int c);
|
||||
extern void check_polygon_storage(int c); /* 20171115 */
|
||||
extern void check_polygon_storage(int c);
|
||||
extern const char *expandlabel(const char *s, int *m);
|
||||
extern void clear_expandlabel_data(void);
|
||||
extern void merge_inst(int k, FILE *fd);
|
||||
|
|
@ -1006,12 +979,12 @@ extern int record_global_node(int what, FILE *fp, char *node);
|
|||
extern int count_labels(char *s);
|
||||
extern int get_unnamed_node(int what, int mult, int node);
|
||||
extern void free_node_hash(void);
|
||||
extern struct node_hashentry
|
||||
*node_hash_lookup(const char *token, const char *dir,int what, int port, char *sig_type,
|
||||
extern struct node_hashentry
|
||||
*node_hash_lookup(const char *token, const char *dir,int what, int port, char *sig_type,
|
||||
char *verilog_type, char *value, char *class, const char *orig_tok);
|
||||
extern void traverse_node_hash();
|
||||
extern struct node_hashentry
|
||||
*bus_hash_lookup(const char *token, const char *dir,int what, int port, char *sig_type,
|
||||
extern struct node_hashentry
|
||||
*bus_hash_lookup(const char *token, const char *dir,int what, int port, char *sig_type,
|
||||
char *verilog_type, char *value, char *class);
|
||||
/* extern void insert_missing_pin(); */
|
||||
extern void round_schematic_to_grid(double cadsnap);
|
||||
|
|
@ -1037,23 +1010,25 @@ extern void change_elem_order(void);
|
|||
extern int set_different_token(char **s,const char *new, const char *old, int object, int n);
|
||||
extern void print_hilight_net(int show);
|
||||
extern void change_layer();
|
||||
extern void launcher(); /* 20161102 */
|
||||
extern void launcher();
|
||||
extern void windowid();
|
||||
extern void preview_window(const char *what, const char *tk_win_path, const char *filename);
|
||||
extern int window_state (Display *disp, Window win, char *arg);
|
||||
extern void toggle_fullscreen();
|
||||
extern void toggle_only_probes(); /* 20110112 */
|
||||
extern void toggle_only_probes();
|
||||
extern void update_symbol(const char *result, int x);
|
||||
extern void tclexit(ClientData s);
|
||||
extern int build_colors(double dim); /* reparse the TCL 'colors' list and reassign colors 20171113 */
|
||||
extern void drill_hilight(void);
|
||||
extern void get_square(double x, double y, int *xx, int *yy);
|
||||
extern void del_wire_table(void); /* 20180917 */
|
||||
extern void del_object_table(void); /* 20180917 */
|
||||
extern void del_wire_table(void);
|
||||
extern void del_object_table(void);
|
||||
extern const char *random_string(const char *prefix);
|
||||
extern const char *create_tmpdir(char *prefix);
|
||||
extern FILE *open_tmpfile(char *prefix, char **filename);
|
||||
extern void child_handler(int signum);
|
||||
|
||||
/* CAIRO specific global variables */
|
||||
extern char cairo_font_name[1024]; /* should be monospaced */
|
||||
extern int cairo_longest_line;
|
||||
extern int cairo_lines;
|
||||
|
|
@ -1065,15 +1040,15 @@ extern double cairo_font_line_spacing; /* allows to change line spacing: defaul
|
|||
extern double cairo_vert_correct;
|
||||
extern double nocairo_vert_correct;
|
||||
extern const char fopen_read_mode[];
|
||||
#ifdef HAS_CAIRO /* 20171105 */
|
||||
#ifdef HAS_CAIRO
|
||||
#include <cairo.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include "cairo-xlib-xrender.h"
|
||||
|
||||
# if HAS_XCB==1
|
||||
# include <X11/Xlib-xcb.h> /* 20171125 */
|
||||
# include <X11/Xlib-xcb.h>
|
||||
# include <cairo-xcb.h>
|
||||
extern xcb_connection_t *xcbconn; /* 20171125 */
|
||||
extern xcb_connection_t *xcbconn;
|
||||
extern xcb_screen_t *screen_xcb;
|
||||
extern xcb_render_pictforminfo_t format_rgb, format_rgba;
|
||||
extern xcb_visualtype_t *visual_xcb;
|
||||
|
|
|
|||
|
|
@ -650,7 +650,7 @@ proc probe_net {net} {
|
|||
xschem unselect_all
|
||||
xschem set no_draw 1
|
||||
# return to top level if not already there
|
||||
while { [xschem get currentsch] } { xschem go_back }
|
||||
while { [xschem get currsch] } { xschem go_back }
|
||||
while { [regexp {\.} $net] } {
|
||||
set inst $net
|
||||
regsub {\..*} $inst {} inst
|
||||
|
|
@ -3652,15 +3652,15 @@ font configure Underline-Font -underline true -size 24
|
|||
-command {
|
||||
if { $draw_window == 1} { xschem set draw_window 1} else { xschem set draw_window 0}
|
||||
}
|
||||
.menubar.zoom.menu add checkbutton -label "Show Toolbar" -variable toolbar_visible \
|
||||
-command {
|
||||
if { $toolbar_visible } { toolbar_show } else { toolbar_hide }
|
||||
}
|
||||
.menubar.zoom.menu add checkbutton -label "Enable show net names on symbol pins" -variable show_pin_net_names \
|
||||
-command {
|
||||
xschem set show_pin_net_names $show_pin_net_names
|
||||
xschem redraw
|
||||
}
|
||||
.menubar.zoom.menu add checkbutton -label "Show Toolbar" -variable toolbar_visible \
|
||||
-command {
|
||||
if { $toolbar_visible } { toolbar_show } else { toolbar_hide }
|
||||
}
|
||||
.menubar.zoom.menu add checkbutton -label "Horizontal Toolbar" -variable toolbar_horiz \
|
||||
-command {
|
||||
if { $toolbar_visible } {
|
||||
|
|
|
|||
Loading…
Reference in New Issue