Adds a way to simulate the programs with spike, to compare PCs and debug

This commit is contained in:
2025-11-15 00:57:30 +01:00
parent ca03b29774
commit 0c377a1380
8 changed files with 77 additions and 76 deletions

View File

@@ -6,15 +6,14 @@ use core::arch::asm;
use fpga_lib::{
panic_handler,
register::X31,
vga::{BLUE, GREEN, RED, VGA, WHITE},
vga::{BLUE, FONT_WIDTH, GREEN, RED, VGA, WHITE},
};
panic_handler! {}
#[unsafe(no_mangle)]
pub extern "C" fn _start() -> !
pub extern "C" fn main() -> !
{
unsafe { asm!("la sp, _stack_start") }
// X31::write_const::<0xdead1ffffffff>();
// let test = X31::read() + 10;
//unsafe {
@@ -27,10 +26,45 @@ pub extern "C" fn _start() -> !
// {
// VGA::write_pixel_unsafe(i, i, WHITE);
// }
//unsafe { VGA::draw_char(9, 3, 'S', RED) };
unsafe { VGA::draw_string(3, 3, "{Skibidi toilet !!}", GREEN) };
//let c = core::hint::black_box('S');
let c = core::hint::black_box('S');
//unsafe { VGA::draw_char(10, 10, c, RED) };
//unsafe { VGA::draw_string(3, 3, "{Skibidi toilet !!}", GREEN) };
//}
// for i in 0..2
// {
// unsafe { VGA::draw_char(0 + i as u16 * FONT_WIDTH as u16, 0, c, RED) };
// }
// unsafe { VGA::draw_char(0, 0, c, RED) };
// unsafe { VGA::draw_char(1, 0, c, RED) };
unsafe { VGA::draw_char(1, 0, c, RED) };
unsafe { VGA::draw_char(1, 0, c, GREEN) };
// if (c as u8 > b'~') || ((c as u8) < b' ')
// {
// X31::write_const::<0x01>();
// }
// else
// {
// X31::write_const::<0xFFFFFFFFFFFFFFFF>();
// };
//
// if (c as u8 > b'~') || ((c as u8) < b' ')
// {
// X31::write_const::<0x01>();
// }
// else
// {
// X31::write_const::<0xFFFFFFFFFFFFFFFF>();
// };
// for i in 0..100
// {
// unsafe { VGA::write_pixel_unsafe(i, i, WHITE) };
// }
//
// let mut a = core::hint::black_box(true);
// let mut x = core::hint::black_box(121);
// let mut y = core::hint::black_box(221);