diff options
author | David Li <li.davidm96@gmail.com> | 2016-01-01 11:01:38 -0700 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2016-01-01 11:01:38 -0700 |
commit | d916938c7cd8954fa7f6d21815dc11f8aca211f9 (patch) | |
tree | f1c4dfae2c86096c7ea3d0e27a9b30493ea5c577 /src/lib.rs | |
parent | 0440fb92abc0ac72d03787aa24238deb22abbb7b (diff) |
Test use of cache in simulation
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -30,7 +30,8 @@ fn it_works() { Ok(b) => { let memory = memory::Memory::new_from_binary(0x2000, b); let memory_ref = Rc::new(RefCell::new(Box::new(memory) as Box<memory::MemoryInterface>)); - let core = simulator::Core::new(memory_ref.clone()); + 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 mut simulator = simulator::Simulator::new(vec![core], memory_ref.clone()); simulator.run(); }, @@ -47,7 +48,7 @@ mod tests { use std::cell::RefCell; let memory = Memory::new(16); - let memory_ref = Rc::new(RefCell::new(memory)); + let memory_ref = Rc::new(RefCell::new(Box::new(memory) as Box<MemoryInterface>)); let dm_cache_word = DirectMappedCache::new(4, 1, memory_ref.clone()); let dm_cache_doubleword = DirectMappedCache::new(4, 2, memory_ref.clone()); |