Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Index/MutIndex impl requirement from mem trait #148

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pranav12321
Copy link
Contributor

No description provided.

Copy link
Member

@rrbutani rrbutani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good!

I think you can also drop the Index/IndexMut impl from MemoryStub.

@@ -10,13 +10,9 @@ use core::ops::{Index, IndexMut};
// Changes written with commit_page persist when reset is called.
// Changes written with write_word must not.
pub trait Memory: Index<Addr, Output = Word> + IndexMut<Addr, Output = Word> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub trait Memory: Index<Addr, Output = Word> + IndexMut<Addr, Output = Word> {
pub trait Memory {

Comment on lines +42 to +46

fn read_word(&self, addr: Addr) -> Word{0 as u16}

fn write_word(&mut self, addr: Addr, word: Word){}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a change in behavior from the defaulted read_word/write_word on MemoryStub which would return your last write but that's fine; I don't think we were relying on this anywhere.

@rrbutani rrbutani changed the base branch from master to main August 10, 2022 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants