一个字节总是8位吗? [英] Is a byte always 8 bits?

查看:398
本文介绍了一个字节总是8位吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我阅读以下摘录时,我正在研究计算系统的要素:

I'm working through The Elements of Computing Systems when I read the following excerpt:

Hack计算机包括一个黑白屏幕,组织为256 每行512像素的行.屏幕内容由表示 从RAM地址16384(0x400)开始的 8K内存映射.每一行 在物理屏幕中,从屏幕的左上角开始是 在RAM中用32个连续的16位字表示.因此位于的像素 顶部的r行和左侧的c列映射在c%16上 位于RAM [16384 + r *]上的字的位(从LSB到MSB) 32 + c%16].要写入或读取物理屏幕的像素,一个 读取或写入RAM驻留内存映射中的相应位 (1 =黑色,0 =白色).

The Hack computer includes a black-and-white screen organized as 256 rows of 512 pixels per row. The screen's contents are represented by an 8K memory map that starts at RAM address 16384 (0x400). Each row in the physical screen, starting at the screen's top left corner, is represented in RAM by 32 consecutive 16-bit words. Thus the pixel at row r from the top and column c from the left is mapped on the c%16 bit (counting from LSB to MSB) of the word located at RAM[16384 + r * 32 + c%16]. To write or read a pixel of the physical screen, one reads or writes the corresponding bit in the RAM-resident memory map (1 = black, 0 = white).

那么,如果屏幕是256行512像素,并且每个像素是一个位,那么整个屏幕的8K内存映射如何?

So, if the screen is 256 rows of 512 pixels, and each pixel is a single bit, how is that an 8K memory map for the whole screen?

256行* 512位= 131072/每字节8位/每K 1024字节= 16K

256 rows * 512 bits = 131072 / 8 bits per byte / 1024 bytes per K = 16K

那不是16K内存映射吗?

Wouldn't that be a 16K memory map?

我唯一能想到的是,因为字长为16位,这可能是一个因素吗?我一直都知道字节"的意思是8位,但是如果其定义取决于计算机的字长,那么也许对我来说可以解决这个奥秘.有人可以向我解释该段中描述的屏幕是如何用8K内存映射而不是16K表示的吗?

The only thing I can think of is that because the word size is 16 bits, maybe this plays a factor? I have always known "byte" to mean 8 bits, but if its definition is dependent on the word size of the computer, maybe that would solve this mystery for me. Can someone explain to me how the screen described in that paragraph is represented with an 8K memory map and not 16K?

推荐答案

是的,在现代计算中,字节始终为8位.

Yes, a byte is always 8 bits in modern computing.

这本书使用单词而不是字节

在书中,明确提到了单词和单词的大小,而没有关于字节的单词(haha).查看短语..is represented in RAM by 32 consecutive 16-bit words..整个大小以(16位)字而不是字节表示.

In the book, the word and the size of the word is explicitly mentioned, while there is not a word (haha) about bytes. Look at the phrase ..is represented in RAM by 32 consecutive 16-bit words.. The whole size is expressed in (16 bit) words rather than bytes.

因此,8K表示8个千字.如果在本书中全部使用了8KB,则正式写成8KB.

Therefore, 8K refers to 8 Kilowords. 8 kilobytes would formally be written as 8KB, if that notation is used at all in this book.

当涉及到处理器体系结构时,单词非常重要.编程语言中的字通常为2个字节(或16位),但在处理器体系结构中,它们也可以为8位或32位,它们指的是处理器所使用的数据单元的自然大小,因此,这本书使用单词而不是字节,因为文本似乎是面向硬件的.

Words are quite important when it comes to processor architecture. Words in programming languages are usually 2 bytes (or 16 bits), but in processor architecture they can be 8 or 32 bits as well, and they refer to the natural size of the data units with which a processor works, so it makes sense that the book uses words rather than bytes, since the text seems very hardware oriented.

要了解字节和单词之间的关系,请阅读此答案.

To see how bytes and words are related, please read this answer.

不同的字节大小

维基百科根据所需的信息大小来描述字节的原始格式(1960年代)保留,因此6位字节可用于(英文)字符,而其他大小的字节可用于不同的数字格式.它最初以英语字符的6位开始,后来增加到支持ASCII的7位,最终8位IBM System/360的流行使全球接受了8位字节.

Wikipedia describes how a byte was originally (1960s) based on the size of information it needed to hold, so a 6 bit byte could be used for (English) characters, while bytes of other sizes would be used for different number formats. It started out as 6 bits for English characters, grew to 7 bits to support ASCII, and eventually the popularity of the 8 bit IBM System/360 caused the global acceptance of 8 bit bytes.

字节是代表数据量的软件单元,而一个字则与处理器/内存体系结构联系更紧密,并且代表处理器中的工作单元(寄存器)和内存中的可寻址单元. 但是,如今,字节始终被认为是8位,而字是其倍数.仍然有周围的处理器具有不同的字长,但是它们是特殊用途的处理器.从PC到电话和游戏机的普通硬件都遵循该标准.

A byte is a software unit representing an amount of data, while a word is more tied to the processor/memory architecture and represents work units (registers) in the processor and the addressable units in memory. Nowadays though, a byte is always considered to be 8 bits, and words are a multiple of that. There are still processors around that have a different word size, but those are special purpose processors. Normal hardware, from PCs to phones and game consoles follows the standard.

这篇关于一个字节总是8位吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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