Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
funnsam committed Jul 3, 2024
1 parent f4f7fdb commit d7d9f7f
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 18 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Todo
- pma
- pmp
- io stuff
- clint
- plic
- uart

# Goals
- xv6
- linux
- make it stupidly fast
4 changes: 1 addition & 3 deletions emu/src/cpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ mod mmu;

pub struct Cpu<'a> {
bus: &'a mut bus::Bus<'a>,
io: &'a mut io::Io,

regs: [u64; 31],
float_regs: [u64; 32],
Expand All @@ -21,10 +20,9 @@ pub struct Cpu<'a> {
}

impl<'a> Cpu<'a> {
pub fn new(bus: &'a mut bus::Bus<'a>, io: &'a mut io::Io) -> Self {
pub fn new(bus: &'a mut bus::Bus<'a>) -> Self {
let mut cpu = Self {
bus,
io,

regs: [0; 31],
float_regs: [0; 32],
Expand Down
7 changes: 0 additions & 7 deletions emu/src/io.rs

This file was deleted.

1 change: 0 additions & 1 deletion emu/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub mod bus;
pub mod cpu;
pub mod io;
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ fn main() {
let mut ram = std::fs::read(&args.prog).unwrap();
ram.resize(0x10000, 0);
let mut bus = emu::bus::Bus::new(&mut ram);
let mut io = emu::io::Io::new();
let mut cpu = emu::cpu::Cpu::new(&mut bus, &mut io);
let mut cpu = emu::cpu::Cpu::new(&mut bus);

loop {
cpu.step(args.testing);
Expand Down
2 changes: 1 addition & 1 deletion tests/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://github.com/riscv-software-src/riscv-tests
Compiled from https://github.com/riscv-software-src/riscv-tests
4 changes: 0 additions & 4 deletions todo.txt

This file was deleted.

18 changes: 18 additions & 0 deletions uart_hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
int main() {
volatile char *uart = (volatile char *) 0x10000000;
uart[0] = 'H';
uart[0] = 'e';
uart[0] = 'l';
uart[0] = 'l';
uart[0] = 'o';
uart[0] = ',';
uart[0] = ' ';
uart[0] = 'w';
uart[0] = 'o';
uart[0] = 'r';
uart[0] = 'l';
uart[0] = 'd';
uart[0] = '!';
uart[0] = '\n';
return 0;
}

0 comments on commit d7d9f7f

Please sign in to comment.