# n (for data) 0xH_H_H_H 0xH 4-CHARs
# ? (for test) 0xH (addr) 0xH (value) 0xH (mask)
# ! (reg wrt 32) 0xH (addr) 0xH (data)
-# ~ (reg wrt 64) 0xH (addr) 0xHigh_Low (data)
+# ~ (reg wrt 64) 0xH (addr) 0xHigh_Low (data)
+# % (reg read 64) 0xH (addr) 0xHigh_Low (data)
+# @ (read only) 0xH (addr) 4/8
# # comment line
# 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
{
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
{
&process_comment;
}
- elsif ( $inputline =~ /^\?/ ) # A line starts with "?" is a verification request
- {
- &perform_test;
- }
- elsif ( $inputline =~ /^[012]/ ) # This is a data line
+ elsif ( $inputline =~ /^[01234]/ ) # This is a data line
{
&process_data;
}
elsif ( $inputline =~ /^\~/ ) # This is a 64-bit register write
{
&process_data_reg64;
- }
+ }
+ elsif ( $inputline =~ /^\?/ ) # A line starts with "?" is a 32bit read/verification request
+ {
+ &perform_test32;
+ }
+ elsif ( $inputline =~ /^\%/ ) # A line starts with "%" is a 64bit read/verification request
+ {
+ &perform_test64;
+ }
+ elsif ( $inputline =~ /^\@/ ) # A line starts with "@" is a read only test request
+ {
+ &perform_test_read_only;
+ }
else # ignore this input
{
print OUTFILE ("\n");
print OUTFILE ("/*".$inputline."*/\n");
}
-sub perform_test {
- print OUTFILE ("\n");
- print OUTFILE ("/******************************************************************/\n");
- print OUTFILE ("/*Verify the data in the specified address with the input value: */\n\n");
-
- @columns = split ( /[\s]+/, $inputline );
-
- #column[1] is the address;
- #column[2] is the value, in the format of oxH;
- #column[3] is the mask, in the format of oxH;
-
- print OUTFILE ("\n{\n");
- print OUTFILE (" volatile unsigned* test_ptr = \(unsigned *\)".$columns[1].";\n");
- print OUTFILE (" unsigned test_data = *test_ptr;\n");
- print OUTFILE (" if \( \( test_data & $columns[3] \) == $columns[2] \) {\n");
- print OUTFILE (" num_passed ++;\n");
- print OUTFILE (" } else {\n");
- print OUTFILE (" printf \(\"Data Verification (line $current_line_number) failed!\\n\"\); \n" );
- print OUTFILE (" printf \(\"Expecting \%08x mask \%08x in address \%08x but got \%08x !\\n\", $columns[2], $columns[3], $columns[1], test_data\); \n");
- print OUTFILE (" num_failed++;\n");
- print OUTFILE (" }\n}\n");
-
-}
-
sub process_data {
print OUTFILE ("/*****************************************************************/\n");
print OUTFILE ("/* Assign a quadword: */\n");
}
+sub perform_test32 {
+ print OUTFILE ("\n");
+ print OUTFILE ("/******************************************************************/\n");
+ print OUTFILE ("/*Verify the data in the specified address with the input value: */\n\n");
+
+ @columns = split ( /[\s]+/, $inputline );
+
+ #column[1] is the address;
+ #column[2] is the value, in the format of oxH;
+ #column[3] is the mask, in the format of oxH;
+
+ print OUTFILE ("\n{\n");
+ print OUTFILE (" volatile unsigned* test_ptr = \(unsigned *\)".$columns[1].";\n");
+ print OUTFILE (" unsigned test_data = *test_ptr;\n");
+ print OUTFILE (" if \( \( test_data & $columns[3] \) == $columns[2] \) {\n");
+ print OUTFILE (" num_passed ++;\n");
+ print OUTFILE (" } else {\n");
+ print OUTFILE (" printf \(\"Data Verification (line $current_line_number) failed!\\n\"\); \n" );
+ print OUTFILE (" printf \(\"Expecting \%08x mask \%08x in address \%08x but got \%08x !\\n\", $columns[2], $columns[3], $columns[1], test_data\); \n");
+ print OUTFILE (" num_failed++;\n");
+ print OUTFILE (" }\n}\n");
+
+}
+
+sub perform_test64 {
+ print OUTFILE ("\n");
+ print OUTFILE ("/******************************************************************/\n");
+ print OUTFILE ("/*Verify the data in the specified address with the input value: */\n\n");
+
+ @columns = split ( /[\s]+/, $inputline );
+
+ #column[1] is the address;
+ #column[2] is the value, in the format of 0xH_H;
+ @llword = split ("_", $columns[2]);
+
+ print OUTFILE ("\n{\n");
+ print OUTFILE (" volatile long long int* test64_ptr = \(long long int *\)".$columns[1].";\n");
+ print OUTFILE (" long long int test64_data = \(long long\)".$llword[0]." \<\< 32 \| \(long long\)0x".$llword[1].";\n");
+ print OUTFILE (" if \( \( test64_data \) == *test64_ptr \) {\n");
+ print OUTFILE (" num_passed ++;\n");
+ print OUTFILE (" } else {\n");
+ print OUTFILE (" printf \(\"Data Verification (line $current_line_number) failed!\\n\"\); \n" );
+ print OUTFILE (" printf \(\"Expecting \%20s in address \%08x but got \%16x !\\n\", \"$columns[2]\", $columns[1], *test64_ptr\); \n");
+ print OUTFILE (" num_failed++;\n");
+ print OUTFILE (" }\n}\n");
+
+}
+
+sub perform_test_read_only {
+ print OUTFILE ("\n");
+ print OUTFILE ("/******************************************************************/\n");
+ print OUTFILE ("/*Just trying to read data from the specified address: */\n\n");
+
+ @columns = split ( /[\s]+/, $inputline );
+
+ #column[1] is the address;
+ #column[2] is the byte-indicator, which can be 4 or 8;
+
+ if ( $columns[2] =~ /^4/ ) # This is a 4-byte data address
+ { $d_type = " "; }
+ else {
+ $d_type = "long long "; # assuming the input is "8"
+ }
+
+ print OUTFILE ("\n{\n");
+ print OUTFILE (" volatile ".$d_type."int* test_add = \(".$d_type."int *\)".$columns[1].";\n");
+ print OUTFILE (" ".$d_type."int test_data = *test_add;\n");
+ print OUTFILE ("}\n");
+
+}
+
+
#define DATA_ADDR_CONST_1 0x10005000
#define FLAG_ADDR_CONST_1 0x10009060
-/* GIF */
+/* GIF PATH1 */
#define SRC_ADDR_CONST_2 0x1000a010
-#define DATA_ADDR_CONST_2 0x10006000
+#define DATA_ADDR_CONST_2 0x10006020
#define FLAG_ADDR_CONST_2 0x1000a060
+
+/* GIF PATH2 */
+#define SRC_ADDR_CONST_3 0x1000a010
+#define DATA_ADDR_CONST_3 0x10006010
+#define FLAG_ADDR_CONST_3 0x1000a060
+
+/* GIF PATH3 */
+#define SRC_ADDR_CONST_4 0x1000a010
+#define DATA_ADDR_CONST_4 0x10006000
+#define FLAG_ADDR_CONST_4 0x1000a060
");
print OUTFILE ("\n\n");