Skip to content

Commit

Permalink
Merge pull request #41 from sparcians/dev/bdutro/add-custom-iem-printer
Browse files Browse the repository at this point in the history
Add a custom print function for INST_IEM enums
  • Loading branch information
bdutro authored Jul 23, 2024
2 parents b874cc0 + 96140ac commit 94074fa
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion stf-inc/stf_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace stf {
*
*/
STF_ENUM(
STF_ENUM_CONFIG(AUTO_PRINT, OVERRIDE_START, OVERRIDE_END),
STF_ENUM_CONFIG(OVERRIDE_START, OVERRIDE_END),
INST_IEM,
uint16_t,
STF_INST_IEM_INVALID, /**< Invalid */
Expand All @@ -38,6 +38,27 @@ namespace stf {
STF_ENUM_VAL(STF_INST_IEM_RESERVED, 0xFFFF)
);

inline std::ostream& operator<<(std::ostream& os, const INST_IEM iem)
{
switch(iem)
{
case INST_IEM::STF_INST_IEM_INVALID:
os << "INVALID";
break;
case INST_IEM::STF_INST_IEM_RV32:
os << "RV32";
break;
case INST_IEM::STF_INST_IEM_RV64:
os << "RV64";
break;
case INST_IEM::STF_INST_IEM_RESERVED:
os << "RESERVED";
break;
}

return os;
}

/**
* \enum BUS_MASTER
*
Expand Down

0 comments on commit 94074fa

Please sign in to comment.