缓存 缓存 Cache 1、缓存概述 2、缓存使用 3、缓存一致性问题.

Slides:



Advertisements
Similar presentations
高考英语阅读分析 —— 七选五. 题型解读: 试题模式: 给出一篇缺少 5 个句子的文章, 对应有七个选项,要求同学们根据文章结构、 内容,选出正确的句子,填入相应的空白处。 考查重点: 主要考查考生对文章的整体内容 和结构以及上下文逻辑意义的理解和掌握。 (考试说明) 选项特点: 主旨概括句(文章整体内容)
Advertisements

智慧老伯的一席話 原稿 : 溫 Sir 中譯 : 老柳 A man of 92 years, short, very well- presented, who takes great care in his appearance, is moving into an old people’s.
1 )正确 2 )多词 3 )缺词 4 )错词 删除 补漏 更正 “1126” 原则 “1225” 原则 “1117” 原则.
英语中考复习探讨 如何写好书面表达 宁波滨海学校 李爱娣. 近三年中考试题分析 评分标准 试卷评分与练习 (2009 年书面表达为例 ) 影响给分的因素: 存在问题 书面表达高分技巧 建议.
第五章 動詞 動詞用來表示一種動作 動詞有及物與不及物之分,及物動詞之後需要受詞,有的動詞甚至需要兩個受詞:一個直接受詞,一個間接受詞
CHAPTER 9 虛擬記憶體管理 9.2 分頁需求 9.3 寫入時複製 9.4 分頁替換 9.5 欄的配置法則 9.6 輾轉現象
应如何将神的话语大声读出来会众才能真正的听见!
Memory Pool ACM Yanqing Peng.
雅思大作文的结构 Presented by: 总统秘书王富贵.
第四章 存储体系.
Chapter 9: Memory Management
Writing 促销英文信 促销的目的就是要卖出产品,那么怎样才能把促销信写得吸引人、让人一看就对产品感兴趣呢?下面就教你促销信的四步写法。
版权所有,引用请注明出处 第四章、存储系统-2 原著 谭志虎 主讲(改编) 蒋文斌.
! 温故知新 上下文无关文法 最左推导 最右推导 自上而下 自下而上 句柄 归约 移进-归约冲突 移进-归约分析 递归下降预测分析
第十二章 零售與批發.
ARM存储器结构 ARM架构的处理器的存储器寻址空间有4G字节 ,存储空间可以分为 :
Calling about an apartment for rent II Objectives
(Exec1) GIS 空间分析-使用ArcGIS (Exec1)
淘宝核心系统数据库组 余锋 利用新硬件提升数据库性能 淘宝核心系统数据库组 余锋
C H A P T E R 10 存储器层次.
KeyStone I DSP[C665x 与 C6678] 视频教程
CHAPTER 8 VIRTUAL MEMORY
5 Computer Organization (計算機組織).
Flash数据管理 Zhou da
Operating System Internals and Design principles
Friendship Bouquet 友谊之花 Music: Nightengale Serenade
Chapter 3 行程觀念 (Process Concept)
Chapter7 全球資訊網與瀏覽器介紹 網路應用入門(一) Chapter7 全球資訊網與瀏覽器介紹
微程序控制器 刘鹏 Dept. ISEE Zhejiang University
計算機結構 – 概論 陳鍾誠 於金門大學.
The expression and applications of topology on spatial data
KeyStone I DSP[C665x 与 C6678] 视频教程
Fundamentals of Physics 8/e 31 - Alternating Fields and Current
The Wise Old Man 智慧老伯的一席話 原稿: 溫Sir 中譯 : 老柳 中譯潤稿:風刀雨箭
重點 資料結構之選定會影響演算法 選擇對的資料結構讓您上天堂 程式.
校園網路架構介紹與資源利用 主講人:趙志宏 圖書資訊館網路通訊組.
第十五课:在医院看病.
Review Final Chinese 2-Chapter 6~10-1
PHOTO FUN Name:黃齡誼   Number:91405253 Class:應英三C Guide Teacher:蔡佩倫 老師.
Dept. of Information Management OCIT February, 2002
高性能计算与天文技术联合实验室 智能与计算学部 天津大学
Guide to a successful PowerPoint design – simple is best
英语教学课件 九年级全.
3.5 Region Filling Region Filling is a process of “coloring in” a definite image area or region. 2019/4/19.
中国科学技术大学计算机系 陈香兰 2013Fall 第七讲 存储器管理 中国科学技术大学计算机系 陈香兰 2013Fall.
中国科学技术大学计算机系 陈香兰 Fall 2013 第三讲 线程 中国科学技术大学计算机系 陈香兰 Fall 2013.
The Wise Old Man 智慧老伯的一席話 原稿: 溫Sir 中譯 : 老柳
计算机系统结构(2012年春) ----存储层次: Cache基本概念
关联词 Writing.
Presentation 约翰316演示 John 3 : 16
高考应试作文写作训练 5. 正反观点对比.
子句 Clauses 黃勇仁.
第10章 存储器接口 罗文坚 中国科大 计算机学院
Chapter 7 掌控記憶體.
第六章 記憶體.
冀教版 九年级  Look into Science!.
计算机问题求解 – 论题1-5 - 数据与数据结构 2018年10月16日.
Chapter 10 Mobile IP TCP/IP Protocol Suite
冀教版 九年级 Lesson 20: Say It in Five.
CHAPTER 6 Concurrency:deadlock And Starvation
立足语境,放眼词块,螺旋上升 年温州一模试卷题型分析 及相应的二轮复习对策 by Sue March 14,2013.
English article read(英文文章閱讀)
名词从句(4) (复习课).
动词不定式(6).
2012 程式設計比賽 Openfind 天使帝國 v2.0 (蓋亞的紋章).
用户程序的重新接线 目录 页 目标 ………… 概述……… 用SIMATIC 管理器重新接线 …………………
The Wise Old Man 智慧老伯的一席話 原稿: 溫Sir 中譯 : 老柳
MGT 213 System Management Server的昨天,今天和明天
Unit 11 Sad movies make me cry SectionA 1a- 2c
獻上自己來榮耀神 Offering Ourselves To Glorify God
Presentation transcript:

缓存 缓存 Cache 1、缓存概述 2、缓存使用 3、缓存一致性问题

内存架构 减少内存平均访问时间

缓存原理 y[0] = h[0] × x[0] + h[1] × x[1] + ... + h[5] × x[5] Cache Line

C674x Cache Memory 架构

C674x Cache Memory 架构 缓存 描述 替换策略 可缓存性 访问时间 大小 Cache Line L1 Program 程序 直接映射(Direct Mapped) 读分配(Read Allocate) 总是缓存 1 Cycle 4K / 8K / 16K / 32K 字节 32 字节 L1 Data 数据 2 路组相关(Set Associative) 回写(Write Back) 最近最少使用(Least Recently Used (LRU)) 可配置 64 字节 L2 程序及数据 4 路组相关(Set Associative) 读写分配(Read & Write Allocate) 32K / 64K / 128K / 256K 字节 Allocation The process of finding a location in the cache to store newly cached data. This process can include evicting data that is presently in the cache to make room for the new data. Direct-mapped cache A direct-mapped cache maps each address in the lower-level memory to a single location in the cache. Multiple locations may map to the same location in the cache. This is in contrast to a multi-way set-associative cache, which selects a place for the data from a set of locations in the cache. A direct-mapped cache can be considered a single-way set-associative cache. Read allocate A read-allocate cache only allocates space in the cache on a read miss. A write miss does not cause an allocation to occur unless the cache is also a write-allocate cache. For caches that do not write allocate, the write data would be passed on to the next lower-level cache.

L1 Program Cache Memory 架构 16KBytes Line A cache line is the smallest block of data that the cache operates on. The cache line is typically much larger than the size of data accesses from the CPU or the next higher level of memory. For instance, although the CPU may request single bytes from memory, on a read miss the cache reads an entire line's worth of data to satisfy the request. Dirty In a writeback cache, writes that reach a given level in the memory hierarchy may update that level, but not the levels below it. Therefore, when a cache line is valid and contains updates that have not been sent to the next lower level, that line is said to be dirty. The opposite state for a dirty cache line is clean. Line frame A location in a cache that holds cached data (one line), an associated tag address, and status information for the line. The status information can include whether the line is valid, dirty, and the current state of that line's LRU. Valid When a cache line holds data that has been fetched from the next level memory, that line frame is valid. The invalid state occurs when the line frame holds no data, either because nothing has been cached yet, or because previously cached data has been invalidated for whatever reason (coherence protocol, program request, etc.). The valid state makes no implications as to whether the data has been modified since it was fetched from the lower-level memory; rather, this is indicated by the dirty or clean state of the line. Miss A cache miss occurs when the data for a requested memory location is not in the cache. A miss may stall the requestor while the line frame is allocated and data is fetched from the next lower level of memory. In some cases, such as a CPU write miss from L1D, it is not strictly necessary to stall the CPU. Cache misses are often divided into three categories: compulsory misses, conflict misses, and capacity misses.

L1 Data Cache Memory 架构 16KBytes Line A cache line is the smallest block of data that the cache operates on. The cache line is typically much larger than the size of data accesses from the CPU or the next higher level of memory. For instance, although the CPU may request single bytes from memory, on a read miss the cache reads an entire line's worth of data to satisfy the request. Dirty In a writeback cache, writes that reach a given level in the memory hierarchy may update that level, but not the levels below it. Therefore, when a cache line is valid and contains updates that have not been sent to the next lower level, that line is said to be dirty. The opposite state for a dirty cache line is clean. Line frame A location in a cache that holds cached data (one line), an associated tag address, and status information for the line. The status information can include whether the line is valid, dirty, and the current state of that line's LRU. Valid When a cache line holds data that has been fetched from the next level memory, that line frame is valid. The invalid state occurs when the line frame holds no data, either because nothing has been cached yet, or because previously cached data has been invalidated for whatever reason (coherence protocol, program request, etc.). The valid state makes no implications as to whether the data has been modified since it was fetched from the lower-level memory; rather, this is indicated by the dirty or clean state of the line. Miss A cache miss occurs when the data for a requested memory location is not in the cache. A miss may stall the requestor while the line frame is allocated and data is fetched from the next lower level of memory. In some cases, such as a CPU write miss from L1D, it is not strictly necessary to stall the CPU. Cache misses are often divided into three categories: compulsory misses, conflict misses, and capacity misses.

使用缓存 缓存大小 L1 Program L1 Data L2 可缓存性 配置 MAR

StarterWare SYS/BIOS 缓存大小配置 #include "dspcache.h" CacheEnable(L1DCFG_L1DMODE_32K | L1PCFG_L1PMODE_32K | L2CFG_L2MODE_256K); SYS/BIOS #include <ti/sysbios/family/c64p/Cache.h> Cache_Size cacheSize; cacheSize.l1pSize = Cache_L1Size_32K; cacheSize.l1dSize = Cache_L1Size_32K; cacheSize.l2Size = Cache_L2Size_256K; Cache_setSize(&cacheSize); 缓存大小配置

StarterWare SYS/BIOS 内存可缓存性配置 #include "dspcache.h" CacheEnableMAR((unsigned int)0xC0000000, (unsigned int)0x08000000); SYS/BIOS #include <ti/sysbios/family/c64p/Cache.h> Cache_setMar((Ptr *)0x80000000, 0x10000000, Cache_Mar_ENABLE; 内存可缓存性配置

内存可缓存性配置

内存可缓存性配置 TMS320C674x DSP Megamodule Reference Guide

缓存架构

缓存访问流程

缓存一致性问题 读取数据 / 写入数据 其它 主外设 缓存 内存 CPU 核心 在任何时刻,CPU 或者其它 Master 访问存储器中数据时,由于CACHE 的存在造成不 能够得到最近更新过的数据,就会出现CACHE 一致性问题。

缓存一致性问题 类型 L1 Program L1 Data L2 DDR 程序 不需要缓存 不存在一致性问题 N/A 存在一致性问题 1、程序被 CPU 修改 2、程序被主外设修改 软件维护一致性 数据 硬件维护一致性

硬件维护缓存一致性 L2 数据被其它主外设更新时 L2 控制器会根据地址检测数据是否存在于 L1 Data 如果在硬件就从 L2 复制到 L1 Data CPU 读取数据时 如果在 L1 Data 就读取 如果不在就直接从 L2 读取 L2 数据被 CPU 更新时 其它主外设读取数据时 L2 控制器会根据地址检测数据是否存在于 L1 Data 如果在硬件就直接从 L1 Data 读取 如果不在就从 L2 读取

软件维护缓存一致性 缓存一致性维护操作 Cache 数据失效 Cache 数据回写 Cache 数据失效并回写 操作 L1 Program L1 Data L2 全局失效 L1PINV L1DINV L1INV 全局回写 N/A L1DWB L2WB 全局失效并回写 L1DWBINV L2WBINV 部分失效 L1PIBAR / L1PIWC L1DIBAR / L1DIWC L2IBAR / L2IWC 部分回写 L1DWBAR / L1DWWC L2WBAR / L2WWC 部分失效并回写 L1DWIBAR / L1DWIWC L2WIBAR / L2WIWC

软件维护缓存一致性 - 程序 缓存一致性维护操作 CPU 核心对代码的修改怎么办? Cache 数据失效 Cache 数据回写 其它主外设对 L2 中代码修改 其它主外设对 DDR 中代码修改 L1P 读分配

软件维护缓存一致性 - 数据 缓存一致性维护操作 CPU 核心对代码的修改怎么办? Cache 数据失效 Cache 数据回写 CPU 对 DDR 读操作 CPU 对 DDR 写操作 L1P 读分配

StarterWare SYS/BIOS 软件维护缓存一致性 #include "dspcache.h" CacheInvL1pAll(); CacheInv(unsigned int baseAddr, unsigned int byteSize); CacheWBAll(); CacheWB(unsigned int baseAddr, unsigned int byteSize); CacheWBInvAll(); CacheWBInv(unsigned int baseAddr, unsigned int byteSize); SYS/BIOS #include <ti/sysbios/family/c64p/Cache.h> Cache_inv(Ptr blockPtr, SizeT byteCnt, Bits16 type, Bool wait); Cache_invL1pAll(); Cache_wb(Ptr blockPtr, SizeT byteCnt, Bits16 type, Bool wait); Cache_wbAll(); Cache_wbInv(Ptr blockPtr, SizeT byteCnt, Bits16 type, Bool wait); Cache_wbInvAll(); 软件维护缓存一致性