public void SetSettings(CachePreferences cachePreferences) { InstructionCachePreferences cp = mInstructionCacheSummary ? cachePreferences.InstructionCachePreferences : cachePreferences.DataCachePreferences; if (!cp.Enabled) { gbSummary.Enabled = false; return; } lblCacheSize.Text = (cp.NumberBlocks * cp.BlockSize).ToString() + " Bytes"; lblBlockSize.Text = cp.BlockSize.ToString() + " Bytes"; lblNumBlocks.Text = cp.NumberBlocks.ToString(); if (cp.NumberBlocks == 1) { lblAssociativity.Text = "Fully Associative"; } else if (cp.NumberBlocks == cp.BlocksPerSet) { lblAssociativity.Text = "Direct Mapped"; } else { lblAssociativity.Text = string.Format("{0} way", cp.BlocksPerSet); } lblReplacement.Text = cp.ReplaceStrategy.ToString(); if (!mInstructionCacheSummary) { DataCachePreferences dcp = cachePreferences.DataCachePreferences; lblAllocate.Text = dcp.AllocatePolicy.ToString(); lblWrite.Text = dcp.WritePolicy.ToString(); } }//SetSettings
private void Summary() { CachePreferences cachePreferences = this.CachePreferences; this.cacheSummary1.SetSettings(cachePreferences); this.cacheSummary2.SetSettings(cachePreferences); }
public CacheWizard(CachePreferences cachePreferences) { InitializeComponent(); mCachePreferences = cachePreferences; rbUnifiedYes.Checked = mCachePreferences.UnifiedCache; rbUnifiedNo.Checked = !mCachePreferences.UnifiedCache; { InstructionCachePreferences icp = mCachePreferences.InstructionCachePreferences; rbICacheEnableYes.Checked = icp.Enabled; rbICacheEnableNo.Checked = !icp.Enabled; instructionCacheSize.Set(icp.BlockSize, icp.NumberBlocks); instructionAssociativity.Set(icp.NumberBlocks, icp.BlocksPerSet); instructionReplacementStrategy.ReplaceStrategyType = icp.ReplaceStrategy; } { DataCachePreferences dcp = mCachePreferences.DataCachePreferences; rbDCacheEnableYes.Checked = dcp.Enabled; rbDCacheEnableNo.Checked = !dcp.Enabled; dataCacheSize.Set(dcp.BlockSize, dcp.NumberBlocks); dataAssociativity.Set(dcp.NumberBlocks, dcp.BlocksPerSet); dataReplacementStrategy.ReplaceStrategyType = dcp.ReplaceStrategy; writePolicy.WritePolicyType = dcp.WritePolicy; allocatePolicy.AllocatePolicyType = dcp.AllocatePolicy; } }
/// <summary> /// Invoke the cache settings wizard. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCacheWizard_Click(object sender, EventArgs e) { using (ARMSim.Preferences.PreferencesForm.Wizard.CacheWizard cacheWizard = new ARMSim.Preferences.PreferencesForm.Wizard.CacheWizard(mCachePreferences)) { if (cacheWizard.ShowDialog() == DialogResult.OK) { mCachePreferences = cacheWizard.CachePreferences; this.Cache_Load(null, null); } } }
}//ResetCache /// <summary> /// Define the caches according to the cache preferences. /// </summary> /// <param name="preferences"></param> public void DefineCache(CachePreferences preferences) { mL1DataCache = new Cache.DataCache(mMemoryBlock, preferences.DataCachePreferences); if (preferences.UnifiedCache) { mL1InstructionCache = mL1DataCache; } else { mL1InstructionCache = new Cache.L1Cache(mMemoryBlock, preferences.InstructionCachePreferences); } }//DefineCache
public ARMCache(CachePreferences cachePreferences) : this() { mCachePreferences = cachePreferences; }