update idle kernel
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
#define KERNEL_ARG_DEV_MEM_ADDR 0x9fff0000
|
||||
#define DEV_SMEM_START_ADDR 0xff000000
|
||||
#define MARK_BEG() asm volatile ("slti x0, x1, -1047")
|
||||
#define MARK_END() asm volatile ("slti x0, x1, -499")
|
||||
|
||||
typedef struct {
|
||||
uint32_t dim_m;
|
||||
|
||||
39
tests/regression/idle/hello.c
Normal file
39
tests/regression/idle/hello.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
int main() {
|
||||
int value32 = 4097; // Value for x32
|
||||
int value50 = -16778000; // Value for x50
|
||||
int value71 = 2147483647; // Value for x71
|
||||
int value125 = -2147483648; // Value for x125
|
||||
int sum;
|
||||
|
||||
asm volatile (
|
||||
// Assign values to the registers
|
||||
"mv x32, %1\n"
|
||||
"mv x50, %2\n"
|
||||
"mv x71, %3\n"
|
||||
"mv x125, %4\n"
|
||||
|
||||
// Sum the values in the registers
|
||||
"add x32, x32, x50\n" // x32 = x32 + x50
|
||||
"add x32, x32, x71\n" // x32 = x32 + x71
|
||||
"add x32, x32, x125\n" // x32 = x32 + x125
|
||||
|
||||
// Move the result back to a C variable
|
||||
"mv %0, x32\n"
|
||||
: "=r" (sum) // Output
|
||||
: "r" (value32), "r" (value50), "r" (value71), "r" (value125) // Inputs
|
||||
: "x32", "x50", "x71", "x125" // Clobbered registers
|
||||
);
|
||||
volatile bool test = *(&value125 + 4);
|
||||
if (test) {
|
||||
printf("hello world 1!");
|
||||
} else {
|
||||
printf("hello world 2!");
|
||||
}
|
||||
|
||||
// asm volatile (".insn r5 0, 0, 0, x101, x102, x103, x104, x105");
|
||||
|
||||
return sum;
|
||||
}
|
||||
@@ -53,6 +53,7 @@ void kernel_body(int task_id, kernel_arg_t *__UNIFORM__ arg) {
|
||||
asm volatile("li x29, 0xa0a0a0a0");
|
||||
asm volatile("li x30, 0xa0a0a0a0");
|
||||
asm volatile("li x31, 0xa0a0a0a0");
|
||||
MARK_BEG();
|
||||
asm volatile("csrr a0, 0xcc1");
|
||||
asm volatile("beqz a0, bar");
|
||||
asm volatile("vx_tmc zero");
|
||||
|
||||
Reference in New Issue
Block a user