From 0e978aca7e0dbcf40829179a2e4aba84b7fa9bf7 Mon Sep 17 00:00:00 2001 From: reccetear <1610266604@qq.com> Date: Mon, 20 Mar 2017 01:11:10 +0800 Subject: [PATCH] add CPUTest --- .DS_Store | Bin 6148 -> 6148 bytes CPUTest/.DS_Store | Bin 0 -> 6148 bytes CPUTest/README.md | 2 -- CPUTest/cache_test.c | 64 ---------------------------------------- CPUTest/quickSort_vga.c | 55 ---------------------------------- CPUTest/trap.h | 17 ----------- 6 files changed, 138 deletions(-) create mode 100644 CPUTest/.DS_Store delete mode 100644 CPUTest/README.md delete mode 100644 CPUTest/cache_test.c delete mode 100644 CPUTest/quickSort_vga.c delete mode 100644 CPUTest/trap.h diff --git a/.DS_Store b/.DS_Store index 49edd56c7917861d25262823cefdfc9008dc1849..d8bc5be9abcd1e98e88e431b2f6b62265b4cbf83 100644 GIT binary patch delta 40 qcmZoMXffE}$jZjBl7WFiW3xN!PDUO^aS;1I7)&huy_uckFFyeJ!4Cic delta 40 rcmZoMXffE}$jZhj!@$6xv)P?>CnFETN+4U~KNw6b{Joi-<1aq|^ZXA9 diff --git a/CPUTest/.DS_Store b/CPUTest/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0= highIndex) return; - int i = lowIndex + 1; - int pivot_value = arr[lowIndex]; - int lt = lowIndex; - int gt = highIndex; - while(i <= gt) { - if(arr[i] < pivot_value) { - swap(arr, i++, lt++); - } - else if(arr[i] > pivot_value) { - swap(arr, i, gt--); - } - else { - i ++; - } - } - quickSort3Ways(arr, lowIndex, lt - 1); - quickSort3Ways(arr, gt + 1, highIndex); -} - -#define VMEM ((char *)0xc0000000) - -int main() { - char* vga = VMEM + 320 + 80; - volatile int arr[100]; - int j; - put_hex((int )&arr[0], vga); - vga += 160; - for(j = 0; j < 100; j += 1) { - arr[j] = 200 - j; - } - quickSort3Ways(arr, 0, 99); - - for(j = 0; j < 50; j ++) { - put_hex(arr[j], vga); - vga += 160; - } - vga += 210; - for(;j < 100; j ++) { - put_hex(arr[j], vga); - vga += 160; - } - good(); - return good(); -} diff --git a/CPUTest/trap.h b/CPUTest/trap.h deleted file mode 100644 index 68967fac..00000000 --- a/CPUTest/trap.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef TRAP_H -#define TRAP_H - -// NOTE: only for self-correctness check! - -#include -#include - -#define ASSERT(x) do { \ - if (!(x)) bad(); \ -} while (0) - - -static void good() { puts("HIT GOOD TRAP"); exit(0); } -static void bad() { puts("HIT BAD TRAP"); exit(-1); } - -#endif // TRAP_H