|
|
Power 6/32 Unix version 1.21
#include "fpp_defs.h"
/*****************************************************************************
*
* PIPELINE TEST #1 MONITOR
*
* This test will do:
*
* LDF(x), SUBF(x), SUBF(x), ADDF(x), ADDF(x), STF
*
* where the x's are the fmacro1 LDF data patterns.
*****************************************************************************/
pipe_1()
{
asm(".globl _pipeline_1_t");
asm("_pipeline_1_t:"); /* entry address */
if( (cycle == 1) && (prt_hdrs) ) /* print headers on 1st cycle */
{
writes("\n PIPE_1 ");
}
subtest = 1;
pipe1_1(); /* data in REGs, no NOPs */
subtest++; /* increment subtest num */
pipe1_2(); /* data in REGs, 1 NOP */
subtest++; /* increment subtest num */
pipe1_3(); /* data in REGs, 2 NOPs */
subtest++; /* increment subtest num */
pipe1_4(); /* data in REGs, 3 NOPs */
subtest++; /* increment subtest num */
pipe1_5(); /* data in CACHE, no NOPs */
subtest++; /* increment subtest num */
pipe1_6(); /* data in CACHE, 1 NOP */
subtest++; /* increment subtest num */
pipe1_7(); /* data in CACHE, 2 NOPs */
subtest++; /* increment subtest num */
pipe1_8(); /* data in CACHE, 3 NOPs */
subtest++; /* increment subtest num */
pipe1_9(); /* data on STACK, no NOPs */
subtest++; /* increment subtest num */
pipe1_10(); /* data via FP no NOPs */
asm("jmp *return"); /* return to the test monitor */
}
/************************************************************************
*
* SUBTEST 1
* data in registers, no NO-OPs
*
************************************************************************/
pipe1_1()
{
force_loop = FALSE; /* clear the force_loop flg */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_1_lp1:");
asm("movl _sgl_value_1,r4"); /* move the data to r4 */
asm("ldf r4"); /* load the operand */
asm("subf r4"); /* subtract it (twice ) */
asm("subf r4");
asm("addf r4"); /* add it back (twice) */
asm("addf r4");
asm("stf r5"); /* store the result */
if ( force_loop );
asm("brb _pipe1_1_lp1");; /* loop on the error */
/*
* verify the results
*/
asm("movl r5,_sgl_st_acc"); /* get the result */
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Reg. Data, no NO-OPs");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_1_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 1 */
/************************************************************************
*
* SUBTEST 2
* data in registers, 1 NO-OP
*
************************************************************************/
pipe1_2()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_2_lp1:");
asm("movl _sgl_value_1,r4"); /* move the data to r4 */
asm("ldf r4"); /* load the data operand */
asm("nop");
asm("subf r4"); /* subtract the data (2xs) */
asm("nop");
asm("subf r4");
asm("nop");
asm("addf r4"); /* add it back (2xs) */
asm("nop");
asm("addf r4");
asm("nop");
asm("stf r5"); /* store the result */
if ( force_loop );
asm("brb _pipe1_2_lp1");; /* loop on the error */
/*
* verify the results
*/
asm("movl r5,_sgl_st_acc"); /* get the result */
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Reg. Data, 1 NO-OP");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_2_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 2 */
/************************************************************************
*
* SUBTEST 3
* data in registers, 2 NO-OPs
*
************************************************************************/
pipe1_3()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_3_lp1:");
asm("movl _sgl_value_1,r4"); /* move the data to r4 */
asm("ldf r4"); /* loadthe operand */
asm("nop");
asm("nop");
asm("subf r4"); /* subtract the data (2xs) */
asm("nop");
asm("nop");
asm("subf r4");
asm("nop");
asm("nop");
asm("addf r4"); /* add it back (2xs) */
asm("nop");
asm("nop");
asm("addf r4");
asm("nop");
asm("nop");
asm("stf r5"); /* store the result */
if ( force_loop );
asm("brb _pipe1_3_lp1");; /* loop on the error */
/*
* verify the results
*/
asm("movl r5,_sgl_st_acc"); /* get the result */
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Reg. Data, 2 NO-OPs");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_3_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 3 */
/************************************************************************
*
* SUBTEST 4
* data in registers, 3 NO-OPs
*
************************************************************************/
pipe1_4()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_4_lp1:");
asm("movl _sgl_value_1,r4"); /* move the data to r4 */
asm("ldf r4"); /* load the operand */
asm("nop");
asm("nop");
asm("nop");
asm("subf r4"); /* subtract the data (2xs) */
asm("nop");
asm("nop");
asm("nop");
asm("subf r4");
asm("nop");
asm("nop");
asm("nop");
asm("addf r4"); /* add it back (2xs) */
asm("nop");
asm("nop");
asm("nop");
asm("addf r4");
asm("nop");
asm("nop");
asm("nop");
asm("stf r5"); /* store the result */
if ( force_loop );
asm("brb _pipe1_4_lp1");; /* loop on the error */
/*
* verify the results
*/
asm("movl r5,_sgl_st_acc"); /* get the result */
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Reg. Data, 3 NO-OPs");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_4_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 4 */
/************************************************************************
*
* SUBTEST 5
* data in Cache, no NO-OPs
*
************************************************************************/
pipe1_5()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_5_lp1:");
asm("ldf _sgl_value_1"); /* load the operand */
asm("subf _sgl_value_1"); /* subtract it (twice) */
asm("subf _sgl_value_1");
asm("addf _sgl_value_1"); /* add it back (twice) */
asm("addf _sgl_value_1");
asm("stf _sgl_st_acc"); /* store the result */
if ( force_loop );
asm("brb _pipe1_5_lp1");; /* loop on the error */
/*
* verify the results
*/
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Cache Data, no NO-OPs");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_5_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 5 */
/************************************************************************
*
* SUBTEST 6
* data in Cache, 1 NO-OP
*
************************************************************************/
pipe1_6()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_6_lp1:");
asm("ldf _sgl_value_1"); /* load the operand */
asm("nop");
asm("subf _sgl_value_1"); /* subtract it (twice) */
asm("nop");
asm("subf _sgl_value_1");
asm("nop");
asm("addf _sgl_value_1"); /* add it back (twice) */
asm("nop");
asm("addf _sgl_value_1");
asm("nop");
asm("stf _sgl_st_acc"); /* store the result */
if ( force_loop );
asm("brb _pipe1_6_lp1");; /* loop on the error */
/*
* verify the results
*/
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Cache Data, 1 NO-OP");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_6_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 6 */
/************************************************************************
*
* SUBTEST 7
* data in Cache, 2 NO-OPs
*
************************************************************************/
pipe1_7()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_7_lp1:");
asm("ldf _sgl_value_1"); /* load the operand */
asm("nop");
asm("nop");
asm("subf _sgl_value_1"); /* subtract it (twice) */
asm("nop");
asm("nop");
asm("subf _sgl_value_1");
asm("nop");
asm("nop");
asm("addf _sgl_value_1"); /* add it back (twice) */
asm("nop");
asm("nop");
asm("addf _sgl_value_1");
asm("nop");
asm("nop");
asm("stf _sgl_st_acc"); /* store the result */
if ( force_loop );
asm("brb _pipe1_7_lp1");; /* loop on the error */
/*
* verify the results
*/
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Cache Data, 2 NO-OPs");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_7_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 7 */
/************************************************************************
*
* SUBTEST 8
* data in Cache, 3 NO-OPs
*
************************************************************************/
pipe1_8()
{
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_8_lp1:");
asm("ldf _sgl_value_1"); /* load the operand */
asm("nop");
asm("nop");
asm("nop");
asm("subf _sgl_value_1"); /* subtract it (twice) */
asm("nop");
asm("nop");
asm("nop");
asm("subf _sgl_value_1");
asm("nop");
asm("nop");
asm("nop");
asm("addf _sgl_value_1"); /* add it back (twice) */
asm("nop");
asm("nop");
asm("nop");
asm("addf _sgl_value_1");
asm("nop");
asm("nop");
asm("nop");
asm("stf _sgl_st_acc"); /* store the result */
if ( force_loop );
asm("brb _pipe1_8_lp1");; /* loop on the error */
/*
* verify the results
*/
if( sgl_st_acc != sgl_expected ) /* COMPARE the values */
{
errcnt++; /* bump the error count */
if ( prt_error )
print_pipe1_er("Cache Data, 3 NO-OPs");
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_8_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
} /* end of subtest 8 */
/*****************************************************************************
*
* SUBTEST 9
* data on the stack, no NO-OPs
*
*****************************************************************************/
pipe1_9()
{
asm("moval (r13),_pre_event_fp"); /* save the frame pointer */
asm("moval (r14),_pre_event_sp"); /* save the stack pointer */
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
asm("moval _pointer_data,_sgl_value_2");/* init / final SP value */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_9_lp1:");
asm("moval _pointer_data,r14"); /* set the stack pointer */
asm("movl _sgl_value_1,-(r14)"); /* push the operand 5 times */
asm("movl _sgl_value_1,-(r14)");
asm("movl _sgl_value_1,-(r14)");
asm("movl _sgl_value_1,-(r14)");
asm("movl _sgl_value_1,-(r14)");
/*
* now pop the data off the stack
*/
asm("ldf (r14)+"); /* pop the data & load it */
asm("subf (r14)+"); /* subtract it (twice) */
asm("subf (r14)+");
asm("addf (r14)+"); /* add it back (twice) */
asm("addf (r14)+");
asm("stf r5"); /* store the result */
if ( force_loop );
asm("brb _pipe1_9_lp1");; /* loop on the error */
/*
* verify the results
*/
asm("movl r5,_sgl_st_acc"); /* get the result */
asm("moval (r14),_sgl_value_3"); /* save the stack pointer */
if( (sgl_st_acc != sgl_expected) || /* verify the result... */
(sgl_value_3 != sgl_value_2) ) /* ... and the final SP */
{
asm("movl _pre_event_fp,r13"); /* restore frame pointer */
asm("movl _pre_event_sp,r14"); /* restore stack pointer */
errcnt++; /* bump the error count */
if ( prt_error ) {
print_pipe1_er("POP data from the SP");
writes("final Stack Pointer = ");
write32h( sgl_value_3 );
writes(", expected SP = ");
write32h( sgl_value_2 );
writes(" \n");
}
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_9_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
asm("movl _pre_event_fp,r13"); /* restore the frame pointer */
asm("movl _pre_event_sp,r14"); /* restore the stack pointer */
} /* end of subtest 9 */
/******************************************************************************
*
* SUBTEST 10
* load 0, add operand 4 times -get data via indexed FRAME pointer
*
* ADDR INDEX DATA
* pointer_data 4 <the STF result goes here>
* pointer_data-4 3 <operand data>
* pointer_data-16 0 point the frame pointer here
*
******************************************************************************/
pipe1_10()
{
asm("moval (r13),_pre_event_fp"); /* save the frame pointer */
asm("moval (r14),_pre_event_sp"); /* save the stack pointer */
force_loop = FALSE; /* clear force_loop flag */
index = 0;
do
{
sgl_value_1 = ldf_1_data[index].ld; /* get operand 1 */
sgl_expected = ldf_1_data[index].exp; /* get expected results */
asm("moval _pointer_data,_sgl_value_2");/* init / final SP value */
/*
* If LOOP ON ERROR is set, this is the loop for this subtest.
* The force loop flag is set after the first error.
*/
asm("_pipe1_10_lp1:");
asm("moval _pointer_data,_sgl_value_2");/* get store data's addr */
sgl_value_2 -= 4; /* decrement it by 4 (bytes)*/
asm("movl _sgl_value_1,*_sgl_value_2");/* set the operand data */
sgl_value_2 -= 12; /* get the FP addr to use */
asm("movl _sgl_value_2,r13"); /* set the FRAME POINTER */
asm("movl $3,r5"); /* r5 index = 3 longwords */
asm("movl $4,r6"); /* r6 index = 4 longwords */
asm("ldf (r13)[r5]"); /* load -indexed by r5 */
asm("subf (r13)[r5]"); /* subtract it (twice) */
asm("subf (r13)[r5]");
asm("addf (r13)[r5]"); /* add it back (twice) */
asm("addf (r13)[r5]");
asm("stf (r13)[r6]"); /* store -indexed by r6 */
if ( force_loop );
asm("brw _pipe1_10_lp1");; /* loop on the error */
/*
* verify the results
*/
sgl_st_acc = pointer_data; /* move the stored result */
asm("moval (r13),_sgl_value_3"); /* save the frame pointer */
if( (sgl_st_acc != sgl_expected) || /* verify the result... */
(sgl_value_3 != sgl_value_2) ) /* ... and the final FP */
{
asm("movl _pre_event_fp,r13"); /* restore frame pointer */
asm("movl _pre_event_sp,r14"); /* restore stack pointer */
errcnt++; /* bump the error count */
if ( prt_error ) {
print_pipe1_er("indexed FP addressing");
writes("final Frame Pointer = ");
writeh( sgl_value_3 );
writes(", expected FP = ");
writeh( sgl_value_2 );
writes(" \n");
}
if ( halt_flg ) /* halt on error? */
pipe1_er_hlt( subtest );
if ( loop_on_err ) {
force_loop = TRUE; /* set the force loop flag */
asm("brw _pipe1_10_lp1"); /* and loop */
}
} /* end of compare error */
} while( index++ < max_ldf_1_index );
asm("movl _pre_event_fp,r13"); /* restore the frame pointer */
asm("movl _pre_event_sp,r14"); /* restore the stack pointer */
} /* end of subtest 10 */
/******************************************************************************
*
* ERROR ROUTINE
*
* print an error in the following form
*
* operand = xxxxxxxx, final Acc = xxxxxxxx, data index = dd
* expected Acc = xxxxxxxx
*
******************************************************************************/
print_pipe1_er(msg)
char *msg;
{
writes(" \n"); /* start a new print line */
writes("cycle: ");
writed( cycle );
writes(" test ");
writed( test_no );
writes(" (Pipe 1), subtest ");
writed( subtest );
writes(" error - ");
writes( msg );
writec('\n');
writes(" LDF(op1), SUBF(op1), SUBF(op1), ADDF(op1), ADDF(op1), STF\n");
writes("operand = ");
write32h( sgl_value_1 );
writes(", final Acc = ");
write32h( sgl_st_acc );
writes(", data index = ");
writed( index );
writec('\n');
writes(" expected Acc = ");
write32h( sgl_expected );
writec('\n');
}
/******************************************************************************
*
* HALT ON ERROR ROUTINE
*
* halt with the necessary information saved in the registers
*
******************************************************************************/
pipe1_er_hlt( subtest )
int subtest;
{
asm("movl _test_no,r0"); /* r0 = test number */
asm("movl _subtest,r1"); /* r1 = subtest number */
asm("movl $1,r2"); /* r2 = error code */
asm("movl _cycle,r3"); /* r3 = cycle count */
asm("movl _sgl_value_1,r4"); /* r4 = sgl operand */
asm("movl _sgl_st_acc,r5"); /* r5 = sgl stored */
asm("movl _sgl_expected,r6"); /* r6 = sgl expected */
asm("movl _index,r7"); /* r7 = data index */
if( subtest == 9 ) {
asm("movl _sgl_value_3,r8"); /* r8 = final SP value */
asm("movl _sgl_value_2,r9"); /* r9 = expected SP value */
} else
if( subtest == 10 ) {
asm("movl _sgl_value_3,r8"); /* r8 = final FP value */
asm("movl _sgl_value_2,r9"); /* r9 = expected FP value */
};
asm(".globl _pipe1_1_hlt");
asm("_pipe1_1_hlt:"); /* PC after the halt */
asm("halt"); /* HALT ... */
} /* end of halt on error */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.