diff options
author | Jillian Ye <jillian@cygnus> | 1998-05-20 22:14:16 +0000 |
---|---|---|
committer | Jillian Ye <jillian@cygnus> | 1998-05-20 22:14:16 +0000 |
commit | e0459470a9e3922839fb542d258f4a09d9bea28d (patch) | |
tree | 89734a9d80ac4698e52ec481fa349e9b6de2994d /sim | |
parent | 116b98b89ab999090be68eb5bf20958399757a21 (diff) | |
download | fsf-binutils-gdb-e0459470a9e3922839fb542d258f4a09d9bea28d.zip fsf-binutils-gdb-e0459470a9e3922839fb542d258f4a09d9bea28d.tar.gz fsf-binutils-gdb-e0459470a9e3922839fb542d258f4a09d9bea28d.tar.bz2 |
c_gen.pl: Added subroutine "print_comment"
and on/off option for "src line #"
Diffstat (limited to 'sim')
-rw-r--r-- | sim/testsuite/sky/ChangeLog | 7 | ||||
-rwxr-xr-x | sim/testsuite/sky/c_gen.pl | 78 |
2 files changed, 57 insertions, 28 deletions
diff --git a/sim/testsuite/sky/ChangeLog b/sim/testsuite/sky/ChangeLog index 5a6ab79..e887c2f 100644 --- a/sim/testsuite/sky/ChangeLog +++ b/sim/testsuite/sky/ChangeLog @@ -1,8 +1,13 @@ +Wed May 20 18:10:28 1998 Jillian Ye <jillian@cygnus.com> + + * c_gen.pl: Added subroutine "print_comment" + and on/off option for "src line #" + Wed Apr 29 8:44:31 1998 Ron Unrau <runrau@cygnus.com> * rw-vureg.c: test VU register read/writes through aliased memory -Tue Apr 28 20:16:02 EDT 1998 Jillian Ye <jillian@cygnus.com> +Tue Apr 28 20:16:02 1998 Jillian Ye <jillian@cygnus.com> * sce*test*_out_gif.dat: change the last line of the files to be "7f 00000000 00000000". diff --git a/sim/testsuite/sky/c_gen.pl b/sim/testsuite/sky/c_gen.pl index 5a7e267..ce002d5 100755 --- a/sim/testsuite/sky/c_gen.pl +++ b/sim/testsuite/sky/c_gen.pl @@ -6,7 +6,7 @@ # c test-program to help testing PKE/GIF, etc. # # To Invoke: -# c_gen <input_data_file> <output_c_file> +# c_gen <input_data_file> <output_c_file> < src line # option: default off > # # Expected input format: # <first column> <second_column> <third column> <forth column> @@ -18,7 +18,9 @@ # ~ (reg wrt 64) 0xH (addr) 0xHigh_Low (data) # % (reg read 64) 0xH (addr) 0xHigh_Low (data) # @ (read only) 0xH (addr) 4/8 -# # comment line +# # comment line (for the c source code) +# C comment line (for the c executable output - via printf) +# # Note: n can be 0 (for VU1), 1 (for VU2), or 2 (for GIF). # H, High, or Low is hex data in the format of FFFFFFFF # @@ -35,18 +37,24 @@ ###################### $numargs = @ARGV; -if ( $numargs == 2 ) { - $infile_name = $ARGV[0]; - $outfile_name = $ARGV[1]; -} -elsif ( $numargs == 1) +if ( $numargs < 1 ) { - $infile_name = $ARGV[0]; - $outfile_name = "default.c" + die ("Usage: c_gen <input_data_file_name> <output_c_file_name> <src line # option: default off> \n"); } -else -{ - die ("Usage: c_gen <input_data_file_name> <output_c_file_name>\n"); +else +{ + $line_number_option = "off"; + $outfile_name = "default.c"; + + $infile_name = $ARGV[0]; + if ( $numargs > 1 ) + { + $outfile_name = $ARGV[1]; + if ( $numargs > 2 ) + { + $line_number_option = $ARGV[2]; + } + } } # Header containing SCEI system addresses @@ -71,11 +79,19 @@ while( $inputline = <INFILE> ) chop($inputline); # get rid of the new line char; $current_line_number ++; - print OUTFILE ("/* #line \"$infile_name\" $current_line_number */\n"); - if ($inputline =~ /^\#/ ) # A line starts with "#" is a comment + if ($line_number_option =~ /on/i ) + { + print OUTFILE ("\n /* \"$infile_name\" line $current_line_number\: */\n"); + } + + if ($inputline =~ /^\#/ ) # A line starts with "#" is a comment for the C source code { &process_comment; - } + } + elsif ($inputline =~ /^\C/ ) # A line starts with "#" is a comment to be printed by the C executable + { + &print_comment; + } elsif ( $inputline =~ /^[01234]/ ) # This is a data line { &process_data; @@ -126,9 +142,17 @@ sub process_comment { print OUTFILE ("/*".$inputline."*/\n"); } + +sub print_comment { + $inputline =~ s/^\C//; +# print OUTFILE ("/* Print comment: ".$inputline."*/\n"); + print OUTFILE (" printf \( \"\%s\\n\", \"\# $inputline\" \); \n"); +} + + sub process_data { - print OUTFILE ("/*****************************************************************/\n"); - print OUTFILE ("/* Assign a quadword: */\n"); + print OUTFILE (" /*****************************************************************/\n"); + print OUTFILE (" /* Assign a quadword: */\n"); @columns = split ( /[\s]+/, $inputline ); $data_count = @columns; @@ -183,8 +207,8 @@ sub process_data { sub process_data_reg32 { print OUTFILE ("\n"); - print OUTFILE ("/******************************************************************/\n"); - print OUTFILE ("/*Writing the specified data into the specified address: */\n\n"); + print OUTFILE (" /******************************************************************/\n"); + print OUTFILE (" /*Writing the specified data into the specified address: */\n"); @columns = split ( /[\s]+/, $inputline ); @@ -200,8 +224,8 @@ sub process_data_reg32 { sub process_data_reg64 { print OUTFILE ("\n"); - print OUTFILE ("/******************************************************************/\n"); - print OUTFILE ("/*Writing the specified 64-bit data into the specified address: */\n\n"); + print OUTFILE (" /******************************************************************/\n"); + print OUTFILE (" /*Writing the specified 64-bit data into the specified address: */\n"); @columns = split ( /[\s]+/, $inputline ); @@ -219,8 +243,8 @@ sub process_data_reg64 { sub perform_test32 { print OUTFILE ("\n"); - print OUTFILE ("/******************************************************************/\n"); - print OUTFILE ("/*Verify the data in the specified address with the input value: */\n\n"); + print OUTFILE (" /******************************************************************/\n"); + print OUTFILE (" /*Verify the data in the specified address with the input value: */\n"); @columns = split ( /[\s]+/, $inputline ); @@ -243,8 +267,8 @@ sub perform_test32 { sub perform_test64 { print OUTFILE ("\n"); - print OUTFILE ("/******************************************************************/\n"); - print OUTFILE ("/*Verify the data in the specified address with the input value: */\n\n"); + print OUTFILE (" /******************************************************************/\n"); + print OUTFILE (" /*Verify the data in the specified address with the input value: */\n"); @columns = split ( /[\s]+/, $inputline ); @@ -267,8 +291,8 @@ sub perform_test64 { sub perform_test_read_only { print OUTFILE ("\n"); - print OUTFILE ("/******************************************************************/\n"); - print OUTFILE ("/*Just trying to read data from the specified address: */\n\n"); + print OUTFILE (" /******************************************************************/\n"); + print OUTFILE (" /*Just trying to read data from the specified address: */\n"); @columns = split ( /[\s]+/, $inputline ); |