Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
kathlenemagnus committed Dec 12, 2024
1 parent 7dc8a44 commit 3f7371e
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 184 deletions.
362 changes: 202 additions & 160 deletions core/inst_handlers/a/RvaInsts.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions core/inst_handlers/a/inst_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace atlas

template <typename T> ActionGroup* compute_address_handler(AtlasState* state)
{
static_assert(std::is_same<T, RV64>::value || std::is_same<T, RV32>::value);
static_assert(std::is_same_v<T, RV64> || std::is_same_v<T, RV32>);

const AtlasInstPtr & inst = state->getCurrentInst();
const T rs1_val = inst->getRs1()->dmiRead<uint64_t>();
Expand All @@ -26,12 +26,12 @@ namespace atlas
template <typename RV, typename SIZE, template <typename> class BinaryOp, bool U = true>
ActionGroup* amo_handler(atlas::AtlasState* state)
{
static_assert(std::is_same<RV, RV64>::value || std::is_same<RV, RV32>::value);
static_assert(std::is_same<SIZE, W>::value || std::is_same<SIZE, D>::value);
static_assert(std::is_same_v<RV, RV64> || std::is_same_v<RV, RV32>);
static_assert(std::is_same_v<SIZE, W> || std::is_same_v<SIZE, D>);
static_assert(sizeof(RV) >= sizeof(SIZE));

using Op =
typename std::conditional<std::is_same<RV, RV64>::value,
typename std::conditional<std::is_same_v<RV, RV64>,
typename std::conditional<U, uint64_t, int64_t>::type,
typename std::conditional<U, uint32_t, int32_t>::type>::type;

Expand Down
11 changes: 6 additions & 5 deletions core/inst_handlers/d/RvdInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace atlas
template <typename XLEN>
void RvdInsts::getInstComputeAddressHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand All @@ -29,14 +29,15 @@ namespace atlas
}
else if constexpr (std::is_same_v<XLEN, RV32>)
{
sparta_assert(false, "RV32 is not supported yet!");
// RV32 is not supported yet
static_assert(std::is_same_v<XLEN, RV32> == false);
}
}

template <typename XLEN>
void RvdInsts::getInstHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand Down Expand Up @@ -154,9 +155,9 @@ namespace atlas
}
}

template void RvdInsts::getInstComputeAddressHandlers<RV32>(std::map<std::string, Action> &);
// template void RvdInsts::getInstComputeAddressHandlers<RV32>(std::map<std::string, Action> &);
template void RvdInsts::getInstComputeAddressHandlers<RV64>(std::map<std::string, Action> &);
template void RvdInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
// template void RvdInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
template void RvdInsts::getInstHandlers<RV64>(std::map<std::string, Action> &);

ActionGroup* RvdInsts::fcvt_d_w_64_handler(atlas::AtlasState* state)
Expand Down
11 changes: 6 additions & 5 deletions core/inst_handlers/f/RvfInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace atlas
template <typename XLEN>
void RvfInsts::getInstComputeAddressHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand All @@ -21,14 +21,15 @@ namespace atlas
}
else if constexpr (std::is_same_v<XLEN, RV32>)
{
sparta_assert(false, "RV32 is not supported yet!");
// RV32 is not supported yet
static_assert(std::is_same_v<XLEN, RV32> == false);
}
}

template <typename XLEN>
void RvfInsts::getInstHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand Down Expand Up @@ -128,9 +129,9 @@ namespace atlas
}
}

template void RvfInsts::getInstComputeAddressHandlers<RV32>(std::map<std::string, Action> &);
// template void RvfInsts::getInstComputeAddressHandlers<RV32>(std::map<std::string, Action> &);
template void RvfInsts::getInstComputeAddressHandlers<RV64>(std::map<std::string, Action> &);
template void RvfInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
// template void RvfInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
template void RvfInsts::getInstHandlers<RV64>(std::map<std::string, Action> &);

ActionGroup* RvfInsts::fsqrt_s_64_handler(atlas::AtlasState* state)
Expand Down
11 changes: 6 additions & 5 deletions core/inst_handlers/i/RviInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace atlas
template <typename XLEN>
void RviInsts::getInstComputeAddressHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand Down Expand Up @@ -60,14 +60,15 @@ namespace atlas
}
else if constexpr (std::is_same_v<XLEN, RV32>)
{
sparta_assert(false, "RV32 is not supported yet!");
// RV32 is not supported yet
static_assert(std::is_same_v<XLEN, RV32> == false);
}
}

template <typename XLEN>
void RviInsts::getInstHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace("add",
Expand Down Expand Up @@ -273,9 +274,9 @@ namespace atlas
}
}

template void RviInsts::getInstComputeAddressHandlers<RV32>(std::map<std::string, Action> &);
// template void RviInsts::getInstComputeAddressHandlers<RV32>(std::map<std::string, Action> &);
template void RviInsts::getInstComputeAddressHandlers<RV64>(std::map<std::string, Action> &);
template void RviInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
// template void RviInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
template void RviInsts::getInstHandlers<RV64>(std::map<std::string, Action> &);

ActionGroup* RviInsts::cflush_i_l1_64_handler(atlas::AtlasState* state)
Expand Down
7 changes: 4 additions & 3 deletions core/inst_handlers/m/RvmInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace atlas
template <typename XLEN>
void RvmInsts::getInstHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace("div",
Expand Down Expand Up @@ -55,11 +55,12 @@ namespace atlas
}
else if constexpr (std::is_same_v<XLEN, RV32>)
{
sparta_assert(false, "RV32 is not supported yet!");
// RV32 is not supported yet
static_assert(std::is_same_v<XLEN, RV32> == false);
}
}

template void RvmInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
// template void RvmInsts::getInstHandlers<RV32>(std::map<std::string, Action> &);
template void RvmInsts::getInstHandlers<RV64>(std::map<std::string, Action> &);

ActionGroup* RvmInsts::div_64_handler(atlas::AtlasState* state)
Expand Down
2 changes: 1 addition & 1 deletion core/inst_handlers/zicsr/RvzicsrInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace atlas
template <typename XLEN>
void RvzicsrInsts::getInstHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand Down
2 changes: 1 addition & 1 deletion core/inst_handlers/zifencei/RvzifenceiInsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace atlas
template <typename XLEN>
void RvzifenceiInsts::getInstHandlers(std::map<std::string, Action> & inst_handlers)
{
static_assert(std::is_same_v<XLEN, RV64> || std::is_same<XLEN, RV32>::value);
static_assert(std::is_same_v<XLEN, RV64> || std::is_same_v<XLEN, RV32>);
if constexpr (std::is_same_v<XLEN, RV64>)
{
inst_handlers.emplace(
Expand Down

0 comments on commit 3f7371e

Please sign in to comment.