Merge pull request #3 from OpenXiangShan/prefetch_test

add the softprefetchtest 10-08
This commit is contained in:
CODE-JTZ 2021-10-08 18:48:52 +08:00 committed by GitHub
commit a2644b3181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2924 additions and 0 deletions

View File

@ -0,0 +1,4 @@
NAME := aliastest
SRCS := $(shell find -L ./src/ -name "*.[cS]")
include $(AM_HOME)/Makefile.app

View File

@ -0,0 +1,11 @@
#ifndef __AMUNIT_H__
#define __AMUNIT_H__
#include <am.h>
#include <klib.h>
#include <klib-macros.h>
#include <encoding.h>
void do_init();
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
# See LICENSE for license details.
#*****************************************************************************
# softprefetch-alias.S
#-----------------------------------------------------------------------------
#
# Test that whether the cpu sppourt the softprefetch instruciton.
#
#include "encoding.h"
#define TESTNUM gp
.global do_init
do_init:
li a2, 0x008000c000
li a3, 0x008000cf00
li a5, 0x0000000080 //128 times
li a6, 0x0000000001
la a4, code_page
jr a4
.data
.align
code_page:
.word 0x02166013 //prefetch.r 0x10(a2), offset is 32, base register is a2
.word 0x0236e013 //prefetch.w 0x10(a3), offset is 32, base register is a3
delay_time_1:
sub a5, a5, a6
bnez a5, delay_time_1
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
lw s2, 32(a2)
sw a6, 32(a3)
li a5, 0x0000000080 //128 times
delay_time_2:
sub a5, a5, a6
bnez a5, delay_time_2
.word 0x0000006b
.align 12
data_page: .dword 0

View File

@ -0,0 +1,11 @@
#include <aliastest.h>
void map_kernel_page() {
}
int main() {
printf("Alias test shall pass when difftest gives no error\n");
do_init();
return 0;
}