Renamed RiscVDebugSpec to RiscVDebug

This commit is contained in:
Nav
2025-02-02 13:32:25 +00:00
parent a5e027b944
commit f3cd55e53f
33 changed files with 65 additions and 65 deletions

View File

@@ -0,0 +1,38 @@
#pragma once
#include <cstdint>
#include <cassert>
#include "src/DebugToolDrivers/Protocols/RiscVDebug/DebugModule/DebugModule.hpp"
namespace DebugToolDrivers::Protocols::RiscVDebug::DebugModule::Registers
{
struct AbstractCommandRegister
{
enum class CommandType: std::uint8_t
{
REGISTER_ACCESS = 0x00,
QUICK_ACCESS = 0x01,
MEMORY_ACCESS = 0x02,
};
std::uint32_t control;
CommandType commandType;
static constexpr AbstractCommandRegister fromValue(RegisterValue value) {
return {
.control = static_cast<std::uint32_t>(value & 0x00FFFFFF),
.commandType = static_cast<CommandType>((value >> 24) & 0xFF),
};
}
[[nodiscard]] constexpr RegisterValue value() const {
assert(this->control <= 0x00FFFFFF);
return RegisterValue{0}
| static_cast<RegisterValue>(this->control & 0x00FFFFFF)
| static_cast<RegisterValue>(this->commandType) << 24
;
}
};
}