From e898bb751222c4f9d71b3615acc8adc5fa8dc836 Mon Sep 17 00:00:00 2001
From: Alban Gruin <alban.gruin@irit.fr>
Date: Wed, 5 Jan 2022 11:41:24 +0100
Subject: [PATCH] wt_icache: check the SpecDepth value

Signed-off-by: Alban Gruin <alban.gruin@irit.fr>
---
 src/cache_subsystem/wt_icache.sv | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/cache_subsystem/wt_icache.sv b/src/cache_subsystem/wt_icache.sv
index 55e25798..36b78e2a 100644
--- a/src/cache_subsystem/wt_icache.sv
+++ b/src/cache_subsystem/wt_icache.sv
@@ -614,6 +614,12 @@ end else begin : gen_piton_offset
 
   assert (ICACHE_SET_ASSOC==4)
     else $fatal(1,"[l1 icache] cache must be 4-associative");
+
+  assert (2 ** $clog2(SpecDepth) == SpecDepth)
+    else $fatal(1,"[l1 icache] SpecDepth is not a power of 2");
+
+  assert (SpecDepth >= 2)
+    else $fatal(1,"[l1 icache] SpecDepth is lower than 2");
  end
 `endif
 //pragma translate_on
-- 
GitLab