Closed AlessioC31 closed 1 year ago
LGTM, left a couple of comments... Also we should consider the trait
pub trait IoDevice {
Is this still useful? Or should we change it?
Thanks, I think that once we move to this new approach the IoDevice
trait will be unused
The idea of this PR is to propose a new way to manage memory and hardware components. Before we had everything under
InternalMemory
but every field was just containing registers. This is not suitable now that we approach implementing the LCD since it has also its login instead of just a bunch of registers.Also, having everything under
InternalMemory
was not "semantically" correct in my opinion, hardware components are external components to the CPU.If we agree with this type of refactoring, we would also get rid of the
IORegister
struct which is useless at this point. I added it many months ago to try to handle read/write access through it but then we saw that it was not possible.To manage read/write access we could do something like this:
pub
pub
I also changed a bit the read/write functions in
Bus
. Now we havewrite_raw
andread_raw
that map every address to the correct component and we have wrappers likeread_word
,write_word
,read_half_word
, etc... that should calculate how many wait cycles the CPU has to be stopped (depending on wait cycles and bus width of the component).