Moving files to simulator module

This commit is contained in:
Quentin Legot 2023-01-11 14:58:12 +01:00
parent 27cd7d35c7
commit b1909e3280
5 changed files with 9 additions and 8 deletions

View File

@ -1,7 +1,6 @@
mod decode; mod simulator;
mod print;
mod machine; use simulator::machine::Machine;
use machine::Machine;
fn main() { fn main() {
let mut m = Machine::_init_machine(); let mut m = Machine::_init_machine();

View File

@ -1,5 +1,4 @@
use crate::decode::*; use super::{decode::{Instruction, decode}, print::*};
use crate::print::*;
/// doit disparaitre /// doit disparaitre
const MEM_SIZE : usize= 4096; const MEM_SIZE : usize= 4096;

3
src/simulator/mod.rs Normal file
View File

@ -0,0 +1,3 @@
pub mod machine;
pub mod decode;
pub mod print;

View File

@ -1,6 +1,6 @@
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_variables)] #![allow(unused_variables)]
use crate::decode::Instruction; use super::decode::{Instruction};
pub const RISCV_LUI: u8 = 0x37; pub const RISCV_LUI: u8 = 0x37;
@ -307,8 +307,8 @@ pub fn print(ins: Instruction, pc: i32) -> String { //TODO pc should be u64
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::simulator::{decode, print};
use crate::{print, decode};
#[test] #[test]
fn test_op() { fn test_op() {