#/bin/csh # Test the CPU simulation on a given set of inputs. # Usage: # trycpu vvp_file prefix # trycpu prefix (assumes that "cpu.vvp" is the vvp file to execute) # The existence of files whose names start with prefix and end in ".text" # and ".data" is assumed; these files are copied into "text.dat" and # "data.dat" respectively. Once the program finishes, the contents of # files "dump.dat" and concat (prefix, ".data") are compared. # For example, if prefix is "lw.sw.test", then the file "lw.sw.test.text" # will be copied to "text.dat", the file "lw.sw.test.data" will be copied # to "data.dat", and the file "lw.sw.test.dump" will be compared with # "dump.dat" when the simulation terminates. if ($#argv == 0 || $#argv > 2) then echo "*** Wrong number of arguments." echo "*** Usage:" echo "*** trycpu vvp_file prefix" echo "*** trycpu prefix" exit 1 endif set infile=cpu.vvp if ($#argv == 2) then set infile=$1 shift endif if (! -e $infile) then echo "*** vvp file missing: " $infile exit 1 else if (! -e $1.text) then echo "*** text file missing: " $1.text exit 1 else if (! -e $1.data) then echo "*** data file missing: " $1.data exit 1 else if (! -e $1.dump) then echo "*** dump file missing: " $1.dump exit 1 endif cp $1.text text.dat cp $1.data data.dat vvp $infile diff $1.dump dump.dat > /dev/null if ($status == 0) then echo "dump.dat matches $1.dump" else echo "*** Mismatch between dump.dat and $1.dump." echo "*** Use" echo "*** diff dump.dat $1.dump" echo "*** to show differences." endif