From 01f161fa1ac86e75524bf038e51a236f0dfb22a6 Mon Sep 17 00:00:00 2001 From: David Li Date: Sun, 3 Jan 2016 13:47:01 -0700 Subject: Add MMU to core --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 66afe2a..5dda62e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with rustv. If not, see . -#![feature(step_by)] +#![feature(braced_empty_structs, step_by)] pub mod isa; pub mod binary; pub mod memory; @@ -28,10 +28,11 @@ fn it_works() { use std::path::Path; match binary::Binary::new_from_hex_file(Path::new("../riscv/kernel.hex")) { Ok(b) => { + let mmu = memory::IdentityMmu::new(); let memory = memory::Memory::new_from_binary(0x2000, b); let memory_ref = Rc::new(RefCell::new(Box::new(memory) as Box)); let cache = Rc::new( RefCell::new( Box::new( memory::DirectMappedCache::new(4, 4, memory_ref.clone())) as Box) ); - let core = simulator::Core::new(cache.clone()); + let core = simulator::Core::new(cache.clone(), Box::new(mmu)); let mut simulator = simulator::Simulator::new(vec![core], memory_ref.clone()); simulator.run(); }, -- cgit v1.2.3