do not hash the comments containing absolute paths in xschemtest netlist check, since these vary on different systems
This commit is contained in:
parent
b7af31d38c
commit
95ea920faf
|
|
@ -178,7 +178,7 @@
|
|||
<File Id="XSCHEMHELP" KeyPath="yes" Source="../../src/xschem.help" />
|
||||
</Component>
|
||||
<Component Id="CMPSRCXSCHEMRC">
|
||||
<File Id="XSCHEMRC" KeyPath="yes" Source="../../src/xschemrc" />
|
||||
<File Id="XSCHEMRC" KeyPath="yes" Source="xschemrc" />
|
||||
</Component>
|
||||
<Component Id="CMPSRCXSCHEMTCL">
|
||||
<File Id="XSCHEMTCL" KeyPath="yes" Source="../../src/xschem.tcl" />
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -54,4 +54,7 @@ foreach tc $tcases {
|
|||
close $fd
|
||||
} else {
|
||||
puts "Couldn't open $log_fn to write. Investigate please."
|
||||
}
|
||||
}
|
||||
|
||||
source test_utility.tcl
|
||||
exec $xschem_cmd -q --script xschemtest.tcl > stefan_xschemtest.log 2>@1
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue