#include "ROM8.h" //---------------------------------------------------------------------------------------------------------------------- // Constructors //---------------------------------------------------------------------------------------------------------------------- ROM8::ROM8(const std::wstring& implementationName, const std::wstring& instanceName, unsigned int moduleID) :ROMBase(implementationName, instanceName, moduleID) { } //---------------------------------------------------------------------------------------------------------------------- // Memory interface functions //---------------------------------------------------------------------------------------------------------------------- IBusInterface::AccessResult ROM8::ReadInterface(unsigned int interfaceNumber, unsigned int location, Data& data, IDeviceContext* caller, double accessTime, unsigned int accessContext) { data = _memoryArray[LimitLocationToMemorySize(location)]; return true; } //---------------------------------------------------------------------------------------------------------------------- IBusInterface::AccessResult ROM8::WriteInterface(unsigned int interfaceNumber, unsigned int location, const Data& data, IDeviceContext* caller, double accessTime, unsigned int accessContext) { return true; } //---------------------------------------------------------------------------------------------------------------------- void ROM8::TransparentReadInterface(unsigned int interfaceNumber, unsigned int location, Data& data, IDeviceContext* caller, unsigned int accessContext) { data = _memoryArray[LimitLocationToMemorySize(location)]; } //---------------------------------------------------------------------------------------------------------------------- void ROM8::TransparentWriteInterface(unsigned int interfaceNumber, unsigned int location, const Data& data, IDeviceContext* caller, unsigned int accessContext) { _memoryArray[LimitLocationToMemorySize(location)] = (unsigned char)data.GetData(); } //---------------------------------------------------------------------------------------------------------------------- // Debug memory access functions //---------------------------------------------------------------------------------------------------------------------- unsigned int ROM8::ReadMemoryEntry(unsigned int location) const { return _memoryArray[LimitLocationToMemorySize(location)]; } //---------------------------------------------------------------------------------------------------------------------- void ROM8::WriteMemoryEntry(unsigned int location, unsigned int data) { _memoryArray[LimitLocationToMemorySize(location)] = (unsigned char)data; }