add menu "Symbol -> Search all search-paths for schematic associated to symbol". Default: not enabled. Variable: search_schematic. If enabled xschem does not assume the schematic is in the same directory of the symbol but looks in all libraries defined in XSCHEM_LIBRARY_PATH for a match.
This commit is contained in:
parent
8f5df31e77
commit
7401f1d8eb
|
|
@ -191,7 +191,26 @@ v {xschem version=2.9.7 file_version=1.2}</kbd>
|
|||
<p>
|
||||
Two attributes are defined, the xschem version and the file format version.
|
||||
Current file format version is 1.2. This string is guaranteed to be the first one in XSCHEM .sch and .sym files.
|
||||
|
||||
A comment can be added (by manually editing the xschem schematic or symbol file) as shown below:
|
||||
</p>
|
||||
<pre class="code">
|
||||
v {xschem version=3.0.0 file_version=1.2
|
||||
* Copyright 2021 Stefan Frederik Schippers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
}
|
||||
</pre>
|
||||
<h3>GLOBAL SCHEMATIC/SYMBOL PROPERTIES</h3>
|
||||
<p>
|
||||
Example:<kbd><br>
|
||||
|
|
|
|||
|
|
@ -1132,7 +1132,6 @@ void symbol_in_new_window(void)
|
|||
|
||||
void schematic_in_new_window(void)
|
||||
{
|
||||
char *sch = NULL;
|
||||
char filename[PATH_MAX];
|
||||
char win_path[WINDOW_PATH_SIZE];
|
||||
rebuild_selected_array();
|
||||
|
|
@ -1156,13 +1155,7 @@ void schematic_in_new_window(void)
|
|||
)
|
||||
) return;
|
||||
|
||||
my_strdup2(1246, &sch, get_tok_value(
|
||||
(xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1247, &sch);
|
||||
if(!filename[0]) {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym);
|
||||
|
||||
if(tclgetvar("tabbed_interface")[0] == '1') {
|
||||
if(!check_loaded(filename, win_path)) {
|
||||
|
|
@ -1201,10 +1194,27 @@ void launcher(void)
|
|||
}
|
||||
}
|
||||
|
||||
void get_sch_from_sym(char *filename, xSymbol *sym)
|
||||
{
|
||||
char *sch = NULL;
|
||||
const char *str_tmp;
|
||||
|
||||
if((str_tmp = get_tok_value(sym->prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strdup2(1252, &sch, str_tmp);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), PATH_MAX);
|
||||
my_free(1253, &sch);
|
||||
} else {
|
||||
if(tclgetboolvar("search_schematic")) {
|
||||
my_strncpy(filename, abs_sym_path(sym->name, ".sch"), PATH_MAX);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(sym->name, ""), ".sch"), PATH_MAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void descend_schematic(int instnumber)
|
||||
{
|
||||
const char *str;
|
||||
char *sch = NULL;
|
||||
char filename[PATH_MAX];
|
||||
int inst_mult, inst_number;
|
||||
int save_ok = 0;
|
||||
|
|
@ -1313,18 +1323,11 @@ void descend_schematic(int instnumber)
|
|||
xctx->currsch++;
|
||||
hilight_child_pins();
|
||||
|
||||
my_strdup2(1244, &sch,
|
||||
get_tok_value((xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1245, &sch);
|
||||
get_sch_from_sym(filename, xctx->inst[xctx->sel_array[0].n].ptr+ xctx->sym);
|
||||
unselect_all();
|
||||
remove_symbols();
|
||||
if(filename[0]) {
|
||||
load_schematic(1,filename, 1);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->inst[xctx->sel_array[0].n].name, ""), ".sch"), S(filename));
|
||||
load_schematic(1, filename, 1);
|
||||
}
|
||||
load_schematic(1,filename, 1);
|
||||
|
||||
if(xctx->hilight_nets)
|
||||
{
|
||||
prepare_netlist_structs(0);
|
||||
|
|
|
|||
|
|
@ -1065,19 +1065,13 @@ int sym_vs_sch_pins()
|
|||
int endfile;
|
||||
char tag[1];
|
||||
char filename[PATH_MAX];
|
||||
char *sch = NULL;
|
||||
n_syms = xctx->symbols;
|
||||
for(i=0;i<n_syms;i++)
|
||||
{
|
||||
if( xctx->sym[i].type && !strcmp(xctx->sym[i].type,"subcircuit")) {
|
||||
rects = xctx->sym[i].rects[PINLAYER];
|
||||
|
||||
my_strdup2(1248, &sch, get_tok_value(xctx->sym[i].prop_ptr, "schematic", 0));
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1249, &sch);
|
||||
if(!filename[0]) {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->sym + i);
|
||||
if(!stat(filename, &buf)) {
|
||||
fd = fopen(filename, "r");
|
||||
pin_cnt = 0;
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ void hier_psprint(void) /* netlister driver */
|
|||
char *subckt_name;
|
||||
char filename[PATH_MAX];
|
||||
char *abs_path = NULL;
|
||||
const char *str_tmp;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!ps_draw(1)) return; /* prolog */
|
||||
xctx->push_undo();
|
||||
|
|
@ -63,13 +61,7 @@ void hier_psprint(void) /* netlister driver */
|
|||
if (str_hash_lookup(subckt_table, subckt_name, "", XLOOKUP)==NULL)
|
||||
{
|
||||
str_hash_lookup(subckt_table, subckt_name, "", XINSERT);
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strdup2(1252, &sch, str_tmp);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1253, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->sym + i);
|
||||
/* for printing we go down to bottom regardless of spice_stop attribute */
|
||||
load_schematic(1,filename, 0);
|
||||
zoom_full(0, 0, 1, 0.97);
|
||||
|
|
@ -482,11 +474,9 @@ void spice_block_netlist(FILE *fd, int i)
|
|||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
char filename[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
/* int j; */
|
||||
/* int multip; */
|
||||
char *extra=NULL;
|
||||
char *sch = NULL;
|
||||
int split_f;
|
||||
|
||||
split_f = tclgetboolvar("split_files");
|
||||
|
|
@ -495,13 +485,7 @@ void spice_block_netlist(FILE *fd, int i)
|
|||
spice_stop=1;
|
||||
else
|
||||
spice_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strdup2(1254, &sch, str_tmp);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1255, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->sym + i);
|
||||
if(split_f) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
|
||||
tclgetvar("netlist_dir"), skip_dir(xctx->sym[i].name), getpid());
|
||||
|
|
|
|||
|
|
@ -77,21 +77,13 @@ static void tedax_block_netlist(FILE *fd, int i)
|
|||
{
|
||||
int tedax_stop=0;
|
||||
char filename[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
char *extra=NULL;
|
||||
char *sch = NULL;
|
||||
|
||||
if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"tedax_stop",0),"true") )
|
||||
tedax_stop=1;
|
||||
else
|
||||
tedax_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strdup2(1256, &sch, str_tmp);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1257, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->sym + i);
|
||||
fprintf(fd, "\n# expanding symbol: %s # of pins=%d\n",
|
||||
xctx->sym[i].name,xctx->sym[i].rects[PINLAYER] );
|
||||
fprintf(fd, "## sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
|
||||
|
|
|
|||
|
|
@ -2783,7 +2783,6 @@ const char *translate(int inst, const char* s)
|
|||
const char *value;
|
||||
int escape=0;
|
||||
char date[200];
|
||||
char *sch = NULL;
|
||||
int sp_prefix;
|
||||
int s_pnetname;
|
||||
int level;
|
||||
|
|
@ -2936,12 +2935,8 @@ const char *translate(int inst, const char* s)
|
|||
my_free(1065, &pin_attr);
|
||||
my_free(1066, &pin_num_or_name);
|
||||
} else if(strcmp(token,"@sch_last_modified")==0) {
|
||||
my_strdup2(1258, &sch, get_tok_value((xctx->inst[inst].ptr + xctx->sym)->prop_ptr, "schematic",0 ));
|
||||
my_strncpy(file_name, abs_sym_path(sch, ""), S(file_name));
|
||||
my_free(1259, &sch);
|
||||
if(!file_name[0]) {
|
||||
my_strncpy(file_name, add_ext(abs_sym_path(xctx->inst[inst].name, ""), ".sch"), S(file_name));
|
||||
}
|
||||
|
||||
get_sch_from_sym(file_name, xctx->inst[inst].ptr + xctx->sym);
|
||||
if(!stat(file_name , &time_buf)) {
|
||||
tm=localtime(&(time_buf.st_mtime) );
|
||||
tmp=strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", tm);
|
||||
|
|
|
|||
|
|
@ -418,7 +418,6 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
char *sch = NULL;
|
||||
int split_f;
|
||||
|
||||
split_f = tclgetboolvar("split_files");
|
||||
|
|
@ -426,13 +425,7 @@ void verilog_block_netlist(FILE *fd, int i)
|
|||
verilog_stop=1;
|
||||
else
|
||||
verilog_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strdup2(1260, &sch, str_tmp);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1261, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->sym + i);
|
||||
if(split_f) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
|
||||
tclgetvar("netlist_dir"), skip_dir(xctx->sym[i].name), getpid());
|
||||
|
|
|
|||
|
|
@ -510,9 +510,8 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
char netl_filename[PATH_MAX];
|
||||
char tcl_cmd_netlist[PATH_MAX + 100];
|
||||
char cellname[PATH_MAX];
|
||||
const char *str_tmp;
|
||||
char *abs_path = NULL;
|
||||
char *sch = NULL;
|
||||
const char *str_tmp;
|
||||
int split_f;
|
||||
|
||||
split_f = tclgetboolvar("split_files");
|
||||
|
|
@ -520,13 +519,7 @@ void vhdl_block_netlist(FILE *fd, int i)
|
|||
vhdl_stop=1;
|
||||
else
|
||||
vhdl_stop=0;
|
||||
if((str_tmp = get_tok_value(xctx->sym[i].prop_ptr, "schematic",0 ))[0]) {
|
||||
my_strdup2(1262, &sch, str_tmp);
|
||||
my_strncpy(filename, abs_sym_path(sch, ""), S(filename));
|
||||
my_free(1263, &sch);
|
||||
} else {
|
||||
my_strncpy(filename, add_ext(abs_sym_path(xctx->sym[i].name, ""), ".sch"), S(filename));
|
||||
}
|
||||
get_sch_from_sym(filename, xctx->sym + i);
|
||||
if(split_f) {
|
||||
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
|
||||
tclgetvar("netlist_dir"), skip_dir(xctx->sym[i].name), getpid());
|
||||
|
|
|
|||
|
|
@ -1212,6 +1212,7 @@ extern void load_ascii_string(char **ptr, 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);
|
||||
extern void get_sch_from_sym(char *filename, xSymbol *sym);
|
||||
extern void descend_schematic(int instnumber);
|
||||
extern void go_back(int confirm);
|
||||
extern void view_unzoom(double z);
|
||||
|
|
|
|||
|
|
@ -4541,8 +4541,8 @@ set tctx::global_list {
|
|||
netlist_type no_change_attrs noprint_libs old_selected_tok
|
||||
only_probes path pathlist persistent_command preserve_unchanged_attrs prev_symbol ps_colors rainbow_colors
|
||||
rawfile_loaded rcode recentfile replace_key retval retval_orig rotated_text save_initialfile search_exact
|
||||
search_found search_select search_value selected_tok show_hidden_texts show_infowindow show_pin_net_names
|
||||
simconf_default_geometry simconf_vpos
|
||||
search_found search_schematic search_select search_value selected_tok show_hidden_texts show_infowindow
|
||||
show_pin_net_names simconf_default_geometry simconf_vpos
|
||||
spiceprefix split_files svg_colors svg_font_name symbol symbol_width sym_txt tclcmd_txt tclstop
|
||||
text_line_default_geometry textwindow_fileid textwindow_filename textwindow_w tmp_bus_char
|
||||
toolbar_horiz toolbar_visible top_subckt transparent_svg undo_type
|
||||
|
|
@ -5099,6 +5099,8 @@ proc build_widgets { {topwin {} } } {
|
|||
-command "xschem print_hilight_net 2" -accelerator Alt-Shift-J
|
||||
$topwin.menubar.sym.menu add command -label "Create pins from highlight nets" \
|
||||
-command "xschem print_hilight_net 0" -accelerator Ctrl-J
|
||||
$topwin.menubar.sym.menu add checkbutton \
|
||||
-label "Search all search-paths for schematic associated to symbol" -variable search_schematic
|
||||
$topwin.menubar.sym.menu add checkbutton -label "Allow duplicated instance names (refdes)" \
|
||||
-variable disable_unique_names
|
||||
$topwin.menubar.tools.menu add checkbutton -label "Remember last command" -variable persistent_command
|
||||
|
|
@ -5489,6 +5491,7 @@ set_ne hide_empty_graphs 0 ;# if set to 1 waveform boxes will be hidden if no ra
|
|||
set_ne spiceprefix 1
|
||||
set_ne verilog_2001 1
|
||||
set_ne verilog_bitblast 0
|
||||
set_ne search_schematic 0
|
||||
set_ne split_files 0
|
||||
set_ne flat_netlist 0
|
||||
set_ne netlist_show 0
|
||||
|
|
|
|||
|
|
@ -171,6 +171,15 @@
|
|||
#### enable to scale grid point size as done with lines at close zoom, default: 0
|
||||
# set big_grid_points 0
|
||||
|
||||
#### enable grouping contiguous bits of bus slices in net->pin instance
|
||||
#### assignments for verilog netlists. Default: disabled (0)
|
||||
# set verilog_bitblast 0
|
||||
|
||||
#### allow searching the full search path for schematics associated to symbols
|
||||
#### instead of looking only in symbol directory. Default: disabled (0).
|
||||
# set search_schematic 0
|
||||
|
||||
|
||||
###########################################################################
|
||||
#### EXPORT FORMAT TRANSLATORS, PNG AND PDF
|
||||
###########################################################################
|
||||
|
|
|
|||
|
|
@ -480,4 +480,3 @@ descr="View Raw file"
|
|||
tclcommand="textwindow $netlist_dir/[file tail [file rootname [ xschem get schname 0 ] ] ].raw"
|
||||
}
|
||||
C {spice_probe.sym} 790 -600 0 0 {name=p60 analysis=tran voltage=-0.1364}
|
||||
C {title-2.sym} -270 490 0 0 {name=l3 author="Stefan Schippers" rev=1.0 lock=true}
|
||||
|
|
|
|||
Loading…
Reference in New Issue