直接映射缓存的地址字段中有多少位? [英] How many bits are in the address field for a directly mapped cache?

查看:21
本文介绍了直接映射缓存的地址字段中有多少位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个基于直接映射缓存的问题,所以我假设在这里问也可以.

This is a question based on Direct Mapped Cache so I am assuming that it's ok to ask here as well.

这是我正在解决的问题:
问题:一个高速工作站有 64 位字和 64 位地址,在字节级别进行地址解析.假设直接映射缓存有 8192 条 64 字节线,那么每条线有多少位?缓存的以下地址字段?1)字节 2)索引 3)标签?"

Here is the problem I am working on:
The Problem: " A high speed workstation has 64 bit words and 64 bit addresses with address resolution at the byte level. Assuming a direct mapped cache with 8192 64 byte lines, how many bits are in each of the following address fields for the cache? 1) byte 2) Index 3) Tag?"

首先我定义了这个问题中的术语,并使用了另一个堆栈溢出直接映射缓存问题和我在 缓存 作为参考(如果我的任何定义有误,请纠正我)

First I defined the terms in this problem and used the other Stack Overflow Direct Mapped Cache question and my other question on Caching as references(Please correct me if any of my definitions are wrong)

  • 64 位字 - 处理器一次可以处理 64 位
  • 64 位地址 w 字节级寻址 - RAM 中有 2^64 个内存位置,每个内存位置存储一个字节.
  • 缓存是高速的,分为缓存行
  • 直接映射缓存是 RAM 内存所在块被映射到一个缓存行(不确定这一点的意义
  • 64 bit words - processor can process 64 bits at a time
  • 64 bit addresses w byte level addressing - there are 2^64 memory locations in RAM and each memory location stores a byte.
  • Cache is high speed and is partitioned into cache lines
  • Directly Mapped Cache is where a RAM memory block is mapped into one cache line(not sure of the significance of this

现在将直接映射缓存作为参考

Now working off Direct Mapped Cache as a reference

  1. 字节 - 因为字节行由 64 个字节组成,所以您需要 6 位来标识该字节行中的单个字节
  2. 索引- 因为字节行有 8192 个行",所以你至少需要 10 位来标识每一行

现在是我被卡住的部分.另一篇帖子说所有其他位都是标记位."而这个讲座 post 说每一行都有一个标签表示已复制该行的 M 中的地址".我猜 M 表示 RAM.

Now heres the part of where I am stuck. The other post said "All the other bits are TAG bits." while this lecture post said "Each line has a tag that indicates the address in M from which the line has been copied". I am guessing that M means the RAM.

所以在这里,所有其他位都是 64 - 6 - 10 = 48 位.但是,您是否不需要 TAG 中的所有 64 位来指示缓存中的数据来自 RAM 中的哪个内存位置?有人可以澄清我在这里的困惑吗?

So here, all the other bits would be 64 - 6 - 10 = 48 bits. But wouldn't you need all 64 bits in the TAG to indicate what memory location in the RAM the data in the cache came from? Can someone clarify the confusion I have here?

推荐答案

看完这个缓存视频,我能够弄清楚这一点.(强烈推荐这个视频)
如有不对之处请指正

After watching this Caching Video, I was able to figure this out. (Highly recommend this video)
Please correct me if any of this is wrong

地址总共有 64 位.现在对于缓存地址的不同组成部分

In total the address has 64 bits. Now for the different components of the cache address

  • Byte - 字节行中有 64 个字节.一个字的长度为 64 位或 8 个字节.因此一个字节线可以容纳 8 个字.因为您需要确定要处理的单词(处理器一次处理一个单词),所以您将需要 3 位来处理此
  • 索引 - 您需要确定地址所指的缓存行.感谢@Leeor 的评论,您将需要 13 位来执行此操作,因为有 8192 条缓存线
  • Tag - 其余位用于 TAG.即 64 - 3 - 13 = 48 位
  • Byte - There are 64 bytes in a byte line. A word is 64 bits or 8 bytes long. Therefore a byte line can hold 8 words. Because you need to identify which word is to be processed(Processor processes one word at a time), you're going to need 3 bits for this
  • Index - You need to identify which cache line the address refers to. Thanks to @Leeor's comment, youre going to need 13 bits to do this because there are 8192 cache lines
  • Tag - the rest of the bits are for the TAG. That be 64 - 3 - 13 = 48 bits

这篇关于直接映射缓存的地址字段中有多少位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆