Add registers in rust

This commit is contained in:
2025-11-12 23:51:16 +01:00
parent 8326c1f169
commit 3044a54a09
12 changed files with 98 additions and 32 deletions

View File

@@ -0,0 +1,7 @@
[package]
name = "hello-rust"
version = "0.1.0"
edition = "2024"
[dependencies]
fpga-lib = { path = "../fpga-lib" }

View 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 {}
}