cpu: Add byteEnable assertions to readMem and initateMemRead
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 27 Nov 2019 15:45:57 +0000 (15:45 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 11 Dec 2019 15:07:52 +0000 (15:07 +0000)
Those are already present in writeMem; looking for consistency

Change-Id: Ib85e0db228bc73e3ac64155d1290444cf6864a8c
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23281
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>

src/cpu/base_dyn_inst.hh
src/cpu/checker/cpu.cc
src/cpu/minor/exec_context.hh
src/cpu/simple/exec_context.hh

index 4b4b05c1dbd210a1983230d6ad7b14ca015a0ae9..c228357ce9764bcf161a7c36cbe22e7a3cf6b4c2 100644 (file)
@@ -965,6 +965,7 @@ BaseDynInst<Impl>::initiateMemRead(Addr addr, unsigned size,
                                    Request::Flags flags,
                                    const std::vector<bool>& byteEnable)
 {
+    assert(byteEnable.empty() || byteEnable.size() == size);
     return cpu->pushRequest(
             dynamic_cast<typename DynInstPtr::PtrType>(this),
             /* ld */ true, nullptr, size, addr, flags, nullptr, nullptr,
@@ -977,6 +978,7 @@ BaseDynInst<Impl>::writeMem(uint8_t *data, unsigned size, Addr addr,
                             Request::Flags flags, uint64_t *res,
                             const std::vector<bool>& byteEnable)
 {
+    assert(byteEnable.empty() || byteEnable.size() == size);
     return cpu->pushRequest(
             dynamic_cast<typename DynInstPtr::PtrType>(this),
             /* st */ false, data, size, addr, flags, res, nullptr, byteEnable);
index cca6d6b12480b0cb5b1139ebbb0b1233c14f45c2..48ee05985d38fa5dc1dddbb092deb4c7a7849498 100644 (file)
@@ -178,6 +178,8 @@ CheckerCPU::readMem(Addr addr, uint8_t *data, unsigned size,
                     Request::Flags flags,
                     const std::vector<bool>& byteEnable)
 {
+    assert(byteEnable.empty() || byteEnable.size() == size);
+
     Fault fault = NoFault;
     bool checked_flags = false;
     bool flags_match = true;
index 184dd29101ba86f5b3872670e8988cb1c42fd008..9b347b225a1b794f3ede4ac939bd0d35e393079f 100644 (file)
@@ -116,6 +116,7 @@ class ExecContext : public ::ExecContext
                     const std::vector<bool>& byteEnable = std::vector<bool>())
         override
     {
+        assert(byteEnable.empty() || byteEnable.size() == size);
         return execute.getLSQ().pushRequest(inst, true /* load */, nullptr,
             size, addr, flags, nullptr, nullptr, byteEnable);
     }
index 48a9f94232b54be7b3223e36ae0ed6d22fb1fbb1..8e4aa3961130b711a1ea6800c50d15f6379aafa5 100644 (file)
@@ -440,6 +440,7 @@ class SimpleExecContext : public ExecContext {
             const std::vector<bool>& byteEnable = std::vector<bool>())
         override
     {
+        assert(byteEnable.empty() || byteEnable.size() == size);
         return cpu->readMem(addr, data, size, flags, byteEnable);
     }
 
@@ -449,6 +450,7 @@ class SimpleExecContext : public ExecContext {
                     const std::vector<bool>& byteEnable = std::vector<bool>())
         override
     {
+        assert(byteEnable.empty() || byteEnable.size() == size);
         return cpu->initiateMemRead(addr, size, flags, byteEnable);
     }