コード例 #1
0
ファイル: ocl_tests.cpp プロジェクト: AK9527lq/picongpu
void
test6(memtest_control_t* mc)
{
  unsigned int i;
  
  unsigned int pattern;
  
  for (i= 0, pattern = 1;i < 32; pattern = pattern << 1, i++){
    
    PRINTF("Test6[move inversion 32 bits test]: pattern =0x%x, offset=%d\n", pattern, i);
    movinv32(mc, pattern, 1, 0, i);
    PRINTF("Test6[move inversion 32 bits test]: pattern =0x%x, offset=%d\n", ~pattern, i);
    movinv32(mc, ~pattern, 0xfffffffe, 1, i);
    
  }


}
コード例 #2
0
ファイル: newmt.c プロジェクト: kisom/pmon
static int newmt(void)
{
	int i = 0, j = 0;
	unsigned long chunks;
	unsigned long lo, hi;


#if NMOD_FRAMEBUFFER > 0 
	video_cls();
#endif
	if(setjmp(jmpb_mt)&&(returncode==2)){
		ioctl (STDIN, TCSETAF, &sav);
		firsttime = 0;
		v->test = 0;
		v->pass = 0;
		v->msg_line = 0;
		v->ecount = 0;
		v->ecc_ecount = 0;
		autotest=0;
		firsttime=0;
		/* Clear the screen */
#if NMOD_FRAMEBUFFER > 0
		video_cls();
#endif
		return 0;
	}

	ioctl (STDIN, CBREAK, &sav);
	while(1)
	{
		window=0;
		/* If first time, initialize test */
		windows[0].start =LOW_TEST_ADR>>12;
		windows[0].end= HIGH_TEST_ADR>>12;
        
		if(!firsttime){init();firsttime++;}
        
	    bail = 0;

		/* Find the memory areas I am going to test */
		compute_segments(window);

		if (segs == 0) {
			goto skip_window;
		}
		/* Now map in the window... */
		if (map_page(v->map[0].pbase_addr) < 0) {
			goto skip_window;
		}

		/* Update display of memory segments being tested */
		lo = page_of(v->map[0].start);
		hi = page_of(v->map[segs -1].end);
		aprint(LINE_RANGE, COL_MID+9, lo-0x80000);
		cprint(LINE_RANGE, COL_MID+14, " - ");
		aprint(LINE_RANGE, COL_MID+17, hi-0x80000);
		aprint(LINE_RANGE, COL_MID+23, v->selected_pages);
		cprint(LINE_RANGE, COL_MID+28, 
				((ulong)&_start == LOW_TEST_ADR)?"          ":" Relocated");

		/* Now setup the test parameters based on the current test number */
		/* Figure out the next test to run */
		if (v->testsel >= 0) {
			v->test = v->testsel;
		}
		dprint(LINE_TST, COL_MID+6, v->test, 2, 1);
		cprint(LINE_TST, COL_MID+9, tseq[v->test].msg);
		set_cache(tseq[v->test].cache);

		/* Compute the number of SPINSZ memory segments */
		chunks = 0;
		for(i = 0; i < segs; i++) {
			unsigned long len;
			len = v->map[i].end - v->map[i].start;
			chunks += (len + SPINSZ -1)/SPINSZ;
		}
        
		test_ticks = find_ticks_for_test(chunks, v->test);
        nticks = 0;
		v->tptr = 0;
		cprint(1, COL_MID+8, "                                         ");
		switch(tseq[v->test].pat) {
			/* Now do the testing according to the selected pattern */
			case 0:	/* Moving inversions, all ones and zeros */
				p1 = 0;
				p2 = ~p1;
				movinv1(tseq[v->test].iter,p1,p2);
				BAILOUT;

				/* Switch patterns */
				p2 = p1;
				p1 = ~p2;
				movinv1(tseq[v->test].iter,p1,p2);
				BAILOUT;
				break;

			case 1: /* Moving inversions, 8 bit wide walking ones and zeros. */
                p0 = 0x80;
				for (i=0; i<8; i++, p0=p0>>1) {
					p1 = p0 | (p0<<8) | (p0<<16) | (p0<<24);
					p2 = ~p1;
					movinv1(tseq[v->test].iter,p1,p2);
					BAILOUT;

					/* Switch patterns */
					p2 = p1;
					p1 = ~p2;
					movinv1(tseq[v->test].iter,p1,p2);
					BAILOUT
				}
				break;

			case 2: /* Moving inversions, 32 bit shifting pattern, very long */
                {
                    u_int32_t pa = 0;
                    for (i=0, pa=1; pa; pa=pa<<1, i++) {
					    movinv32(tseq[v->test].iter,pa, 1, 0x80000000, 0, i);
					    BAILOUT
                        movinv32(tseq[v->test].iter,~pa, 0xfffffffe,
								0x7fffffff, 1, i);
					    BAILOUT
				    }
                }
				break;

			case 3: /* Modulo X check, all ones and zeros */
                p1=0;
				for (i=0; i<MOD_SZ; i++) {
					p2 = ~p1;
					modtst(i, tseq[v->test].iter, p1, p2);
					BAILOUT

					/* Switch patterns */
					p2 = p1;
					p1 = ~p2;
					modtst(i, tseq[v->test].iter, p1,p2);
					BAILOUT
				}
				break;

			case 4: /* Modulo X check, 8 bit pattern */
                p0 = 0x80;
				for (j=0; j<8; j++, p0=p0>>1) {
					p1 = p0 | (p0<<8) | (p0<<16) | (p0<<24);
					for (i=0; i<MOD_SZ; i++) {
						p2 = ~p1;
						modtst(i, tseq[v->test].iter, p1, p2);
						BAILOUT

						/* Switch patterns */
						p2 = p1;
						p1 = ~p2;
						modtst(i, tseq[v->test].iter, p1, p2);
						BAILOUT
					}
				}
				break;
			case 5: /* Address test, walking ones */
                addr_tst1();
				BAILOUT;
				break;

			case 6: /* Address test, own address */
                addr_tst2();
				BAILOUT;
				break;

			case 7: /* Block move test */
                block_move(tseq[v->test].iter);
				BAILOUT;
				break;
			case 8: /* Bit fade test */
                if (window == 0 ) {
					bit_fade();
				}
				BAILOUT;
				break;
			case 9: /* Random Data Sequence */
                for (i=0; i < tseq[v->test].iter; i++) {
					movinvr();
					BAILOUT;
				}
				break;
			case 10: /* Random Data */
                for (i=0; i < tseq[v->test].iter; i++) {
					p1 = rand();
					p2 = ~p1;
					movinv1(2,p1,p2);
					BAILOUT;
				}
				break;
		}
skip_window:
		if (bail) {
			goto bail_test;
		}
		/* Rever to the default mapping and enable the cache */
		paging_off();
		set_cache(1);
		window++;
		if (window >= sizeof(windows)/sizeof(windows[0])) {
			window = 0;
		}
		/* We finished the test so clear the pattern */
		cprint(LINE_PAT, COL_PAT, "            ");
skip_test:
		v->test++;
bail_test:

		paging_off();
		set_cache(1);
		check_input();
		window = 0;
		cprint(LINE_PAT, COL_PAT-3, "   ");
		/* If this was the last test then we finished a pass */
		if (v->test >= DEFTESTS || v->testsel >= 0) {
			v->pass++;
			dprint(LINE_INFO, COL_PASS, v->pass, 5, 0);
			v->test = 0;
			v->total_ticks = 0;
			v->pptr = 0;
			cprint(0, COL_MID+8,
				"                                         ");
		}
	}
	return 0;
}