From db87eb77a9e0a0f12f959da51a5e63d702c9351a Mon Sep 17 00:00:00 2001 From: David Li Date: Sat, 2 Jan 2016 11:14:22 -0700 Subject: Use type alias to clean up signatures --- src/simulator.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/simulator.rs b/src/simulator.rs index e882c9a..558f2b1 100644 --- a/src/simulator.rs +++ b/src/simulator.rs @@ -1,4 +1,4 @@ -// Copyright 2015 David Li +// Copyright 2016 David Li // This file is part of rustv. // rustv is free software: you can redistribute it and/or modify @@ -14,11 +14,8 @@ // You should have received a copy of the GNU General Public License // along with rustv. If not, see . -use std::cell::RefCell; -use std::rc::Rc; - use isa; -use memory::{MemoryInterface, MemoryError}; +use memory::{MemoryInterface, MemoryError, SharedMemory}; struct RegisterFile { registers: [isa::Word; 32], @@ -29,13 +26,12 @@ pub struct Core<'a> { registers: RegisterFile, stall: u32, running: bool, - // TODO: change to memory::SharedMemory - cache: Rc>>, + cache: SharedMemory<'a>, } pub struct Simulator<'a> { cores: Vec>, - memory: Rc>>, + memory: SharedMemory<'a>, } #[derive(Debug)] @@ -78,7 +74,7 @@ impl RegisterFile { impl<'a> Core<'a> { // TODO: take Rc> to Memory as well? - pub fn new(cache: Rc>>) -> Core<'a> { + pub fn new(cache: SharedMemory<'a>) -> Core<'a> { Core { pc: 0x1002c, // TODO: hardcoded: fix later registers: RegisterFile::new(), @@ -348,7 +344,8 @@ impl<'a> Core<'a> { } impl<'a> Simulator<'a> { - pub fn new(cores: Vec>, memory: Rc>>) -> Simulator<'a> { + pub fn new(cores: Vec>, memory: SharedMemory<'a>) + -> Simulator<'a> { // TODO: pass in GP, SP, _start // TODO: initialize GP, registers (GP is in headers) Simulator { -- cgit v1.2.3