diff --git a/XSchemWin/XSchemWix/Product.wxs b/XSchemWin/XSchemWix/Product.wxs
index 41835af0..f33399de 100644
--- a/XSchemWin/XSchemWix/Product.wxs
+++ b/XSchemWin/XSchemWix/Product.wxs
@@ -178,7 +178,7 @@
-
+
diff --git a/src/actions.c b/src/actions.c
index f4b4ea20..3b909cce 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -37,7 +37,7 @@ void here(int i)
* avoid 'birthday problem' collisions use a better hash function, like md5sum
* or sha256sum
*/
-unsigned int hash_file(const char *f)
+unsigned int hash_file(const char *f, int skip_path_lines)
{
FILE *fd;
int n, i;
@@ -47,6 +47,10 @@ unsigned int hash_file(const char *f)
fd = fopen(f, "r"); /* windows won't return \r in the lines and we chop them out anyway in the code */
if(fd) {
while( fgets(line, sizeof(line), fd) ) {
+ /* skip lines of type: '** sch_path: ...' or '-- sch_path: ...' or '// sym_path: ...' */
+ if(skip_path_lines) {
+ if(!strncmp(line+2, " sch_path: ", 11) || !strncmp(line+2, " sym_path: ", 11) ) continue;
+ }
n = strlen(line);
for(i = 0; i < n; i++) {
/* skip CRs so hashes will match on unix / windows */
diff --git a/src/scheduler.c b/src/scheduler.c
index 984e7fb2..1e420f56 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -1139,7 +1139,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
char s[40];
cmd_found = 1;
if(argc > 2) {
- h = hash_file(argv[2]);
+ if(argc > 3) {
+ h = hash_file(argv[2], atoi(argv[3]));
+ } else {
+ h = hash_file(argv[2], 0);
+ }
my_snprintf(s, S(s), "%u", h);
Tcl_SetResult(interp, s, TCL_VOLATILE);
}
diff --git a/src/spice_netlist.c b/src/spice_netlist.c
index c777b816..b9482e35 100644
--- a/src/spice_netlist.c
+++ b/src/spice_netlist.c
@@ -131,6 +131,7 @@ void global_spice_netlist(int global) /* netlister driver */
tclgetvar("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");
+ fprintf(fd, "** sch_path: %s\n", xctx->sch[xctx->currsch]);
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
@@ -172,7 +173,6 @@ void global_spice_netlist(int global) /* netlister driver */
}
}
top_sub = tclgetboolvar("top_subckt");
-
if(!top_sub) fprintf(fd,"**");
fprintf(fd,".subckt %s", skip_dir( xctx->sch[xctx->currsch]) );
@@ -439,8 +439,8 @@ void spice_block_netlist(FILE *fd, int 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, ""));
- fprintf(fd, "* sch_path: %s\n", filename);
+ fprintf(fd, "** sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
+ fprintf(fd, "** sch_path: %s\n", filename);
fprintf(fd, ".subckt %s ",skip_dir(xctx->sym[i].name));
print_spice_subckt(fd, i);
diff --git a/src/tedax_netlist.c b/src/tedax_netlist.c
index 80e63591..9c4e51f5 100644
--- a/src/tedax_netlist.c
+++ b/src/tedax_netlist.c
@@ -47,6 +47,7 @@ void global_tedax_netlist(int global) /* netlister driver */
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]), getpid());
fd=fopen(netl_filename, "w");
+ fprintf(fd, "## sch_path: %s\n", xctx->sch[xctx->currsch]);
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
@@ -168,8 +169,8 @@ void tedax_block_netlist(FILE *fd, int 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, ""));
- fprintf(fd, "# sch_path: %s\n", filename);
+ fprintf(fd, "## sym_path: %s\n", abs_sym_path(xctx->sym[i].name, ""));
+ fprintf(fd, "## sch_path: %s\n", filename);
fprintf(fd, "begin netlist v1 %s\n",skip_dir(xctx->sym[i].name));
print_tedax_subckt(fd, i);
diff --git a/src/verilog_netlist.c b/src/verilog_netlist.c
index ee83cea7..4ea2fb32 100644
--- a/src/verilog_netlist.c
+++ b/src/verilog_netlist.c
@@ -53,6 +53,7 @@ void global_verilog_netlist(int global) /* netlister driver */
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]),getpid());
fd=fopen(netl_filename, "w");
+ fprintf(fd, "// sch_path: %s\n", xctx->sch[xctx->currsch]);
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c
index 7079fdb8..72ef1c5b 100644
--- a/src/vhdl_netlist.c
+++ b/src/vhdl_netlist.c
@@ -55,6 +55,7 @@ void global_vhdl_netlist(int global) /* netlister driver */
tclgetvar("netlist_dir"), skip_dir(xctx->sch[xctx->currsch]), getpid());
fd=fopen(netl_filename, "w");
+ fprintf(fd, "-- sch_path: %s\n", xctx->sch[xctx->currsch]);
if(xctx->netlist_name[0]) {
my_snprintf(cellname, S(cellname), "%s", get_cell_w_ext(xctx->netlist_name, 0));
diff --git a/src/xschem.h b/src/xschem.h
index 1a32400a..620cda2e 100644
--- a/src/xschem.h
+++ b/src/xschem.h
@@ -887,7 +887,7 @@ extern void set_grid(double);
extern void create_plot_cmd(void);
extern void set_modify(int mod);
extern void dbg(int level, char *fmt, ...);
-extern unsigned int hash_file(const char *f);
+extern unsigned int hash_file(const char *f, int skip_path_lines);
extern void here(int i);
extern void print_version(void);
extern int set_netlist_dir(int force, char *dir);
diff --git a/src/xschem.tcl b/src/xschem.tcl
index 44634e78..652fbc99 100644
--- a/src/xschem.tcl
+++ b/src/xschem.tcl
@@ -143,11 +143,12 @@ proc execute {status args} {
proc netlist {source_file show netlist_file} {
global XSCHEM_SHAREDIR flat_netlist hspice_netlist netlist_dir
- global verilog_2001 debug_var
+ global verilog_2001 debug_var OS
simuldir
set netlist_type [xschem get netlist_type]
if {$debug_var <= -1} { puts "netlist: source_file=$source_file, netlist_type=$netlist_type" }
+ set dest $netlist_dir/$netlist_file
if {$netlist_type eq {spice}} {
if { $hspice_netlist == 1 } {
set simulator {-hspice}
@@ -159,45 +160,46 @@ proc netlist {source_file show netlist_file} {
} else {
set xyce {}
}
+ set cmd ${XSCHEM_SHAREDIR}/spice.awk
+ set brk ${XSCHEM_SHAREDIR}/break.awk
+ set flatten ${XSCHEM_SHAREDIR}/flatten.awk
if {$flat_netlist==0} {
- eval exec {awk -f ${XSCHEM_SHAREDIR}/spice.awk -- $simulator $xyce $source_file | \
- awk -f ${XSCHEM_SHAREDIR}/break.awk \
- > $netlist_dir/$netlist_file}
+ eval exec {awk -f $cmd -- $simulator $xyce $source_file | awk -f $brk > $dest}
} else {
- eval exec {awk -f ${XSCHEM_SHAREDIR}/spice.awk -- $simulator $xyce $source_file | \
- awk -f ${XSCHEM_SHAREDIR}/flatten.awk | awk -f ${XSCHEM_SHAREDIR}/break.awk > $netlist_dir/$netlist_file}
+ eval exec {awk -f $cmd -- $simulator $xyce $source_file | awk -f $flatten | awk -f $brk > $dest}
}
if ![string compare $show "show"] {
- textwindow $netlist_dir/$netlist_file
+ textwindow $dest
}
}
if {$netlist_type eq {vhdl}} {
- eval exec {awk -f $XSCHEM_SHAREDIR/vhdl.awk $source_file > $netlist_dir/$netlist_file}
+ set cmd $XSCHEM_SHAREDIR/vhdl.awk
+ eval exec {awk -f $cmd $source_file > $dest}
if ![string compare $show "show"] {
- textwindow $netlist_dir/$netlist_file
+ textwindow $dest
}
}
if {$netlist_type eq {tedax}} {
- if {[catch {eval exec {awk -f $XSCHEM_SHAREDIR/tedax.awk $source_file | awk -f $XSCHEM_SHAREDIR/flatten_tedax.awk \
- > $netlist_dir/$netlist_file} } err] } {
+ set cmd1 $XSCHEM_SHAREDIR/tedax.awk
+ set cmd2 $XSCHEM_SHAREDIR/flatten_tedax.awk
+ if {[catch {eval exec {awk -f $cmd1 $source_file | awk -f $cmd2 > $dest} } err] } {
puts stderr "tEDAx errors: $err"
}
if ![string compare $show "show"] {
- textwindow $netlist_dir/$netlist_file
+ textwindow $dest
}
}
if {$netlist_type eq {verilog}} {
- eval exec {awk -f ${XSCHEM_SHAREDIR}/verilog.awk $source_file \
- > $netlist_dir/$netlist_file}
-
- # 20140409
+ set cmd ${XSCHEM_SHAREDIR}/verilog.awk
+ eval exec {awk -f $cmd $source_file > $dest}
if { $verilog_2001==1 } {
- set vv [pid]
- eval exec {awk -f ${XSCHEM_SHAREDIR}/convert_to_verilog2001.awk $netlist_dir/$netlist_file > $netlist_dir/${netlist_file}$vv}
- eval exec {mv $netlist_dir/${netlist_file}$vv $netlist_dir/$netlist_file}
+ set cmd ${XSCHEM_SHAREDIR}/convert_to_verilog2001.awk
+ set interm ${dest}[pid]
+ eval exec {awk -f $cmd $dest > $interm}
+ file rename -force $interm $dest
}
if ![string compare $show "show"] {
- textwindow "$netlist_dir/$netlist_file"
+ textwindow "$dest"
}
}
return {}
diff --git a/tests/netlisting.tcl b/tests/netlisting.tcl
index 8e83404e..a54b586b 100644
--- a/tests/netlisting.tcl
+++ b/tests/netlisting.tcl
@@ -77,8 +77,8 @@ proc run_xschem_netlist {type output_dir fn fpath} {
if {$type eq "vhdl"} {set opt V}
if {$type eq "v"} {set opt w}
if {$type eq "tdx"} {set opt t}
- if {[catch {eval exec {$xschem_cmd $fpath -q -x -r -d 1 -$opt -o $netlist_output_dir -n 2> $output}} msg]} {
- puts "FATAL: $xschem_cmd $fpath -q -x -r -d 1 -$opt -o $netlist_output_dir -n 2> $output : $msg"
+ if {[catch {eval exec {$xschem_cmd $fpath -q -x -r -$opt -o $netlist_output_dir -n 2> $output}} msg]} {
+ puts "FATAL: $xschem_cmd $fpath -q -x -r -$opt -o $netlist_output_dir -n 2> $output : $msg"
incr num_fatals
} else {
lappend pathlist $fn_debug
diff --git a/tests/run_regression.tcl b/tests/run_regression.tcl
index 866ba1f1..bcbbe232 100644
--- a/tests/run_regression.tcl
+++ b/tests/run_regression.tcl
@@ -54,4 +54,7 @@ foreach tc $tcases {
close $fd
} else {
puts "Couldn't open $log_fn to write. Investigate please."
-}
\ No newline at end of file
+}
+
+source test_utility.tcl
+exec $xschem_cmd -q --script xschemtest.tcl > stefan_xschemtest.log 2>@1
diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl
index 66475ade..8ba4c3df 100644
--- a/tests/xschemtest.tcl
+++ b/tests/xschemtest.tcl
@@ -162,12 +162,12 @@ proc test_xschem_simulation {{f simulate_ff.sch}} {
proc netlist_test {} {
global netlist_dir
foreach {f t h} {
- rom8k.sch spice 2198713988
+ rom8k.sch spice 1466291334
greycnt.sch verilog 389394682
autozero_comp.sch spice 2011673313
- loading.sch vhdl 3834408538
+ loading.sch vhdl 3704887277
mos_power_ampli.sch spice 1186348644
- LCC_instances.sch spice 3918341865
+ LCC_instances.sch spice 824427889
simulate_ff.sch spice 1321596936
} {
xschem set netlist_type $t
@@ -176,7 +176,7 @@ proc netlist_test {} {
if {$t eq {verilog}} { set t v}
set netlist_file $netlist_dir/[file rootname $f].$t
## check netlist hashes, compare with gold hashes
- if { [xschem hash_file $netlist_file] == $h } {
+ if { [xschem hash_file $netlist_file 1] == $h } {
puts "$f netlist check OK"
} else {
puts "$f netlist check FAIL"