芯片架构_地址线位宽和地址空间的进制转换方法
芯片架构_地址线位宽和地址空间的进制转换方法
作者:jason-wrj
分类:芯片架构
标签:芯片架构,DSP,ARM,MCU,MPU,嵌入式操作系统,操作系统
更多:www.dioit.com——迪欧IT——嵌入式电子智能技术
一、地址线位宽,换算最大地址空间
地址线位宽n,计算2的n次幂,得出最大地址空间大小,如下表所示:
地址线位宽n,2的n次幂 | 十六进制 | 空间大小 | 十进制 |
---|---|---|---|
(04位地址线 => 2^4 ) 0xF + 1 | => 0x10 | => 16B | |
(08位地址线 => 2^8 ) 0xFF + 1 | => 0x100 | => 256B | |
(12位地址线 => 2^12 ) 0xFFF + 1 | => 0x1000 | => 4KB | => 4096 / 1024 |
(16位地址线 => 2^16 ) 0xFFFF + 1 | => 0x1 0000 | => 64KB | => 65536 / 1024 |
(20位地址线 => 2^20 ) 0xF FFFF + 1 | => 0x10 0000 | => 1MB | => 1048576 / 1024 / 1024 |
(24位地址线 => 2^24 ) 0xFF FFFF + 1 | => 0x100 0000 | => 16MB | => 16777216 / 1024 / 1024 |
(28位地址线 => 2^28 ) 0xFFF FFFF + 1 | => 0x1000 0000 | => 256MB | => 268435456 / 1024 / 1024 |
(32位地址线 => 2^32 ) 0xFFFF FFFF + 1 | => 0x1 0000 0000 | => 4GB | => 4294967296 / 1024 / 1024 / 1024 |
二、十六进制,换算地址线位宽和最大地址空间
十六进制数,先换成二进制数,首位1后面还有n个0,地址线位宽就需要n根地址线。
最大地址空间就是2的n次幂字节,如下表所示:
十六进制 | 十进制 | 空间大小 |
---|---|---|
0x10 | => 16 | = 16B |
0x100 | => 256 | = 256B |
0x400 | => 1024 | = 1KB |
0x800 | => 2048 | = 2KB |
0xC00 | => 3072 | = 3KB |
0x1000 | => 4096 | = 4KB |
0x4000 | => 16384 | = 16KB |
0x8000 | => 32768 | = 32KB |
0xC000 | => 49152 | = 48KB |
0x1 0000 | => 65536 | = 64KB |
0x4 0000 | => 262144 | = 256KB |
0x8 0000 | => 524288 | = 512KB |
0xC 0000 | => 786432 | = 768KB |
0x10 0000 | => 1048576 | = 1MB |
0x40 0000 | => 4194304 | = 4MB |
0x80 0000 | => 8388608 | = 8MB |
0xC0 0000 | => 12582912 | = 12MB |
0x100 0000 | => 16777216 | = 16MB |
0x400 0000 | => 67108864 | = 64MB |
0x800 0000 | => 134217728 | = 128MB |
0xC00 0000 | => 201326592 | = 192MB |
0x1000 0000 | => 268435456 | = 256MB |
0x4000 0000 | => 1073741824 | = 1GB |
0x8000 0000 | => 2147483648 | = 2GB |
0xC000 0000 | => 3221225472 | = 3GB |
0x1 0000 0000 | => 4294967296 | = 4GB |
三、地址线位宽,快速换算最大地址空间的字节单位
地址线位宽n,计算出2的n次幂,逢10进一个字节单位,即乘以1024,如下表所示:
常见字节单位:
1B (Byte),1KB (Kilo) ,1MB (Meg),1GB (Giga),1TB (Tera),1PB (Peta),1EB (Exa),1ZB (Zetta),1YB (Yotta)
技巧: 2^32可以分成 2^10 * 2^10 * 2^10 * 2^2 = 1024 * 1024 * 1024 * 4 = 4GB
n次幂 | 十进制数 | 地址空间大小 |
---|---|---|
2^0 | = 1 | => 1B |
2^1 | = 2 | => 2B |
2^2 | = 4 | => 4B |
2^3 | = 8 | => 8B |
2^4 | = 16 | => 16B |
2^5 | = 32 | => 32B |
2^6 | = 64 | => 64B |
2^7 | = 128 | => 128B |
2^8 | = 256 | => 256B |
2^9 | = 512 | => 512B |
2^10 | = 1024 | => 1KB (Kilo) |
2^16 | = 65536 | => 64KB |
2^20 | = 1048576 | => 1MB (Meg) |
2^24 | = 16777216 | => 16MB |
2^30 | = 1073741824 | => 1GB (Giga) |
2^32 | = 4294967296 | => 4GB |
2^40 | = 1099511627776 | => 1TB (Tera) |
2^50 | = 1125899906842624 | => 1PB (Peta) |
2^60 | = 1152921504606846976 | => 1EB (Exa) |
2^64 | = 18446744073709551616 | => 16EB |
2^70 | = 1180591620717411303424 | => 1ZB (Zetta) |
2^80 | = 1208925819614629174706176 | => 1YB (Yotta) |
本文来自博客园,作者:jason-wrj,更多请查看:www.dioit.com,转载请注明原文链接:https://www.cnblogs.com/jason-wrj/p/10257007.html