VU_AVP.h 19.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
/*********************************************************************
 *      Include Files:                                               *
 *
 *
 *   $1.........$25 general purpose
 *   $26 pointer to data memory 
 *   $30 Test number (check this reg when diag Fails)
 *********************************************************************/

#define vco  $v0
#define vcc  $v1
#define vce  $v2

/**********************************************************************
 * Check_Vadd: Used by vadd, vsub, vsut, vabs, vaddc, vsubc
 ********************************************************************/
#define Check_Vadd(tno, Op, rMp, vS, vT, vT_El, vD, vDexp, vTemp, inVCO, expVCO)                                               \
   ori    $30, $0, tno;				\
   ori    $1, $0, inVCO;			\
   ctc2   $1, vco				\
   lqv	  vS, 0(rMp);				\
   lqv	  vT, 16(rMp);				\
   lqv	  vDexp, 32(rMp);			\
   Op     vD, vS, vT_El;			\
   compare_control(vco,expVCO)			\
   ctc2   $0, vco;				\
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 48;     /*S+T+D*/		\
   nop;						\
   nop;						\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)
   /**/

/**********************************************************************
 * Check_Vmov:
 ********************************************************************/
#define Check_Vmov(tno, Op, rMp, vS, vT, vT_El, vD, vDexp, vTemp)                                               \
   ori    $30, $0, tno;				\
   lqv	  vD, 0(rMp);				\
   lqv	  vT, 16(rMp);				\
   lqv	  vDexp, 32(rMp);			\
   Op     vD[vS], vT_El;			\
   addi   rMp, rMp, 48;     /*S+T+D*/		\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)
   /**/

/**********************************************************************
 * Check_Vaddb: Used by vadd, vsub, vsut, vabs, vaddc, vsubc
 ********************************************************************/
#define Check_Vaddb(tno, Op, rMp,vS,vT,vT_El,vD,vDexp,vTemp,vAccl,vAccm,vAcch,vAcclExp,vAccmExp,vAcchExp,v4000,v0001)          \
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   lui	  $1,0x1000				\
   ori	  $1, 0x0000				\
   lqv	  v4000,    0($1);			\
   lqv	  v0001,    16($1);			\
   lqv	  vS, 	    0(rMp);			\
   lqv	  vT,       16(rMp);			\
   lqv	  vDexp,    32(rMp);			\
   lqv	  vAccl,    48(rMp);			\
   lqv	  vAccm,    64(rMp);			\
   lqv	  vAcch,    80(rMp);			\
   lqv	  vAcclExp, 96(rMp);			\
   lqv	  vAccmExp, 112(rMp);			\
   lqv	  vAcchExp, 128(rMp);			\
   init_acc(vAccl,vAccm,vAcch,v4000,v0001,vTemp)\
   nop						\
   nop						\
   Op     vD, vS, vT_El;			\
   nop						\
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 144;     			\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)	\
   get_acc(vAccl,vAccm,vAcch)			\
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   compare_vectors(vTemp,vAccm,vAccmExp,0xffff,0xff)\
   compare_vectors(vTemp,vAcch,vAcchExp,0xffff,0xff)
   /**/
/**********************************************************************
 * Check_Vlog: Used by vand, vnand, vor, vnor, vxor, vxnor
 ********************************************************************/
#define Check_Vlog(tno, Op, rMp, vS, vT, vT_El, vD, vDexp, vTemp) \
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   ctc2   $0, vcc;				\
   lqv	  vS,     0(rMp);			\
   lqv	  vT,    16(rMp);			\
   lqv	  vDexp, 32(rMp);			\
   Op     vD, vS, vT_El;			\
   addi   rMp, rMp, 48;     /*S+T+D*/		\
   nop;						\
   nop;						\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)
   /**/
/**********************************************************************
 * Check_Vsad: Used by sad and sac
 ********************************************************************/
#define Check_Vsad(tno, Op, rMp,vS,vT,vD,vDexp,vTemp,vAccl,vAcclExp,v0001) \
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   lui	  $1,0x1000				\
   ori	  $1, 0x0000				\
   lqv	  v0001,    16($1);			\
   lqv	  vS, 	    0(rMp);			\
   lqv	  vT,       16(rMp);			\
   lqv	  vDexp,    32(rMp);			\
   lqv	  vAccl,    48(rMp);			\
   lqv	  vAcclExp, 64(rMp);			\
   init_acc_low(vAccl,v0001,vTemp)		\
   nop						\
   nop						\
   Op     vD, vS, vT;			        \
   nop						\
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 80;     			\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)	\
   get_acc_low(vAccl)				\
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   /**/
/**********************************************************************
 * Used by sum
 ********************************************************************/
#define Check_Vsum(tno,rMp,vS,vT,vD,vDexp,vTemp,vAccl,vAccm,vAcch,v4000,v0001)\
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   lui	  $1,0x1000				\
   ori	  $1, 0x0000				\
   lqv	  v4000,     0($1);			\
   lqv	  v0001,    16($1);			\
   lqv	  vS,       16($1);			\
   lqv	  vT,       16($1);			\
   /**/						\
   lqv	  vDexp,     0(rMp);			\
   lqv	  vAccl,    16(rMp);			\
   lqv	  vAccm,    32(rMp);			\
   lqv	  vAcch,    48(rMp);			\
   nop						\
   init_acc(vAccl,vAccm,vAcch,v4000,v0001,vTemp)\
   nop						\
   nop						\
   vsum     vD, vS, vT;			        \
   nop						\
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 64;     			\
   compare_vectors(vTemp,vD,vDexp,0xff01,0x0001)\
   nop						\
   /**/
/**********************************************************************
 * Check_Vsaw: Used by saw
 ********************************************************************/
#define Check_Vsaw(tno, rMp,vS,vT,vD,vTemp,vAccl,vAccm,vAcch,v4000,v0001) \
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   lui	  $1,0x1000				\
   ori	  $1, 0x0000				\
   lqv	  v4000,     0($1);			\
   lqv	  v0001,    16($1);			\
   lqv	  vS,       16($1);			\
   lqv	  vT,       16($1);			\
   /**/						\
   lqv	  vAccl,    0(rMp);			\
   lqv	  vAccm,    16(rMp);			\
   lqv	  vAcch,    32(rMp);			\
   nop						\
   init_acc(vAccl,vAccm,vAcch,v4000,v0001,vTemp)\
   nop						\
   nop						\
   vsaw     vD, vS, vT[0];		        \
   vsaw     vS, vS, vT[1];		        \
   vsaw     vT, vT, vT[2];		        \
   nop						\
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 48;     			\
   nop						\
   compare_vectors(vTemp,vD,vAcch,0xffff,0x00ff)\
   compare_vectors(vTemp,vS,vAccm,0xffff,0x00ff)\
   compare_vectors(vTemp,vT,vAccl,0xffff,0x00ff)\
   nop						\
   /**/
/**********************************************************************
 * Check_Vcmp: Used by vlt, veq, vne, vge and vmrg
 ********************************************************************/
#define Check_Vcmp(tno,Op,rMp,vS,vT,vT_El,vD,vDexp,vTemp,inVCO,initVCC,expVCC)\
   ori    $30, $0, tno;				\
   ori    $1, $0, inVCO;			\
   ctc2   $1, vco				\
   nop;						\
   ori    $1, $0, initVCC;			\
   ctc2   $1, vcc				\
   lqv	  vS, 0(rMp);				\
   lqv	  vT, 16(rMp);				\
   lqv	  vDexp, 32(rMp);			\
   Op     vD, vS, vT_El;			\
   nop;						\
   nop;						\
   compare_control(vco,0x0)			\
   compare_control(vcc,expVCC)			\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)  \
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 48;     /*S+T+D*/		\
   nop;						\
   /**/
/**********************************************************************
 * Check_Vcl: Used by vch, vcl and vcr
 ********************************************************************/
#define Check_Vcl(tno,Op,rMp,vS,vT,vT_El,vD,vDexp,vTemp,inVCO,inVCC,inVCE,expVCO,expVCC,expVCE)\
   ori    $30, $0, tno;				\
   ori    $1, $0, inVCO;			\
   ctc2   $1, vco				\
   nop;						\
   ori    $1, $0, inVCC;			\
   ctc2   $1, vcc				\
   nop;						\
   ori    $1, $0, inVCE;			\
   ctc2   $1, vce				\
   lqv	  vS, 0(rMp);				\
   lqv	  vT, 16(rMp);				\
   lqv	  vDexp, 32(rMp);			\
   Op     vD, vS, vT_El;			\
   nop;						\
   nop;						\
   compare_control(vco,expVCO)			\
   compare_control(vcc,expVCC)			\
   compare_control(vce,expVCE)			\
   ctc2   $0, vco				\
   compare_vectors(vTemp,vD,vDexp,0x00ff,0xff)  \
   ctc2   $0, vcc;				\
   ctc2   $0, vco;				\
   ctc2   $0, vce;				\
   addi   rMp, rMp, 48;     /*S+T+D*/		\
   nop;						\
   /**/
/**********************************************************************
 * Check_Vins: Used by inst, insq, insn, extt extq extn
 ********************************************************************/
#define Check_Vins(tno,Op,rMp,vS,vT,vT_El,vD,vDexp,vTemp)\
   ori    $30, $0, tno;				\
   ctc2   $30, vco				\
   ctc2   $30, vcc				\
   lqv	  vD   , 48(rMp);			\
   nop;						\
   nop;						\
   lqv	  vT, 16(rMp);				\
   lqv	  vS, 0(rMp);				\
   lqv	  vDexp, 32(rMp);			\
   Op     vD, vS, vT_El;			\
   nop;						\
   nop;						\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)  \
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 64;     			\
   nop;						\
   /**/

/**********************************************************************
 * Check_Vmul: Used by all the mul instructions
 ********************************************************************/
#define Check_Vmul(tno, Op, rMp,vS,vT,vT_El,vD,vDexp,vTemp,vAccl,vAccm,vAcch,vAcclExp,vAccmExp,vAcchExp,v4000,v0001)          \
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   lui	  $1,0x1000				\
   ori	  $1, 0x0000				\
   lqv	  v4000,    0($1);			\
   lqv	  v0001,    16($1);			\
   lqv	  vS, 	    0(rMp);			\
   lqv	  vT,       16(rMp);			\
   lqv	  vDexp,    32(rMp);			\
   lqv	  vAccl,    48(rMp);			\
   lqv	  vAccm,    64(rMp);			\
   lqv	  vAcch,    80(rMp);			\
   lqv	  vAcclExp, 96(rMp);			\
   lqv	  vAccmExp, 112(rMp);			\
   lqv	  vAcchExp, 128(rMp);			\
   init_acc(vAccl,vAccm,vAcch,v4000,v0001,vTemp)\
   nop						\
   nop						\
   Op     vD, vS, vT_El;			\
   nop						\
   get_acc(vAccl,vAccm,vAcch)			\
   nop						\
   ctc2   $0, vcc;				\
   addi   rMp, rMp, 144;     			\
   compare_vectors(vTemp,vD,vDexp,0xffff,0xff)	\
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   compare_vectors(vTemp,vAccm,vAccmExp,0xffff,0xff)\
   compare_vectors(vTemp,vAcch,vAcchExp,0xffff,0xff)
   /**/
/**********************************************************************
 * Check_dpmul: Used by double precision mul
 ********************************************************************/
#define Check_dpmul(tno, rMp,vSH,vSL,vTH,vTL,vDH,vDL,vDHExp,vDLExp,vTemp,vAccl,vAccm,vAcch,vAcclExp,vAccmExp,vAcchExp,Msk)          \
   ori    $30, $0, tno;				\
   ctc2   $0, vco				\
   ctc2   $0, vcc				\
   lqv	  vSH, 	    0(rMp);			\
   lqv	  vSL, 	    16(rMp);			\
   lqv	  vTH,      32(rMp);			\
   lqv	  vTL,      48(rMp);			\
   lqv	  vDHExp,    64(rMp);			\
   lqv	  vDLExp,    80(rMp);			\
   lqv	  vAcclExp, 96(rMp);			\
   lqv	  vAccmExp, 112(rMp);			\
   lqv	  vAcchExp, 128(rMp);			\
   addi   rMp, rMp, 144;     			\
   nop						\
   vmudl     vDL, vSL, vTL;			\
   vmadm     vDH, vSH, vTL;			\
   vmadn     vDL, vSL, vTH;			\
   vmadh     vDH, vSH, vTH;			\
   get_acc(vAccl,vAccm,vAcch)			\
   ctc2   $0, vcc;				\
   compare_vectors(vTemp,vDL,vDLExp,Msk,Msk)   \
   compare_vectors(vTemp,vDH,vDHExp,0xffff,0xff) \
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   compare_vectors(vTemp,vAccm,vAccmExp,0xffff,0xff)\
   compare_vectors(vTemp,vAcch,vAcchExp,0xffff,0xff)\
   nop						\
   nop						\
   vmudm     vDH, vSH, vTL;			\
   vmadl     vDL, vSL, vTL;			\
   vmadn     vDL, vSL, vTH;			\
   vmadh     vDH, vSH, vTH;			\
   get_acc(vAccl,vAccm,vAcch)			\
   ctc2   $0, vcc;				\
   compare_vectors(vTemp,vDL,vDLExp,Msk,Msk)   \
   compare_vectors(vTemp,vDH,vDHExp,0xffff,0xff) \
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   compare_vectors(vTemp,vAccm,vAccmExp,0xffff,0xff)\
   compare_vectors(vTemp,vAcch,vAcchExp,0xffff,0xff)\
   nop						\
   nop						\
   vmudm     vDH, vSH, vTL;			\
   vmadn     vDL, vSL, vTH;			\
   vmadl     vDL, vSL, vTL;			\
   vmadh     vDH, vSH, vTH;			\
   get_acc(vAccl,vAccm,vAcch)			\
   ctc2   $0, vcc;				\
   compare_vectors(vTemp,vDL,vDLExp,Msk,Msk)   \
   compare_vectors(vTemp,vDH,vDHExp,0xffff,0xff) \
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   compare_vectors(vTemp,vAccm,vAccmExp,0xffff,0xff)\
   compare_vectors(vTemp,vAcch,vAcchExp,0xffff,0xff)\
   nop						\
   nop						\
   vmudn     vDL, vSL, vTH;			\
   vmadm     vDH, vSH, vTL;			\
   vmadl     vDL, vSL, vTL;			\
   vmadh     vDH, vSH, vTH;			\
   get_acc(vAccl,vAccm,vAcch)			\
   ctc2   $0, vcc;				\
   compare_vectors(vTemp,vDL,vDLExp,Msk,Msk)   \
   compare_vectors(vTemp,vDH,vDHExp,0xffff,0xff) \
   compare_vectors(vTemp,vAccl,vAcclExp,0xffff,0xff)\
   compare_vectors(vTemp,vAccm,vAccmExp,0xffff,0xff)\
   compare_vectors(vTemp,vAcch,vAcchExp,0xffff,0xff)\
   /**/
/**********************************************************************
 * InitDiv: 
 ********************************************************************/
#define InitDiv       				\
   mtc2   $0,$v0[0];                            \
   vrcp	  $v0[0],$v0[0];                        \
   nop						\
   nop						
   /**/
/**********************************************************************
 * Check_sp: 
 ********************************************************************/
#define Check_sp(tno,op,oph,rMp,vTH,vTL,vDH,vDL,vDHexp,vDLexp,vTemp,vTH0,vTH1,vTH2,vTH3,vTH4,vTH5,vTH6,vTH7,vTL0,vTL1,vTL2,vTL3,vTL4,vTL5,vTL6,vTL7,vDH0,vDH1,vDH2,vDH3,vDH4,vDH5,vDH6,vDH7,vDL0,vDL1,vDL2,vDL3,vDL4,vDL5,vDL6,vDL7)       \
   ori    $30, $0, tno;                         \
   lqv    vTH,      0(rMp);                     \
   lqv    vTL,      16(rMp);                    \
   lqv    vDHexp,   32(rMp);                    \
   lqv    vDLexp,   48(rMp);                    \
   op     vDL[vDL0], vTL[vTL0]			\
   oph    vDH[vDH0], vTH[vTH0]			\
   op     vDL[vDL1], vTL[vTL1]			\
   oph    vDH[vDH1], vTH[vTH1]			\
   vnoop					\
   op     vDL[vDL2], vTL[vTL2]			\
   oph    vDH[vDH2], vTH[vTH2]			\
   vadd   vTemp, vDHexp, vDLexp			\
   vnoop					\
   op     vDL[vDL3], vTL[vTL3]			\
   oph    vDH[vDH3], vTH[vTH3]			\
   op     vDL[vDL4], vTL[vTL4]			\
   oph    vDH[vDH4], vTH[vTH4]			\
   op     vDL[vDL5], vTL[vTL5]			\
   oph    vDH[vDH5], vTH[vTH5]			\
   op     vDL[vDL6], vTL[vTL6]			\
   oph    vDH[vDH6], vTH[vTH6]			\
   vnoop					\
   op     vDL[vDL7], vTL[vTL7]			\
   oph    vDH[vDH7], vTH[vTH7]			\
   addi   rMp, rMp, 64;                         \
   nop;						\
   nop;						\
   compare_vectors(vTemp,vDH,vDHexp,0xffff,0xff)  \
   compare_vectors(vTemp,vDL,vDLexp,0xffff,0xff)  \
   nop;						\
   /**/

/**********************************************************************
 * Check_dp (NO Chain): 
 ********************************************************************/
#define Check_dp(tno,opl,oph,opsp,rMp,vTH,vTL,vDH,vDL,vDHexp,vDLexp,vTemp,vTH0,vTH1,vTH2,vTH3,vTH4,vTH5,vTH6,vTH7,vTL0,vTL1,vTL2,vTL3,vTL4,vTL5,vTL6,vTL7,vDH0,vDH1,vDH2,vDH3,vDH4,vDH5,vDH6,vDH7,vDL0,vDL1,vDL2,vDL3,vDL4,vDL5,vDL6,vDL7)       \
   ori    $30, $0, tno;                         \
   lqv    vTemp,    0(rMp);                     \
   lqv    vTH,      0(rMp);                     \
   lqv    vTL,      16(rMp);                    \
   lqv    vDHexp,   32(rMp);                    \
   lqv    vDLexp,   48(rMp);                    \
   oph    vDH[vDH0], vTH[vTH0]			\
   opl    vDL[vDL0], vTL[vTL0]			\
   oph    vDH[vDH0], vTemp[0]			\
   oph    vDH[vDH1], vTH[vTH1]			\
   opl    vDL[vDL1], vTL[vTL1]			\
   oph    vDH[vDH1], vTemp[0]			\
   vnoop					\
   vadd   vTemp, vDHexp, vDLexp			\
   oph    vDH[vDH2], vTH[vTH2]			\
   opl    vDL[vDL2], vTL[vTL2]			\
   oph    vDH[vDH2], vTemp[0]			\
   vnoop					\
   oph    vDH[vDH3], vTH[vTH3]			\
   opl    vDL[vDL3], vTL[vTL3]			\
   oph    vDH[vDH3], vTemp[0]			\
   oph    vDH[vDH4], vTH[vTH4]			\
   opl    vDL[vDL4], vTL[vTL4]			\
   oph    vDH[vDH4], vTemp[0]			\
   oph    vDH[vDH5], vTH[vTH5]			\
   opl    vDL[vDL5], vTL[vTL5]			\
   oph    vDH[vDH5], vTemp[0]			\
   vnoop					\
   oph    vDH[vDH6], vTH[vTH6]			\
   opl    vDL[vDL6], vTL[vTL6]			\
   oph    vDH[vDH6], vTemp[0]			\
   oph    vDH[vDH7], vTH[vTH7]			\
   opl    vDL[vDL7], vTL[vTL7]			\
   oph    vDH[vDH7], vTemp[0]			\
   addi   rMp, rMp, 64;                        \
   compare_vectors(vTemp,vDH,vDHexp,0xffff,0xff)  \
   compare_vectors(vTemp,vDL,vDLexp,0xffff,0xff)  \
   nop;						\
   /**/

/**********************************************************************
 * Check_dp (Chained): 
 ********************************************************************/
#define Check_dp_chain(tno,opl,oph,opsp,rMp,vTH,vTL,vDH,vDL,vDHexp,vDLexp,vTemp,vTH0,vTH1,vTH2,vTH3,vTH4,vTH5,vTH6,vTH7,vTL0,vTL1,vTL2,vTL3,vTL4,vTL5,vTL6,vTL7,vDH0,vDH1,vDH2,vDH3,vDH4,vDH5,vDH6,vDH7,vDL0,vDL1,vDL2,vDL3,vDL4,vDL5,vDL6,vDL7)       \
   ori    $30, $0, tno;                         \
   lqv    vTH,      0(rMp);                     \
   lqv    vTL,      16(rMp);                    \
   lqv    vDHexp,   32(rMp);                    \
   lqv    vDLexp,   48(rMp);                    \
   vadd   vTemp, vDHexp, vDLexp			\
   oph    vDH[vDH7], vTH[vTH0]			\
   opl    vDL[vDL0], vTL[vTL0]			\
   oph    vDH[vDH0], vTH[vTH1]			\
   opl    vDL[vDL1], vTL[vTL1]			\
   oph    vDH[vDH1], vTH[vTH2]			\
   opl    vDL[vDL2], vTL[vTL2]			\
   oph    vDH[vDH2], vTH[vTH3]			\
   opl    vDL[vDL3], vTL[vTL3]			\
   oph    vDH[vDH3], vTH[vTH4]			\
   opl    vDL[vDL4], vTL[vTL4]			\
   oph    vDH[vDH4], vTH[vTH5]			\
   opl    vDL[vDL5], vTL[vTL5]			\
   oph    vDH[vDH5], vTH[vTH6]			\
   opl    vDL[vDL6], vTL[vTL6]			\
   oph    vDH[vDH6], vTH[vTH7]			\
   opl    vDL[vDL7], vTL[vTL7]			\
   oph    vDH[vDH7], vTemp[7]			\
   addi   rMp, rMp, 64;                        \
   compare_vectors(vTemp,vDH,vDHexp,0xffff,0xff)  \
   compare_vectors(vTemp,vDL,vDLexp,0xffff,0xff)  \
   nop;						\
   /**/
/**********************************************************************/
/**********************************************************************/
/********************* UTILITIES **************************************/
/**********************************************************************/
/**********************************************************************/

/**********************************************************************
 * Used to check VCC and VCO registers
 ********************************************************************/
#define compare_control(creg,exp_val)		\
   ori	  $2,$0,exp_val;			\
   cfc2   $1, creg;				\
   nop;						\
   andi   $1,$1,0xffff;				\
   bne    $1, $2, Fail;				\
   nop;						\

/**********************************************************************
 * Initialize the accumulator(H,M,L)
 ********************************************************************/
#define init_acc(vAccl,vAccm,vAcch,v4000,v0001,vTemp)	\
	vmudh 	vTemp,v4000,vAcch			\
	vmadh 	vTemp,v4000,vAcch			\
	vmadh 	vTemp,v4000,vAcch			\
	vmadh 	vTemp,v4000,vAcch			\
	vmadm 	vTemp,v4000,vAccm			\
	vmadm 	vTemp,v4000,vAccm			\
	vmadm 	vTemp,v4000,vAccm			\
	vmadm 	vTemp,v4000,vAccm			\
	vmadm 	vTemp,v0001,vAccl				
/**********************************************************************
 * Initialize the accumulator low (0,0,L)
 ********************************************************************/
#define init_acc_low(vAccl,v0001,vTemp)	\
	vmudm 	vTemp,v0001,vAccl				

/**********************************************************************
 * Compare two vectors
 ********************************************************************/
#define compare_vectors(vTemp,v_1,v_2,cMask,cVal)\
   	veq    vTemp,v_1, v_2;			\
   	nop;					\
   	nop;					\
   	nop;					\
   	cfc2   $1, vcc;				\
   	nop;					\
   	andi   $1, $1, cMask;			\
   	ctc2   $0, vcc;				\
   	ori    $2, $0, cVal;			\
   	bne    $1, $2, Fail;			\
   	nop;					\
   	nop;					\
	
/**********************************************************************
 * retrive the accumulator low (L)
 ********************************************************************/
#define get_acc_low(vAccl)			\
   	vsaw	vAccl,vAccl,vAccl[2]		\
   	nop;					
/**********************************************************************
 * retrive the accumulator(H,M,L)
 ********************************************************************/
#define get_acc(vAccl,vAccm,vAcch)		\
   	vsaw	vAccl,vAccl,vAccl[2]		\
   	vsaw	vAccm,vAccm,vAccm[1]		\
   	vsaw	vAcch,vAcch,vAcch[0]		\
   	nop;					\