diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-03 13:47:01 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-03 13:47:01 -0700 |
commit | 01f161fa1ac86e75524bf038e51a236f0dfb22a6 (patch) | |
tree | ea8287ce33ecb68c384b90c5343cf208ab459576 /src/lib.rs | |
parent | e70bcb8e1838f5c88cdea19967835f112a8f1bd8 (diff) |
Add MMU to core
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with rustv. If not, see <http://www.gnu.org/licenses/>. -#![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<memory::MemoryInterface>)); let cache = Rc::new( RefCell::new( Box::new( memory::DirectMappedCache::new(4, 4, memory_ref.clone())) as Box<memory::MemoryInterface>) ); - 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(); }, |