head 1.1; access; symbols; locks; strict; comment @# @; 1.1 date 2008.08.25.00.39.48; author sfielding; state Exp; branches; next ; commitid 118148b1fdaa4567; desc @@ 1.1 log @usbHostSlave - Release 2.0. Seperate host and slave top level modules, in addition the original combined host/slave. Improved cross clock domain synchronisation. Fixed wishbone ack bug. Improved fifo reset synchronisation. Added registers to support USB-PHY, ie USB voltage detect, pull-up enable, and full/low speed selection. Removed Altera SOPC component, removed SystemC testbench, and Aldec simulation. Added Icarus Verilog simulation. Added usbDevice sub-project @ text @#!/usr/bin/perl -w # # # USAGE: perl verilogCopy.pl [-i ] [-o ] # -i : Verilog input file # -0 : Verilog output file # example: perl verilogCopy.pl -i inFileName -o outFileName # # Release notes: # 0.1 initial release use strict; use sigtrap; use Getopt::Std; use constant TIMESTAMP => scalar localtime; use Socket; use FileHandle; use File::stat; my %options = (); getopts( "o:i:t:",\%options ); my $gRespStr = ""; my @@inFile; my $filename; my $myFileAsString; our $outFile = new FileHandle; our $inFileSt; our $outFileSt; my $version = "verilogCopy "; #print( "$version\n" ); # --- open Verilog input file if (defined $options{i} ) { $inFileSt = stat($options{i}) or die "Can't stat $options{i}: $!"; #print ("\n in File mtime = "); #print $inFileSt->mtime; #print ("\n"); } else { print ("Input file name missing. Use -i \n"); exit 1; } # --- open verilog output file if (defined $options{o} ) { $outFileSt = stat($options{o}) or die "Can't stat $options{o}: $!"; #print ("\n out File mtime = "); #print $outFileSt->mtime; #print ("\n"); } else { print ("Output file name missing. Use -o \n"); exit 1; } $/ = undef; if ($outFileSt->mtime < $inFileSt->mtime) { @@inFile = glob( $options{i} ); $outFile->open(">$options{o}") or die("Cannot open write file!\n"); slurpFile(\$myFileAsString, $inFile[0] ); parseInputFile(\$myFileAsString); patchFile(\$myFileAsString, $inFile[0] ); $outFile->print("$myFileAsString"); $outFile->close(); print( "\"$options{i}\" has been processed and copied to \"$options{o}\".\n" ); } else { print ("Input file older than output file. No update required\n"); } #---------------------------------- slurpFile -------------------------------------------# sub slurpFile { my $fileAsString = shift(); my $filename = shift(); my $read = new FileHandle; # The input file $read->open( $filename ) or print( "Cannot open $filename for reading!\n" ) and return(0); $$fileAsString = $read->getline(); # Read in the entire file as a list $read->close() or die( "Cannot close $_!\n" ); return(1); } #---------------------------------- parseInputFile -------------------------------------------# sub parseInputFile { my $fileAsString = shift(); $$fileAsString =~ s/! =/!=/gs; #patch ActiveHDL 4.2 FSM2HDL bug $$fileAsString =~ s/ = / <= /gs; #patch ActiveHDL 4.2 FSM2HDL bug $$fileAsString =~ s/\r//gs; #delete DOS carriage returns $$fileAsString =~ s/\t/ /gs; #replace tabs with two spaces } #---------------------------------- patchFile -------------------------------------------# sub patchFile { my $fileAsString = shift(); my $filename = shift(); if ($filename =~ /spiCtrl.v/) { unless( $$fileAsString =~ s/\(spiTransCtrl or rxDataRdy/\(spiTransCtrl or rxDataRdy or spiTransType/ ) {print "-------- ERROR, patch failed \n"; exit;} print ("--Patched $filename\n"); } if ($filename =~ /readWriteSDBlock.v/) { unless( $$fileAsString =~ s/\(blockAddr or sendCmdRdy/\(blockAddr or sendCmdRdy or respTout or respByte/ ) {print "-------- ERROR, patch failed \n"; exit;} print ("--Patched $filename\n"); } if ($filename =~ /tx_pkt_sched.v/) { unless( $$fileAsString =~ s/\(buffLoadGnt or buffUnLoadGnt/\(buffLoadGnt or buffUnLoadGnt or txBufferLoaded/ ) {print "-------- ERROR, patch failed \n"; exit;} print ("--Patched $filename\n"); } } @