diff options
Diffstat (limited to 'src/mem/slicc')
-rw-r--r-- | src/mem/slicc/symbols/Type.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mem/slicc/symbols/Type.py b/src/mem/slicc/symbols/Type.py index bd92e20c9..e62758305 100644 --- a/src/mem/slicc/symbols/Type.py +++ b/src/mem/slicc/symbols/Type.py @@ -459,6 +459,7 @@ out << "${{dm.ident}} = " << printAddress(m_${{dm.ident}}) << " ";''') code('#include "mem/protocol/AccessPermission.hh"') if self.isMachineType: + code('#include <functional>') code('#include "base/misc.hh"') code('#include "mem/ruby/common/Address.hh"') code('#include "mem/ruby/common/TypeDefines.hh"') @@ -498,6 +499,20 @@ std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj); ${{self.c_ident}} &operator++(${{self.c_ident}} &e); ''') + if self.isMachineType: + code(''' + +// define a hash function for the MachineType class +namespace std { +template<> +struct hash<MachineType> { + std::size_t operator()(const MachineType &mtype) const { + return hash<size_t>()(static_cast<size_t>(mtype)); + } +}; +} + +''') # MachineType hack used to set the base component id for each Machine if self.isMachineType: code(''' |