diff options
author | Jordi Vaquero <jordi.vaquero@metempsy.com> | 2019-07-05 19:02:05 +0200 |
---|---|---|
committer | Jordi Vaquero <jordi.vaquero@metempsy.com> | 2019-08-07 17:19:11 +0000 |
commit | 5f0ffd5d49ee5907847f398bbd976f0ebb785e36 (patch) | |
tree | bf5442148dc4f84591f447398ba4b8bd59f5fbe9 /src/arch/arm | |
parent | 92abad849186256f4a4b309ed867d375d07c5c63 (diff) | |
download | gem5-5f0ffd5d49ee5907847f398bbd976f0ebb785e36.tar.xz |
arch-arm: Add TypeAtomicOp class to be used by new atomic instructions
Creating a new object TypeAtomicOp that will be used by the atomic
instructions following gem5 AMO feature.
Change-Id: If082b596fb37d7a1cb569a4320c23505591df6a5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/19810
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/arch/arm')
-rw-r--r-- | src/arch/arm/insts/mem64.hh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/arch/arm/insts/mem64.hh b/src/arch/arm/insts/mem64.hh index 8e21bb3b6..34eb43fa9 100644 --- a/src/arch/arm/insts/mem64.hh +++ b/src/arch/arm/insts/mem64.hh @@ -260,6 +260,52 @@ class MemoryLiteral64 : public Memory64 std::string generateDisassembly( Addr pc, const SymbolTable *symtab) const override; }; + +/** + * A generic atomic op class + */ + +template<typename T> +class AtomicGeneric2Op : public TypedAtomicOpFunctor<T> +{ + public: + AtomicGeneric2Op(T _a, std::function<void(T*,T)> _op) + : a(_a), op(_op) + {} + AtomicOpFunctor* clone() override + { + return new AtomicGeneric2Op<T>(*this); + } + void execute(T *b) override + { + op(b, a); + } + private: + T a; + std::function<void(T*,T)> op; + }; + +template<typename T> +class AtomicGeneric3Op : public TypedAtomicOpFunctor<T> +{ + public: + AtomicGeneric3Op(T _a, T _c, std::function<void(T*, T, T)> _op) + : a(_a), c(_c), op(_op) + {} + AtomicOpFunctor* clone() override + { + return new AtomicGeneric3Op<T>(*this); + } + void execute(T *b) override + { + op(b, a, c); + } + private: + T a; + T c; + std::function<void(T*, T, T)> op; +}; + } #endif //__ARCH_ARM_INSTS_MEM_HH__ |