Add registers in rust
This commit is contained in:
26
bench/programs_rust/hello-rust/src/main.rs
Normal file
26
bench/programs_rust/hello-rust/src/main.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::arch::asm;
|
||||
|
||||
use fpga_lib::{panic_handler, register::X31};
|
||||
|
||||
panic_handler! {}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn _start() -> ! {
|
||||
X31::write_const::<0xdead1ffffffff>();
|
||||
let test = X31::read() + 10;
|
||||
unsafe {
|
||||
asm!(
|
||||
"add x31, x0, x0",
|
||||
"add x31, x0, {}", in(reg) test
|
||||
);
|
||||
|
||||
const VGA: *mut u8 = 0x80000000 as *mut u8;
|
||||
VGA.write_volatile(255);
|
||||
// VGA.add(1).write_volatile(255);
|
||||
}
|
||||
|
||||
loop {}
|
||||
}
|
||||
Reference in New Issue
Block a user