test
This commit is contained in:
21
src/main.rs
21
src/main.rs
@@ -1,6 +1,6 @@
|
||||
use std::io::Read;
|
||||
use std::io::BufReader;
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
use std::io::Read;
|
||||
|
||||
const XLEN: usize = 32;
|
||||
|
||||
@@ -40,13 +40,13 @@ impl Default for Bus {
|
||||
}
|
||||
|
||||
struct Instruction {
|
||||
opcode: u8,
|
||||
rd: u8,
|
||||
rs1: u8,
|
||||
rs2: u8,
|
||||
funct3: u8,
|
||||
funct7: u8,
|
||||
imm: u32,
|
||||
opcode: Byte,
|
||||
rd: Byte,
|
||||
rs1: Byte,
|
||||
rs2: Byte,
|
||||
funct3: Byte,
|
||||
funct7: Byte,
|
||||
imm: Word,
|
||||
}
|
||||
|
||||
struct VMRV32I {
|
||||
@@ -98,6 +98,7 @@ fn main() {
|
||||
println!("VM Starting Up");
|
||||
|
||||
let mut cpu = VMRV32I::new();
|
||||
cpu.load_prog("test.bin");
|
||||
cpu.load_prog("./test/test.bin");
|
||||
cpu.init_cpu();
|
||||
}
|
||||
|
||||
|
||||
BIN
test/test.bin
Executable file
BIN
test/test.bin
Executable file
Binary file not shown.
22
test/test.s
Normal file
22
test/test.s
Normal file
@@ -0,0 +1,22 @@
|
||||
.file "test.c"
|
||||
.option nopic
|
||||
.attribute arch, "rv32i2p1"
|
||||
.attribute unaligned_access, 0
|
||||
.attribute stack_align, 16
|
||||
.text
|
||||
.align 2
|
||||
.globl main
|
||||
.type main, @function
|
||||
main:
|
||||
addi sp,sp,-32
|
||||
sw s0,28(sp)
|
||||
addi s0,sp,32
|
||||
li a5,3
|
||||
sw a5,-20(s0)
|
||||
li a5,0
|
||||
mv a0,a5
|
||||
lw s0,28(sp)
|
||||
addi sp,sp,32
|
||||
jr ra
|
||||
.size main, .-main
|
||||
.ident "GCC: (g2ee5e430018) 12.2.0"
|
||||
Reference in New Issue
Block a user