/// <summary> /// Construct a DataCache given data cache preferences. /// </summary> /// <param name="memoryBlock">reference to main memory block</param> /// <param name="dataCachePreferences">the data cache preferences</param> public DataCache(MemoryBlock memoryBlock, DataCachePreferences dataCachePreferences) : base(memoryBlock, dataCachePreferences) { _writePolicy = dataCachePreferences.WritePolicy; _allocatePolicy = dataCachePreferences.AllocatePolicy; _writeThru = (_writePolicy == WritePolicyEnum.WriteThrough); }
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
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; } }