mem-cache: AMPM Prefetcher fails when restoring from a checkpoint

The preriodic event triggers an assertion due to an incorrect tick value to
schedule when restoring from a checkpoint.

Change-Id: I9454dd0c97d5a098f8a409886e63f7a7e990947c
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17732
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
diff --git a/src/mem/cache/prefetch/access_map_pattern_matching.cc b/src/mem/cache/prefetch/access_map_pattern_matching.cc
index df2a9f7..731d606 100644
--- a/src/mem/cache/prefetch/access_map_pattern_matching.cc
+++ b/src/mem/cache/prefetch/access_map_pattern_matching.cc
@@ -57,9 +57,12 @@
 {
     fatal_if(!isPowerOf2(hotZoneSize),
         "the hot zone size must be a power of 2");
-    if (!epochEvent.scheduled()) {
-        schedule(epochEvent, clockEdge(epochCycles));
-    }
+}
+
+void
+AccessMapPatternMatching::startup()
+{
+    schedule(epochEvent, clockEdge(epochCycles));
 }
 
 void
@@ -153,6 +156,7 @@
     std::vector<QueuedPrefetcher::AddrPriority> &addresses)
 {
     assert(addresses.empty());
+
     bool is_secure = pfi.isSecure();
     Addr am_addr = pfi.getAddr() / hotZoneSize;
     Addr current_block = (pfi.getAddr() % hotZoneSize) / blkSize;
diff --git a/src/mem/cache/prefetch/access_map_pattern_matching.hh b/src/mem/cache/prefetch/access_map_pattern_matching.hh
index 0968e64..397bc78 100644
--- a/src/mem/cache/prefetch/access_map_pattern_matching.hh
+++ b/src/mem/cache/prefetch/access_map_pattern_matching.hh
@@ -180,6 +180,7 @@
     AccessMapPatternMatching(const AccessMapPatternMatchingParams* p);
     ~AccessMapPatternMatching()
     {}
+    void startup() override;
     void calculatePrefetch(const BasePrefetcher::PrefetchInfo &pfi,
         std::vector<QueuedPrefetcher::AddrPriority> &addresses);
 };