Finishing to clean tests and adding the start of the bus logger

This commit is contained in:
Anonymus Raccoon
2020-03-24 01:53:45 +01:00
parent 09cd825bed
commit 95f17c06a8
47 changed files with 2421 additions and 2176 deletions
+9 -2
View File
@@ -3,13 +3,15 @@
//
#include <cstring>
#include <utility>
#include "Ram.hpp"
#include "../Exceptions/InvalidAddress.hpp"
namespace ComSquare::Ram
{
Ram::Ram(size_t size)
: _size(size)
Ram::Ram(size_t size, std::string ramName)
: _size(size),
_ramName(std::move(ramName))
{
if (size == 0)
this->_data = nullptr;
@@ -51,4 +53,9 @@ namespace ComSquare::Ram
{
return this->_size;
}
std::string Ram::getName()
{
return this->_ramName;
}
}
+9 -4
View File
@@ -5,25 +5,27 @@
#ifndef COMSQUARE_RAM_HPP
#define COMSQUARE_RAM_HPP
#include "../Memory/IRectangleMemory.hpp"
#include "../Memory/ARectangleMemory.hpp"
namespace ComSquare::Ram
{
class Ram : public Memory::IRectangleMemory {
class Ram : public Memory::ARectangleMemory {
protected:
//! @brief The ram. (Can be used for WRam, SRam, VRam etc)
uint8_t *_data;
//! @brief The size of the ram (iny bytes).
size_t _size;
//! @brief The name of this ram.
std::string _ramName;
public:
//! @brief Create a ram of a given size in bytes.
explicit Ram(size_t size);
explicit Ram(size_t size, std::string ramName);
//! @brief The ram can't be copied.
Ram(const Ram &) = delete;
//! @brief The ram can't be assigned.
Ram &operator=(Ram &) = delete;
//! @brief Destructor that free the ram.
~Ram();
~Ram() override;
//! @brief Read from the ram.
//! @param addr The address to read from. The address 0x0 should refer to the first byte of this ram.
//! @throw InvalidAddress will be thrown if the address is more than the size of the ram.
@@ -41,6 +43,9 @@ namespace ComSquare::Ram
//! @param value replace value
void memset(uint24_t start, uint24_t end, uint8_t value);
//! @brief Get the name of this accessor (used for debug purpose)
std::string getName() override;
//! @brief Get the size of the ram in bytes.
size_t getSize();
};