From: Faissal Sleiman Date: Thu, 17 Oct 2013 15:20:45 +0000 (-0500) Subject: cpu: Put in assertions to check for maximum supported LQ/SQ size X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e516531bd0010eec4ab3352ff0b12057782a40ce;p=gem5.git cpu: Put in assertions to check for maximum supported LQ/SQ size LSQSenderState represents the LQ/SQ index using uint8_t, which supports up to 256 entries (including the sentinel entry). Sending packets to memory with a higher index than 255 truncates the index, such that the response matches the wrong entry. For instance, this can result in a deadlock if a store completion does not clear the head entry. --- diff --git a/src/cpu/o3/lsq_unit_impl.hh b/src/cpu/o3/lsq_unit_impl.hh index 077af1dd7..44b8e9041 100644 --- a/src/cpu/o3/lsq_unit_impl.hh +++ b/src/cpu/o3/lsq_unit_impl.hh @@ -158,6 +158,10 @@ LSQUnit::init(O3CPU *cpu_ptr, IEW *iew_ptr, DerivO3CPUParams *params, LQEntries = maxLQEntries + 1; SQEntries = maxSQEntries + 1; + //Due to uint8_t index in LSQSenderState + assert(LQEntries <= 256); + assert(SQEntries <= 256); + loadQueue.resize(LQEntries); storeQueue.resize(SQEntries); @@ -306,6 +310,7 @@ LSQUnit::resizeLQ(unsigned size) LQEntries = size_plus_sentinel; } + assert(LQEntries <= 256); } template @@ -322,6 +327,8 @@ LSQUnit::resizeSQ(unsigned size) } else { SQEntries = size_plus_sentinel; } + + assert(SQEntries <= 256); } template