Skip to content

Commit 94074fa

Browse files
authored
Merge pull request #41 from sparcians/dev/bdutro/add-custom-iem-printer
Add a custom print function for INST_IEM enums
2 parents b874cc0 + 96140ac commit 94074fa

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

stf-inc/stf_enums.hpp

+22-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace stf {
2929
*
3030
*/
3131
STF_ENUM(
32-
STF_ENUM_CONFIG(AUTO_PRINT, OVERRIDE_START, OVERRIDE_END),
32+
STF_ENUM_CONFIG(OVERRIDE_START, OVERRIDE_END),
3333
INST_IEM,
3434
uint16_t,
3535
STF_INST_IEM_INVALID, /**< Invalid */
@@ -38,6 +38,27 @@ namespace stf {
3838
STF_ENUM_VAL(STF_INST_IEM_RESERVED, 0xFFFF)
3939
);
4040

41+
inline std::ostream& operator<<(std::ostream& os, const INST_IEM iem)
42+
{
43+
switch(iem)
44+
{
45+
case INST_IEM::STF_INST_IEM_INVALID:
46+
os << "INVALID";
47+
break;
48+
case INST_IEM::STF_INST_IEM_RV32:
49+
os << "RV32";
50+
break;
51+
case INST_IEM::STF_INST_IEM_RV64:
52+
os << "RV64";
53+
break;
54+
case INST_IEM::STF_INST_IEM_RESERVED:
55+
os << "RESERVED";
56+
break;
57+
}
58+
59+
return os;
60+
}
61+
4162
/**
4263
* \enum BUS_MASTER
4364
*

0 commit comments

Comments
 (0)