ARM基礎(chǔ):ARM中“字”的長(zhǎng)度
參考:
說(shuō)明:ARM基礎(chǔ):ARM中“字”的長(zhǎng)度。
/
(這里不討論一個(gè)“漢字”代表兩個(gè)“字節(jié)”的問(wèn)題,這個(gè)差點(diǎn)都干擾我了都)
在學(xué)習(xí)匯編時(shí)用到了LDRHR2,[R1] ;將存儲(chǔ)器地址為R1的半字?jǐn)?shù)據(jù)讀入寄存器R2,并將R2的高16位清零。以前沒(méi)有聽(tīng)過(guò)字這個(gè)這個(gè)概念,就很糾結(jié)。就引起了我弄清“字”的長(zhǎng)度的好奇心。字到底有多少個(gè)字節(jié),這是一個(gè)很晦澀的問(wèn)題,都特別是這樣的解釋:
“在計(jì)算機(jī)領(lǐng)域,對(duì)于某種特定的計(jì)算機(jī)設(shè)計(jì)而言,字是用于表示其自然的數(shù)據(jù)單位的術(shù)語(yǔ)。在這個(gè)特定計(jì)算機(jī)中,字是其用來(lái)一次性處理事務(wù)的一個(gè)固定長(zhǎng)度的位(bit)組。一個(gè)字的位數(shù)(即字長(zhǎng))是計(jì)算機(jī)系統(tǒng)結(jié)構(gòu)中的一個(gè)重要特性。”
就是不明白,不過(guò)上邊的LDRHR2,[R1]實(shí)驗(yàn)結(jié)果是R1指向的內(nèi)存地址的16bit都給了R2,說(shuō)明“字”是32位的。但是當(dāng)我用Win7上的計(jì)算器時(shí)卻發(fā)現(xiàn)了另一種情況。如下圖可見(jiàn),一個(gè)“字”,卻給出了16bit。
這更激怒我了,非要搞明白不可了。在google時(shí)在wiki上找到了答案,這個(gè)“字”并不是固定的,對(duì)于X86來(lái)說(shuō)是16位,對(duì)于ARM來(lái)說(shuō)是32位。(鏈接這里)
對(duì)各個(gè)架構(gòu)都做了字長(zhǎng)的統(tǒng)計(jì),轉(zhuǎn)來(lái)看看。
這就說(shuō)明誰(shuí)都沒(méi)有錯(cuò)了,Win7自帶的計(jì)算器是按照x86的標(biāo)準(zhǔn)來(lái)的。要想用這個(gè)計(jì)算器來(lái)計(jì)算ARM中的字,要用這里的“雙字”來(lái)代表ARM中的一個(gè)“字”。
字長(zhǎng)表
年份 | 計(jì)算機(jī) | 字長(zhǎng) | 整數(shù) | 浮點(diǎn)數(shù) | 長(zhǎng)度 | 編址單位 | 字符 | |
1941 | ZuseZ3 | 22b | – | w | 8b | w | – | |
1942 | ABC | 50b | w | – | – | – | – | |
1944 | HarvardMarkI | 23d | w | – | 24b | – | – | |
1946 | ENIAC | 10d | w,2w | – | – | – | – | |
1951 | UNIVACI | 12d | w | – | ½w | w | 1d | |
1952 | IASmachine | 40b | w | – | ½w | w | 5b | |
1952 | IBM701 | 36b | ½w,w | – | ½w | ½w,w | 6b | |
1952 | UNIVAC60 | nd | 1d,...10d | – | – | – | 2d,3d | |
1953 | IBM702 | nd | 0d,...511d | – | 5d | d | 1d | |
1953 | UNIVAC120 | nd | 1d,...10d | – | – | – | 2d,3d | |
1954 | IBM650 | 10d | w | – | w | w | 2d | |
1954 | IBM704 | 36b | w | w | w | w | 6b | |
1954 | IBM705 | nd | 0d,...255d | – | 5d | d | 1d | |
1954 | IBMNORC | 16d | w | w,2w | w | w | – | |
1956 | IBM305 | nd | 1d,...100d | – | 10d | d | 1d | |
1958 | UNIVACII | 12d | w | – | ½w | w | 1d | |
1958 | SAGE | 32b | ½w | – | w | w | 6b | |
1958 | AutoneticsRecompII | 40b | w,79b,8d,15d | 2w | ½w | ½w,w | 5b | |
1959 | IBM1401 | nd | 1d,... | – | d,2d,4d,5d,7d,8d | d | 1d | |
1959 | IBM1620 | nd | 2d,... | – | 12d | d | 2d | |
1960 | LARC | 12d | w,2w | w,2w | w | w | 2d | |
1960 | IBM1410 | nd | 1d,... | – | d,2d,6d,7d,11d,12d | d | 1d | |
1960 | IBM7070 | 10d | w | w | w | w,d | 2d | |
1960 | PDP-1 | 18b | w | – | w | w | 6b | |
1961 | IBM7030 | 64b | 1b,...64b, | w | ½w,w | b,½w,w | 1b,...8b | |
1961 | IBM7080 | nd | 0d,...255d | – | 5d | d | 1d | |
1962 | UNIVACIII | 25b,6d | w,2w,3w,4w | – | w | w | 6b | |
1962 | UNIVAC1107 | 36b | 1/6w,?w,½w,w | w | w | w | 6b | |
1962 | IBM7010 | nd | 1d,... | – | d,2d,6d,7d,11d,12d | d | 1d | |
1962 | IBM7094 | 36b | w | w,2w | w | w | 6b | |
1963 | GeminiGuidanceComputer | 39b | 26b | – | 13b | 13b,26b | – | |
1963 | ApolloGuidanceComputer | 15b | w | – | w,2w | w | – | |
1964 | CDC6600 | 60b | w | w | ¼w,½w | w | 6b | |
1965 | IBM360 | 32b | ½w,w, | w,2w | ½w,w,1½w | 8b | 8b | |
1965 | UNIVAC1108 | 36b | 1/6w,¼w,?w,½w,w,2w | w,2w | w | w | 6b,9b | |
1965 | PDP-8 | 12b | w | – | w | w | 8b | |
1970 | PDP-11 | 16b | w | 2w,4w | w,2w,3w | 8b | 8b | |
1971 | Intel4004 | 4b | w,d | – | 2w,4w | w | – | |
1972 | Intel8008 | 8b | w,2d | – | w,2w,3w | w | 8b | |
1972 | Calcomp900 | 9b | w | – | w,2w | w | 8b | |
1974 | Intel8080 | 8b | w,2w,2d | – | w,2w,3w | w | 8b | |
1975 | Cray-1 | 64b | 24b,w | w | ¼w,½w | w | 8b | |
1975 | Motorola6800 | 8b | w,2d | – | w,2w,3w | w | 8b | |
1975 | MOSTech.6501 | 8b | w,2d | – | w,2w,3w | w | 8b | |
1976 | ZilogZ80 | 8b | w,2w,2d | – | w,2w,3w,4w,5w | w | 8b | |
1978 | Intel8086 | 16b | ½w,w,2d | – | ½w,w,...7w | 8b | 8b | |
1978 | VAX-11/780 | 32b | ¼w,½w,w,1d,...31d,1b,...32b | w,2w | ¼w,...14¼w | 8b | 8b | |
1979 | Motorola68000 | 32b | ¼w,½w,w,2d | – | ½w,w,...7½w | 8b | 8b | |
1982 | Motorola68020 | 32b | ¼w,½w,w,2d | – | ½w,w,...7½w | 8b | 8b | |
1985 | ARM1 | 32b | w | – | w | 8b | 8b | |
1985 | MIPS | 32b | ¼w,½w,w | w,2w | w | 8b | 8b | |
1989 | Intel80486 | 16b | ½w,w,2d | 2w,4w,5w,17d | ½w,w,...7w | 8b | 8b | |
1989 | Motorola68040 | 32b | ¼w,½w,w,2d | w,2w,2½w | ½w,w,...7½w | 8b | 8b | |
1991 | PowerPC | 32b | ¼w,½w,w | w,2w | w | 8b | 8b | |
2000 | IA-64 | 64b | 8b,¼w,½w,w | ½w,w | 41b | 8b | 8b | |
2002 | XScale | 32b | w | w,2w | ½w,w | 8b | 8b | |
說(shuō)明:b:位,d:10進(jìn)制數(shù),w:該構(gòu)架的字長(zhǎng),n:變量長(zhǎng)度(variablesize) |
評(píng)論