如何正确计算地址空间?
以下是我在计算机工程课程的最后一次测试中给出的问题示例。有人介意向我解释如何获取每个的起始/结束地址吗?我已在底部列出了正确答案...
MSP430F2410 器件的地址空间为 64 KB(基本 MSP430 架构)。如果我们知道以下内容,请填写下表。地址空间的前 16 个字节(从地址 0x0000 开始)保留给特殊功能寄存器(IE1、IE2、IFG1、IFG2 等),接下来的 240 个字节保留给 8 位外围设备,接下来的 240 个字节保留给 8 位外围设备。 256 字节保留给 16 位外围设备。 RAM 内存容量为 2 KB,从地址 0x1100 开始。地址空间的顶部是 56KB 的闪存,为代码和中断向量表保留。
What Start Address End Address Special Function Registers (16 bytes) 0x0000 0x000F 8-bit peripheral devices (240 bytes) 0x0010 0x00FF 16-bit peripheral devices (256 bytes) 0x0100 0x01FF RAM memory (2 Kbytes) 0x1100 0x18FF Flash Memory (56 Kbytes) 0x2000 0xFFFF
Below is an example of a question given on my last test in a Computer Engineering course. Anyone mind explaining to me how to get the start/end addresses of each? I have listed the correct answers at the bottom...
The MSP430F2410 device has an address space of 64 KB (the basic MSP430 architecture). Fill in the table below if we know the following. The first 16 bytes of the address space (starting at the address 0x0000) is reserved for special function registers (IE1, IE2, IFG1, IFG2, etc.), the next 240 bytes is reserved for 8-bit peripheral devices, and the next 256 bytes is reserved for 16-bit peripheral devices. The RAM memory capacity is 2 Kbytes and it starts at the address 0x1100. At the top of the address space is 56KB of flash memory reserved for code and interrupt vector table.
What Start Address End Address Special Function Registers (16 bytes) 0x0000 0x000F 8-bit peripheral devices (240 bytes) 0x0010 0x00FF 16-bit peripheral devices (256 bytes) 0x0100 0x01FF RAM memory (2 Kbytes) 0x1100 0x18FF Flash Memory (56 Kbytes) 0x2000 0xFFFF
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于初学者来说,不要被每个段中存储的内容迷惑——这只会让您感到困惑。问题只是要求你找出十六进制编号,这并不太难。要求如下:
由于内存地址中的每个十六进制数字可以处理 16 个值 (0-F),因此您需要 4 位数字才能显示 64KB 内存(16 ^ 4 = 65536 或 64K)。
您从 16 个字节开始,涵盖 0x0000 - 0x000F(地址的整数位)。这意味着紧随其后的下一个段(8 位设备)从 0x0010(下一个字节)开始,并且由于它的长度为 240 字节,因此它以字节 255 (240 + 15) 或 0x00FF 结束。
下一个段(16 位设备)从下一个字节开始,即 0x0100,长度为 256 字节 - 结束于 0x01FF。
然后是 2KB(2048 字节)的 RAM,但正如描述所述,它从 0x1100 开始,而不是紧接在上一个段之后,所以这就是您的起始地址。再加上 2048,就得到 0x18FF。
最后一段覆盖了内存的上半部分,因此您必须向后计算,您知道它以 0xFFFF(可用内存的末尾)结束,并且长度为 56KB。如果将 56KB 转换为十六进制,则为 0xDFFF。如果您想象该段从 0 开始,则剩下 2000 未使用(0xE000-0xEFFF 和 0xF000-0xFFFF),因此您知道该段必须从 0x2000 开始,到内存空间的上端结束。
我希望这更清楚,尽管当我读完它时,我不知道它有任何帮助:(也许这就是为什么我会把这个概念留给更有资格的人......
For starters, don't get thrown off by what's stored in each segment - that's only going to confuse you. The problem is just asking you to figure out the hex numbering, and that's not too difficult. Here are the requirements:
Since each hex digit in your memory address can handle 16 values (0-F), you'll need 4 digits to display 64KB of memory (16 ^ 4 = 65536, or 64K).
You start with 16 bytes, and that covers 0x0000 - 0x000F (one whole digit of your address). That means that the next segment, which starts immediately after it (8-bit devices), begins at 0x0010 (the next byte), and since it's 240 bytes long, it ends at byte 255 (240 + 15), or 0x00FF.
The next segment (16-bit devices) starts at the next byte, which is 0x0100, and is 256 bytes long - that puts the end at 0x01FF.
Then comes 2KB (2048 bytes) of RAM, but it starts at 0x1100, as the description states, instead of immediately after the previous segment, so that's your starting address. Add 2048 to that, and you get 0x18FF.
The last segment covers the upper section of the memory, so you'll have to work backward, You know it ends at 0xFFFF (the end of the available memory), and it's 56KB long. If you convert the 56KB to hex, it's 0xDFFF. If you imagine that this segment starts at 0, That leaves 2000 unused (0xE000-0xEFFF and 0xF000-0xFFFF), so you know that this segment has to start at 0x2000 to end at the upper end of the memory space.
I hope that's more clear, though when I read over it, I don't know that it's any help at all :( Maybe that's why I'll leave teaching that concept to somebody more qualified...