2023-11-25 19:09:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
#include "src/DebugToolDrivers/Protocols/RiscVDebugSpec/RiscVGeneric.hpp"
|
2023-11-25 19:09:14 +00:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
namespace DebugToolDrivers::Protocols::RiscVDebugSpec::DebugModule::Registers
|
2023-11-25 19:09:14 +00:00
|
|
|
{
|
|
|
|
|
struct MemoryAccessControlField
|
|
|
|
|
{
|
|
|
|
|
enum class MemorySize: std::uint8_t
|
|
|
|
|
{
|
|
|
|
|
SIZE_8 = 0x00,
|
|
|
|
|
SIZE_16 = 0x01,
|
|
|
|
|
SIZE_32 = 0x02,
|
|
|
|
|
SIZE_64 = 0x03,
|
|
|
|
|
SIZE_128 = 0x04,
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-04 00:13:55 +01:00
|
|
|
bool write:1;
|
|
|
|
|
bool postIncrement:1;
|
|
|
|
|
MemorySize size:3;
|
|
|
|
|
bool virtualAddress:1;
|
2023-11-25 19:09:14 +00:00
|
|
|
|
2024-07-23 21:14:22 +01:00
|
|
|
constexpr MemoryAccessControlField(
|
2023-11-25 19:09:14 +00:00
|
|
|
bool write,
|
|
|
|
|
bool postIncrement,
|
|
|
|
|
MemorySize size,
|
|
|
|
|
bool virtualAddress
|
|
|
|
|
)
|
|
|
|
|
: write(write)
|
|
|
|
|
, postIncrement(postIncrement)
|
|
|
|
|
, size(size)
|
|
|
|
|
, virtualAddress(virtualAddress)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
constexpr explicit MemoryAccessControlField(std::uint32_t controlValue)
|
|
|
|
|
: write(static_cast<bool>(controlValue & (0x01 << 16)))
|
|
|
|
|
, postIncrement(static_cast<bool>(controlValue & (0x01 << 19)))
|
|
|
|
|
, size(static_cast<MemorySize>((controlValue >> 20) & 0x07))
|
|
|
|
|
, virtualAddress(static_cast<bool>(controlValue & (0x01 << 23)))
|
|
|
|
|
{}
|
|
|
|
|
|
2024-03-29 16:31:14 +00:00
|
|
|
[[nodiscard]] constexpr std::uint32_t value() const {
|
2023-11-25 19:09:14 +00:00
|
|
|
return std::uint32_t{0}
|
|
|
|
|
| static_cast<std::uint32_t>(this->write) << 16
|
|
|
|
|
| static_cast<std::uint32_t>(this->postIncrement) << 19
|
|
|
|
|
| static_cast<std::uint32_t>(this->size) << 20
|
|
|
|
|
| static_cast<std::uint32_t>(this->virtualAddress) << 23
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|