From 12a05c23b7d351afee4b0c531021d8fb8ea5f57d Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Wed, 23 Feb 2011 16:41:59 -0800 Subject: ruby: automate permission setting This patch integrates permissions with cache and memory states, and then automates the setting of permissions within the generated code. No longer does one need to manually set the permissions within the setState funciton. This patch will faciliate easier functional access support by always correctly setting permissions for both cache and memory states. --HG-- rename : src/mem/slicc/ast/EnumDeclAST.py => src/mem/slicc/ast/StateDeclAST.py rename : src/mem/slicc/ast/TypeFieldEnumAST.py => src/mem/slicc/ast/TypeFieldStateAST.py --- src/mem/protocol/MOESI_CMP_token-L1cache.sm | 53 ++++++++++------------------- 1 file changed, 18 insertions(+), 35 deletions(-) (limited to 'src/mem/protocol/MOESI_CMP_token-L1cache.sm') diff --git a/src/mem/protocol/MOESI_CMP_token-L1cache.sm b/src/mem/protocol/MOESI_CMP_token-L1cache.sm index 226f21374..160208aac 100644 --- a/src/mem/protocol/MOESI_CMP_token-L1cache.sm +++ b/src/mem/protocol/MOESI_CMP_token-L1cache.sm @@ -63,29 +63,29 @@ machine(L1Cache, "Token protocol") MessageBuffer requestToL1Cache, network="From", virtual_network="1", ordered="false"; // STATES - enumeration(State, desc="Cache states", default="L1Cache_State_I") { + state_declaration(State, desc="Cache states", default="L1Cache_State_I") { // Base states - NP, "NP", desc="Not Present"; - I, "I", desc="Idle"; - S, "S", desc="Shared"; - O, "O", desc="Owned"; - M, "M", desc="Modified (dirty)"; - MM, "MM", desc="Modified (dirty and locally modified)"; - M_W, "M^W", desc="Modified (dirty), waiting"; - MM_W, "MM^W", desc="Modified (dirty and locally modified), waiting"; + NP, AccessPermission:Invalid, "NP", desc="Not Present"; + I, AccessPermission:Invalid, "I", desc="Idle"; + S, AccessPermission:Read_Only, "S", desc="Shared"; + O, AccessPermission:Read_Only, "O", desc="Owned"; + M, AccessPermission:Read_Only, "M", desc="Modified (dirty)"; + MM, AccessPermission:Read_Write, "MM", desc="Modified (dirty and locally modified)"; + M_W, AccessPermission:Read_Only, "M^W", desc="Modified (dirty), waiting"; + MM_W, AccessPermission:Read_Write, "MM^W", desc="Modified (dirty and locally modified), waiting"; // Transient States - IM, "IM", desc="Issued GetX"; - SM, "SM", desc="Issued GetX, we still have an old copy of the line"; - OM, "OM", desc="Issued GetX, received data"; - IS, "IS", desc="Issued GetS"; + IM, AccessPermission:Busy, "IM", desc="Issued GetX"; + SM, AccessPermission:Read_Only, "SM", desc="Issued GetX, we still have an old copy of the line"; + OM, AccessPermission:Read_Only, "OM", desc="Issued GetX, received data"; + IS, AccessPermission:Busy, "IS", desc="Issued GetS"; // Locked states - I_L, "I^L", desc="Invalid, Locked"; - S_L, "S^L", desc="Shared, Locked"; - IM_L, "IM^L", desc="Invalid, Locked, trying to go to Modified"; - SM_L, "SM^L", desc="Shared, Locked, trying to go to Modified"; - IS_L, "IS^L", desc="Invalid, Locked, trying to go to Shared"; + I_L, AccessPermission:Busy, "I^L", desc="Invalid, Locked"; + S_L, AccessPermission:Busy, "S^L", desc="Shared, Locked"; + IM_L, AccessPermission:Busy, "IM^L", desc="Invalid, Locked, trying to go to Modified"; + SM_L, AccessPermission:Busy, "SM^L", desc="Shared, Locked, trying to go to Modified"; + IS_L, AccessPermission:Busy, "IS^L", desc="Invalid, Locked, trying to go to Shared"; } // EVENTS @@ -336,23 +336,6 @@ machine(L1Cache, "Token protocol") } cache_entry.CacheState := state; - - // Set permission - if (state == State:MM || - state == State:MM_W) { - cache_entry.changePermission(AccessPermission:Read_Write); - } else if ((state == State:S) || - (state == State:O) || - (state == State:M) || - (state == State:M_W) || - (state == State:SM) || - (state == State:S_L) || - (state == State:SM_L) || - (state == State:OM)) { - cache_entry.changePermission(AccessPermission:Read_Only); - } else { - cache_entry.changePermission(AccessPermission:Invalid); - } } } -- cgit v1.2.3