2.3 Operands of the Computer Hardware
两个概念:
word A natural unit of access in a computer, usually a group of 32 bits.
doubleword Another natural unit of access in a computer, usually a group of 64 bits; corresponds to the size of a register in the RISC-V architecture.
这两个是用来定义RISC-V的寄存器(register)的:
The size of a register in the RISC-V architecture is 64 bits; groups of 64 bits occur so frequently that they are given the name doubleword in the RISC-V architecture. (Another popular size is a group of 32 bits, called a word in the RISC-V architecture.)
而寄存器的数量是有限的,通常是32个:
One major difference between the variables of a programming language and registers is the limited number of registers, typically 32 on current computers, like RISC-V.
也就是说,寄存器能提供32个64位的存储空间,这符合了:
Design Principle 2: Smaller is faster.
寄存器的命名方法,是加上x:
Although we could simply write instructions using numbers for registers, from 0 to 31, the RISC-V convention is x followed by the number of the register, except for a few register names that we will cover later.
而在存储(memory)的空间中:
Since 8-bit bytes are useful in many programs, virtually all architectures today address individual bytes. Therefore, the address of a doubleword matches the address of one of the 8 bytes within the doubleword, and addresses of sequential doublewords differ by 8.
如下图所示:
示例:
而从常数操作上,两种方法都可以:
网友评论