proc is_xschem_file: if symbol contains instances of "logo" or "launcher" type do not consider it as a schematic. add "xschem get_sym_type" command
This commit is contained in:
parent
3efe7bfbec
commit
1a898f63ef
|
|
@ -899,6 +899,10 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
<li><kbd> get_sch_from_sym inst [symbol]</kbd></li><pre>
|
||||
get schematic associated with instance 'inst'
|
||||
if inst==-1 and a 'symbol' name is given get sch associated with symbol </pre>
|
||||
<li><kbd> get_sym_type symname</kbd></li><pre>
|
||||
get "type" value from global attributes of symbol,
|
||||
looking frst in loaded symbols, then looking in symbol file
|
||||
symbols that are not already loaded in the design will not be loaded </pre>
|
||||
<li><kbd> get_tok str tok [with_quotes]</kbd></li><pre>
|
||||
get value of token 'tok' in string 'str'
|
||||
'with_quotes' (default:0) is an integer passed to get_tok_value() </pre>
|
||||
|
|
|
|||
|
|
@ -3909,7 +3909,7 @@ void pop_undo(int redo, int set_modify_status)
|
|||
* return symbol type in type pointer or "" if no type or no symbol found
|
||||
* if pintable given (!=NULL) hash all symbol pins
|
||||
* if embed_fd is not NULL read symbol from embedded '[...]' tags using embed_fd file pointer */
|
||||
static void get_sym_type(const char *symname, char **type,
|
||||
void get_sym_type(const char *symname, char **type,
|
||||
Int_hashtable *pintable, FILE *embed_fd, int *sym_n_pins)
|
||||
{
|
||||
int i, c, n = 0;
|
||||
|
|
|
|||
|
|
@ -2066,6 +2066,22 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_SetResult(interp, filename, TCL_VOLATILE);
|
||||
}
|
||||
|
||||
/* get_sym_type symname
|
||||
* get "type" value from global attributes of symbol,
|
||||
* looking frst in loaded symbols, then looking in symbol file
|
||||
* symbols that are not already loaded in the design will not be loaded */
|
||||
else if(!strcmp(argv[1], "get_sym_type") )
|
||||
{
|
||||
char *s=NULL;
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
|
||||
if(argc < 3) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;}
|
||||
get_sym_type(argv[2], &s, NULL, NULL, NULL);
|
||||
|
||||
Tcl_SetResult(interp, s, TCL_VOLATILE);
|
||||
my_free(_ALLOC_ID_, &s);
|
||||
}
|
||||
|
||||
/* get_tok str tok [with_quotes]
|
||||
* get value of token 'tok' in string 'str'
|
||||
* 'with_quotes' (default:0) is an integer passed to get_tok_value() */
|
||||
|
|
|
|||
|
|
@ -1512,6 +1512,8 @@ extern int spectre_block_netlist(FILE *fd, int i, int alert);
|
|||
extern void remove_symbols(void);
|
||||
extern void remove_symbol(int i);
|
||||
extern void clear_drawing(void);
|
||||
extern void get_sym_type(const char *symname, char **type,
|
||||
Int_hashtable *pintable, FILE *embed_fd, int *sym_n_pins);
|
||||
extern int is_from_web(const char *f);
|
||||
extern int load_sym_def(const char name[], FILE *embed_fd);
|
||||
extern int descend_symbol(void);
|
||||
|
|
|
|||
|
|
@ -4069,10 +4069,18 @@ proc is_xschem_file {f} {
|
|||
set generator 1
|
||||
# continue
|
||||
}
|
||||
if { [regexp {^[TKGVSE] \{} $line] } { incr score }
|
||||
if { [regexp {^[TKFGVSE] \{} $line] } { incr score }
|
||||
if { [regexp {^[BL] +[0-9]+ +[-0-9.eE]+ +[-0-9.eE]+ +[-0-9.eE]+ +[-0-9.eE]+ +\{} $line] } {incr score}
|
||||
if { [regexp {^N +[-0-9.eE]+ +[-0-9.eE]+ +[-0-9.eE]+ +[-0-9.eE]+ +\{} $line] } {incr score}
|
||||
if { [regexp {^C +\{[^{}]+\} +[-0-9.eE]+ +[-0-9.eE]+ +[0-3]+ +[0-3]+ +\{} $line] } {incr instances; incr score}
|
||||
if { [regexp {^C +\{[^{}]+\} +[-0-9.eE]+ +[-0-9.eE]+ +[0-3]+ +[0-3]+ +\{} $line] } {
|
||||
set symname [regsub {([^{]+{)([^}]+)(}.*)} $line {\2}]
|
||||
set type [xschem get_sym_type $symname]
|
||||
# title/launcher instances in symbols are allowed, do not indicate it is a schematic.
|
||||
if {![regexp "^(logo|launcher)$" $type]} {
|
||||
incr instances
|
||||
incr score
|
||||
}
|
||||
}
|
||||
if { [regexp "^v\[ \t\]+\{xschem\[ \t\]+version\[ \t\]*=.*\[ \t\]+file_version\[ \t\]*=" $line] } {
|
||||
set ret 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue