没有合适的资源?快使用搜索试试~ 我知道了~
Cache Controller
需积分: 11 42 下载量 86 浏览量
2015-07-19
11:49:31
上传
评论
收藏 1.57MB DOCX 举报
温馨提示
试读
17页
Help you understand the cache architecture and its mechanism. Design a first-level data cache controller with Verilog HDL step by step.
资源推荐
资源详情
资源评论
Project Cache Controller
1. Purpose
This project is intended to help you understand the cache architecture and its mechanism.
2. Problem
In this project, you will design a first-level data cache controller with Verilog HDL step by step.
You may need to review the knowledge about that language to make sure you do the project
smoothly.
3. Cache characteristics and mechanism
We take TMS320C64x DSP as an example. The TMS320C64x DSPs have a two-level memory
architecture for program and data, the first-level program cache (L1P), the first-level data cache
(L1D), and the second-level memory (L2). In this project, you only need to concern about the L1D
cache. Table 1 lists some specific parameters that may be used in this project.
TMS320C64x DSP
Internal memory structure Two Level
L1D size 16 Kbytes
L1D organization 2-way set associative
L1D line size 64 bytes
L1D replacement strategy Least Recently Used (LRU)
L1D read miss action 1 line allocates in L1D
L1D read hit action Data read from L1D
L1D write miss action No allocation in L1D, data sent to L2
L1D write hit action Data updated in L1D, line marked dirty
L2 line size 128 bytes
L2 → L1D read path width 256 bit
L1D → L2 write path width 64 bit
Note1: When a dirty block is replaced, the whole L1D cache line must be written back, but the
L1D to L2 write path width is only 64 bit, i.e. you need to repeat 8 times to complete. Similarly,
one load from L2 cache returns 128 bytes of data and you need to repeat 4 times to complete.
Note2: For simplicity, you can assume an infinite write buffer, and ignore TLB. Besides, assume
only one ld/st is permitted to be processed at a time.
Note3: More details on the C64x DSPs internal memory structure and operations are described in
TMS320C64x DSP Two-Level Internal Memory Reference Guide. You will find more interesting
techniques, like cache banking and victim cache, in this manual.
1
目录
1. 题目分析
2. 状态图设计
3. 状态转换表设计
4. ASM 图设计
5. 电路图设计
6. Verilog HDL 语言实现设计
7. 仿真分析
8. 心得体会
实验内容:
1. 题目分析
实验要求为设计一 Cache 的第一级数据 Cache 的控制器。Cache 为两路
组相联,替换准则为 LRU,写操作处理为 Write_back,假设 write_buer 无
限,且忽略 TLB。
在题目的提醒中看到,当一个脏的块被替换时,先要将其写回下一级
Cache 中 。 但 是 L1D line size 为 64 bytes , 而 L1D → L2 write path
width 只有 64 bit,所以需要重复 8 次才能完成写回。同样地,当一个数据块
从第二级 Cache 中取出至第一级 Cache 中时,L2 line size 为 128 bytes,
而 L2 → L1D read path width 只有 256 bit,所以需要重复 4 次才能完成取
回。所以,在状态转换时,应考虑到这两个地方的延迟作用。
2
2. 状态图设计
题干中说明第一级数据 Cache 主要实现 Ld 和 St 两种指令。所以状态之间
的转换条件信号为 ld, st, hit, miss, dirty。
状态主要分为 4 个:
①.WAIT: Cache 处于不工作状态,等待信号;
②.TAG_COMPARE: ld 或 st 指令来到后,将地址中的 Tag 部分与 cache
中相应块的 Tag 比较,并且检验 valid 是否有效,来判断是够命中。
③CHANGE: 将第一级 cache 中的块用第二级 cache 中的块替换,替换准
则为 LRU。
④WRITE_BACK: 第一级 cache 中的块需要替换时,若 dirty 有效(即数
据有变动),则需要写回第二级 cache,然后再将块进行替换。
状态之间的转换:
① 默 认 状 态 为 WAIT 状 态 , 若 有 ld 或 st 指 令 来 到 , 则 转 换 到
TAG_COMPARE 状态;
②当处于 TAG_COMPARE 状态,分情况讨论:
若指令为 ld,且判断为 hit,则返回 WAIT 并且将 load_ready 置为
1;若指令为 ld,且判断为 miss,检验 dirty 为有效时,由题干知 L1D
read miss action,1 line allocates in L1D(读分配),所以需要
将 块 中 数 据 写 回 缓 冲 , 即 转 换 到 状 态 TAG_COMPARE , 同 时 置
write_l2 为 1;
若指令为 ld,且判断为 miss,检验 dirty 为无效时,即块中数据没有
3
变 化 , 可 直 接 替 换 , 则 转 换 到 状 态 CHANGE, 同 时 置
write_l1,read_l2 为 1;
若指令为 st,且判断为 hit,则返回 WAIT,且置 write_l1 为 1;
若指令为 st,且判断为 miss,由题干知 L1D write miss action,No
allocation in L1D, data sent to L2(写不分配),则转换到状态
WRITE_BACK,同时置 write_l2 为 1;
③.当处于状态 CHANGE 时: 当接收到信号 l2_ack(从第二级 cache 取回
的数据已经到达),则转换到状态 TAG_COMPARE,同时将 hit 置为 1;
④. 当 处 于 状 态 WRITE_BACK: 这 个 状 态 相 当 于 TAG_COMPARE 与
CHANGE 状态中间的一个缓冲分流区,在 TAG_COMPARE 判断 miss 时,若
指令为 st 时,则此状态就能完成任务,转换到状态 WAIT;若指令为 ld,则将
执行权传到状态 CHANGE;同时置 read_l2,write_l1 为 1;
NOTE: 题目分析中,当一个脏的块被替换时,由于线宽限制,需要重复 8
次才能完成写回。同样地,当一个数据块从第二级 Cache 中取出至第一级
Cache 中时需要重复 4 次才能完成取回。所以,在 WRITE_BACK 状态,且指
令为 ld 时,应考虑 8 个时钟周期的延迟。同样地,在 CHANGE 状态时,应考
虑数据从第二级 cache 取回第一级 cache 时的 4 个周期的延迟。考虑同计时
器实现延迟作用,4 周期延迟和 8 周期延迟信号分别设为 c4 和 c8。
绘制状态转换图如下:
4
剩余16页未读,继续阅读
资源评论
sky_2333
- 粉丝: 4
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功