MIPS/resources/soft/perf_func/bench/stream_copy/shell9.c
Paul Pan 7b33e4213a a big update
1. add test soft
2. modify verilator (TODO: crossbar need to replace)
3. fix CP0: now CU0 is always 1
4. Controller: cacheop
5. Controller: fix TEN
6. mycpu_top fix CP0_i
7. fix AXI.sv
8. fix AXIReader.sv
9. fix AXIWriter.sv: getting the correct data and length
10. MU: fix cache writeback, fix mem data mux, fix writer address, fix read request
2022-07-29 18:25:58 +08:00

72 lines
8.2 KiB
C

#include <machine.h>
#include <time.h>
#define N 1000
int c[N] = {0};
int a[N] = {18361, 25784, 6605, 26590, 22618, 15285, 27647, 23843, 16362, 10047, 16750, 10588, 27793, 20888, 27352, 6613, 6426, 9475, 1198, 17530, 23329, 31946, 17543, 42, 21700, 8569, 15002, 4705, 12988, 27549, 19075, 24352, 19489, 17567, 12310, 5363, 30347, 17034, 31029, 8821, 27399, 14673, 5216, 15979, 26439, 29891, 25161, 14524, 18559, 13036, 9790, 18401, 2223, 16069, 7917, 4284, 10022, 26104, 14827, 2867, 18285, 1073, 26236, 24110, 10506, 24816, 24846, 6813, 21026, 27498, 1618, 9173, 3264, 20262, 28522, 9796, 22268, 23679, 21324, 14882, 19599, 21158, 12181, 5101, 25414, 6808, 8534, 9282, 10802, 27835, 28598, 10331, 4015, 19630, 20789, 32664, 22681, 11411, 29913, 25229, 6165, 3426, 17535, 31632, 19593, 30505, 15223, 2318, 14036, 20900, 7556, 25432, 16015, 8758, 4713, 26187, 19900, 5130, 16473, 19631, 32670, 24508, 20314, 7631, 13785, 16126, 20449, 28518, 9821, 15831, 3234, 30579, 19535, 22706, 4768, 1923, 18616, 13435, 32295, 28430, 543, 30101, 4202, 15992, 28713, 20597, 14893, 27908, 20386, 9488, 27977, 27549, 9303, 24865, 25073, 19337, 11325, 5301, 12619, 24167, 23461, 21817, 8405, 4121, 29052, 6111, 24844, 24437, 31551, 3907, 9170, 16647, 27220, 15102, 9530, 2249, 24399, 18465, 5493, 17119, 20611, 20390, 19773, 28, 18161, 6403, 12863, 1593, 10843, 22910, 4724, 11134, 4153, 5452, 18690, 16416, 1906, 24535, 16446, 23820, 19100, 28521, 27774, 20718, 14827, 12463, 23005, 25687, 16010, 29026, 25342, 5468, 28703, 15710, 27848, 32283, 26420, 15317, 18639, 21943, 19840, 17255, 28696, 24357, 20606, 9486, 937, 4160, 4981, 7019, 22000, 17665, 31013, 4260, 10617, 30818, 18182, 7565, 16832, 20498, 7177, 14293, 19961, 24223, 18518, 25822, 22471, 8, 19380, 23623, 2202, 21965, 21102, 26895, 7429, 30068, 21648, 2980, 335, 5098, 6690, 29231, 6012, 9279, 356, 30010, 31377, 8133, 28387, 18782, 2760, 9452, 23837, 17550, 29237, 7372, 20642, 3499, 32400, 16192, 12653, 12849, 21572, 30565, 18887, 22554, 21152, 15598, 22057, 30934, 23777, 24037, 5602, 24896, 22587, 15571, 7570, 8792, 27830, 28464, 2113, 5274, 19172, 26597, 4048, 31537, 30282, 14226, 5963, 3575, 32162, 15801, 28447, 140, 14435, 2747, 15940, 4298, 28193, 23730, 22763, 22864, 28774, 26263, 3902, 27368, 19678, 18963, 21464, 13172, 10679, 23995, 26474, 1846, 8759, 2212, 32551, 599, 24111, 14573, 9568, 32754, 3615, 13647, 5624, 3270, 24971, 2412, 23450, 31302, 13737, 10042, 4344, 23792, 21651, 9744, 1118, 22727, 9418, 27218, 28384, 741, 9552, 24236, 4217, 18331, 26948, 18266, 7759, 6084, 29276, 17319, 17591, 7008, 3064, 29484, 8365, 29089, 14748, 20762, 20371, 31222, 18637, 10655, 12153, 25911, 14817, 760, 6243, 26599, 5373, 15219, 11143, 30279, 23782, 10629, 1498, 2582, 27952, 4692, 26974, 25458, 6180, 3701, 32659, 17635, 20402, 2849, 25274, 24304, 9406, 23357, 18562, 28701, 7710, 25780, 1524, 2137, 11351, 20735, 13376, 29907, 7599, 29598, 23772, 18826, 20662, 14849, 20621, 5702, 8980, 11544, 16812, 14580, 30914, 24374, 10060, 12695, 30240, 26933, 23265, 15744, 17352, 17498, 20135, 4304, 20, 18077, 16624, 3301, 26416, 10765, 5235, 15650, 14828, 31201, 28773, 15363, 12074, 11213, 19463, 12216, 7626, 28333, 17656, 19567, 18211, 2213, 16818, 17937, 18840, 24196, 29115, 19086, 3145, 22418, 3758, 331, 8881, 27051, 13753, 14492, 21686, 5620, 29542, 2811, 14049, 11791, 31374, 8446, 21295, 171, 11406, 26004, 4959, 31477, 9895, 27717, 26014, 10630, 30780, 2079, 28466, 26714, 6106, 17590, 24342, 29043, 1976, 25331, 29158, 1583, 12928, 6071, 17581, 28865, 13210, 28009, 20784, 27309, 19499, 25346, 22921, 28565, 24371, 20989, 25661, 12137, 17434, 16928, 2064, 7383, 16781, 22027, 3396, 4464, 6054, 12919, 19402, 3712, 6782, 32083, 9418, 32479, 3305, 24726, 19060, 12909, 20922, 19190, 12266, 31608, 19404, 31581, 22331, 3954, 23414, 28587, 27314, 6131, 5511, 29261, 19165, 17151, 12790, 20667, 20072, 24464, 8549, 8734, 9563, 13697, 23370, 7305, 4337, 5331, 32101, 5627, 26032, 20949, 9635, 7494, 1480, 21359, 28744, 23256, 25455, 23379, 72, 8557, 20315, 6111, 28786, 27823, 32726, 5890, 23936, 15676, 26132, 23521, 21952, 21332, 23018, 25613, 22490, 19980, 18174, 29259, 21929, 32663, 27343, 30842, 14552, 5854, 5961, 4301, 21307, 5022, 3953, 2151, 22275, 10797, 4218, 27467, 10812, 31936, 26645, 29079, 14373, 9988, 12351, 14128, 25859, 20555, 12644, 23079, 30907, 32457, 2368, 31622, 25750, 31918, 11738, 1921, 32209, 31463, 8812, 4015, 29293, 11332, 19249, 7770, 27392, 28268, 9899, 30045, 19217, 3801, 28002, 32616, 9388, 28039, 23772, 10169, 1520, 31886, 1950, 15888, 14119, 5672, 23563, 2543, 21167, 3185, 10804, 27142, 26312, 347, 18389, 4863, 21184, 26380, 2864, 7285, 7884, 9476, 29547, 11557, 7128, 22472, 16696, 24750, 31432, 14132, 27344, 10428, 457, 31256, 24076, 4174, 18715, 14206, 2315, 26588, 20993, 25397, 31903, 30534, 25304, 12516, 1984, 5463, 9284, 19233, 12060, 32211, 22643, 13078, 9933, 3340, 22387, 7052, 10172, 29558, 7875, 28161, 23737, 6773, 16088, 7629, 9709, 7218, 14952, 19326, 1547, 27570, 7565, 19076, 23355, 17078, 2736, 28025, 27888, 8276, 17470, 6836, 16311, 20254, 4378, 27687, 6910, 15950, 7444, 14909, 9320, 30507, 897, 14089, 3394, 11101, 4647, 32438, 14317, 26071, 11819, 12056, 12029, 2749, 18620, 26555, 21313, 5899, 29927, 3681, 18781, 6492, 6078, 27068, 25942, 12691, 296, 3191, 227, 387, 24916, 4274, 16784, 8813, 18832, 16046, 14526, 3237, 28320, 6649, 28356, 23302, 8740, 15353, 31081, 4438, 597, 22616, 19714, 5051, 31653, 26512, 26618, 28501, 24151, 23735, 9786, 22530, 12114, 31329, 12084, 16310, 6264, 2935, 26102, 18118, 12128, 29778, 30669, 26863, 30002, 28063, 15537, 11253, 797, 1977, 12794, 21066, 7896, 12653, 4165, 25848, 4475, 22378, 6214, 22527, 17868, 10283, 31710, 791, 11574, 24006, 8950, 2544, 8659, 19087, 4920, 6184, 13590, 25766, 2813, 15107, 2049, 17820, 24626, 3792, 16481, 15923, 12153, 21888, 619, 27607, 11335, 9571, 11509, 15583, 32416, 26258, 6498, 10724, 31493, 23770, 17050, 16073, 13640, 14960, 13997, 15455, 14500, 14277, 7179, 26554, 459, 30202, 11643, 1952, 17685, 3079, 21575, 19132, 14610, 31624, 25251, 23470, 13038, 23314, 13782, 16378, 21553, 9029, 11935, 2603, 24128, 26285, 1658, 29441, 3681, 14540, 31382, 24257, 4221, 13759, 15049, 1055, 23316, 15803, 32617, 25773, 17756, 27469, 18021, 15717, 27446, 21166, 26014, 10474, 27290, 29485, 18048, 11796, 27532, 29054, 10298, 6384, 27273, 7218, 18523, 32454, 11145, 20550, 31100, 4945, 23427, 11621, 30388, 19151, 11485, 2842, 2086, 18222, 27660, 20772, 17907, 877, 16612, 4300, 28980, 12827, 19865, 13052, 6848, 28159, 17392, 27934, 3305, 21843, 27323, 28800, 16178, 7090, 27367, 2917, 26051, 10275, 28310, 25897, 14277, 5242, 5698, 5617, 9129, 27250, 1372, 5396, 31126, 8303, 29941, 15439, 9628, 21573, 18302, 17980, 11673, 18290, 11394, 11008};
void shell9(void)
{
unsigned long start_count = 0;
unsigned long stop_count = 0;
unsigned long total_count = 0;
unsigned long start_count_my = 0;
unsigned long stop_count_my = 0;
unsigned long total_count_my = 0;
int i,j, err;
//clear count
SOC_TIMER = 0;
asm volatile("mtc0 $0, $9");
err=0;
printf("stream copy test begin.\n");
start_count = get_count();
start_count_my = get_count_my();
if(SIMU_FLAG){
stream_copy(a, c, N);
for(j = 0; j < N; j++) {
if (c[j] != a[j]){
err+=1;
}
}
}else{
for(i=0; i<LOOPTIMES; i++){
stream_copy(a, c, N);
for(j = 0; j < N; j++) {
if (c[j] != a[j]){
err+=1;
}
}
}
}
stop_count_my = get_count_my();
stop_count = get_count();
total_count = stop_count - start_count;
total_count_my = stop_count_my - start_count_my;
if (err==0) {
printf("stream copy PASS!\n");
*((int *)LED_RG1_ADDR) = 1;
*((int *)LED_RG0_ADDR) = 1;
*((int *)LED_ADDR) = 0xffff;
}
else {
printf("stream copy ERROR!!!\n");
*((int *)LED_RG1_ADDR) = 1;
*((int *)LED_RG0_ADDR) = 2;
*((int *)LED_ADDR) = 0;
}
SOC_NUM = total_count_my;
*((volatile unsigned *)CONFREG_CR0) = total_count_my;
*((volatile unsigned *)CONFREG_CR1) = total_count;
printf("stream copy: Total Count(SoC count) = 0x%x\n", total_count);
printf("stream copy: Total Count(CPU count) = 0x%x\n", total_count_my);
return;
}