#!/usr/public/bin/sun4/perl
#
# topcf.pl
#
# Description:  This Perl script converts the output file from
#               the pre-synthesis simulation of the 74LS165 8-Bit Parallel-to
#               Serial Shift Register to HP PCF format.  The PCF file can 
#               be used to perform physical testing with the HP VXI test 
#               system.
#
# Wilson Li
# March 28, 1997
#
#

print "pcf order is P_INPUT, Q7_OUT, DS_PL\n";
print "pcf\n";
print "use timing set LS165_TEST\n";

open(input_file,"<tvout.dat");
while($one_line = <input_file>)
{
	chop $one_line;
	@cur_line = split(/ /,$one_line);

	if ($cur_line[3] == "1") {
		$q7 = "H";
	}
	else
	{
		$q7 = "L";
	}

	if ($cur_line[4] == "1")
	{
		$q7_bar = "H";
	}
	else
	{
		$q7_bar = "L";
	}

	print 
		"\"$cur_line[0] $q7$q7_bar $cur_line[2]$cur_line[1]\"\n";
}
close input_file;

print "end pcf\n";


