Skip to content

Commit 582d223

Browse files
committed
Resolve introduced recursion by switching from currentlyEnabled to hartSupports
1 parent c66d22d commit 582d223

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

model/riscv_extensions.sail

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -285,41 +285,49 @@ enum clause extension = Ext_Zvkt
285285
mapping clause extensionName = Ext_Zvkt <-> "zvkt"
286286
function clause hartSupports(Ext_Zvkt) = config extensions.Zvkt.supported
287287
function clause currentlyEnabled(Ext_Zvkt) = hartSupports(Ext_Zvkt)
288-
// The following extensions are superset/shorthand extensions that cannot be directly
289-
// configured in the config file and are not part of the device-tree. These extensions
290-
// are automatically enabled when all their required component extensions are enabled.
291-
// This approach simplifies checking for support of subset extensions
288+
// The following extensions are superset/shorthand extensions. They cannot be directly
289+
// configured in the config file, aren't part of the device-tree and shouldn't be
290+
// added to the extension list. These extensions are automatically enabled when all
291+
// their required subset extensions are enabled.
292292
enum clause extension = Ext_Zvkn
293293
mapping clause extensionName = Ext_Zvkn <-> "zvkn"
294+
function clause hartSupports(Ext_Zvkn) = true
294295
function clause currentlyEnabled(Ext_Zvkn) =
295-
currentlyEnabled(Ext_Zvkned) &
296-
currentlyEnabled(Ext_Zvknhb) &
297-
currentlyEnabled(Ext_Zvkb) &
298-
currentlyEnabled(Ext_Zvkt)
296+
hartSupports(Ext_Zvkn) &
297+
hartSupports(Ext_Zvkned) &
298+
hartSupports(Ext_Zvknhb) &
299+
hartSupports(Ext_Zvkb) &
300+
hartSupports(Ext_Zvkt)
299301
// NIST Algorithm Suite with carryless multiply
300302
enum clause extension = Ext_Zvknc
301303
mapping clause extensionName = Ext_Zvknc <-> "zvknc"
302-
function clause currentlyEnabled(Ext_Zvknc) = currentlyEnabled(Ext_Zvkn) & currentlyEnabled(Ext_Zvbc)
304+
function clause hartSupports(Ext_Zvknc) = true
305+
function clause currentlyEnabled(Ext_Zvknc) = hartSupports(Ext_Zvknc) & currentlyEnabled(Ext_Zvkn) & hartSupports(Ext_Zvbc)
303306
// NIST Algorithm Suite with GCM
304307
enum clause extension = Ext_Zvkng
305308
mapping clause extensionName = Ext_Zvkng <-> "zvkng"
306-
function clause currentlyEnabled(Ext_Zvkng) = currentlyEnabled(Ext_Zvkn) & currentlyEnabled(Ext_Zvkg)
309+
function clause hartSupports(Ext_Zvkng) = true
310+
function clause currentlyEnabled(Ext_Zvkng) = hartSupports(Ext_Zvkng) & currentlyEnabled(Ext_Zvkn) & hartSupports(Ext_Zvkg)
307311
// ShangMi Algorithm Suite
308312
enum clause extension = Ext_Zvks
309313
mapping clause extensionName = Ext_Zvks <-> "zvks"
314+
function clause hartSupports(Ext_Zvks) = true
310315
function clause currentlyEnabled(Ext_Zvks) =
311-
currentlyEnabled(Ext_Zvksed) &
312-
currentlyEnabled(Ext_Zvksh) &
313-
currentlyEnabled(Ext_Zvkb) &
314-
currentlyEnabled(Ext_Zvkt)
316+
hartSupports(Ext_Zvks) &
317+
hartSupports(Ext_Zvksed) &
318+
hartSupports(Ext_Zvksh) &
319+
hartSupports(Ext_Zvkb) &
320+
hartSupports(Ext_Zvkt)
315321
// ShangMi Algorithm Suite with carryless multiplication
316322
enum clause extension = Ext_Zvksc
317323
mapping clause extensionName = Ext_Zvksc <-> "zvksc"
318-
function clause currentlyEnabled(Ext_Zvksc) = currentlyEnabled(Ext_Zvks) & currentlyEnabled(Ext_Zvbc)
324+
function clause hartSupports(Ext_Zvksc) = true
325+
function clause currentlyEnabled(Ext_Zvksc) = hartSupports(Ext_Zvksc) & currentlyEnabled(Ext_Zvks) & hartSupports(Ext_Zvbc)
319326
// ShangMi Algorithm Suite with GCM
320327
enum clause extension = Ext_Zvksg
321328
mapping clause extensionName = Ext_Zvksg <-> "zvksg"
322-
function clause currentlyEnabled(Ext_Zvksg) = currentlyEnabled(Ext_Zvks) & currentlyEnabled(Ext_Zvkg)
329+
function clause hartSupports(Ext_Zvksg) = true
330+
function clause currentlyEnabled(Ext_Zvksg) = hartSupports(Ext_Zvksg) & currentlyEnabled(Ext_Zvks) & hartSupports(Ext_Zvkg)
323331

324332
// Count Overflow and Mode-Based Filtering
325333
enum clause extension = Ext_Sscofpmf

0 commit comments

Comments
 (0)