Unit 3 Flashcards
The vocabulary of commands understood by a given architecture
Instruction set
The idea that instructions and data of many types can be stored in memory as numbers and thus be easy to change, leading to the stored-program computer.
Stored-program concept
The sum of b and c is placed in a
ADD a, b, c
Similarly to the add instruction, blank computes b - c and puts the result in a
SUB a, b, c
C, or Java, or Legv8 - requires most lines of source code
Legv8
C, or Java, or Legv8 - requires 2nd most lines of source code
C
C, or Java, or Legv8 - requires least lines of source code
Java
LEGv8 operands how many fast data registers
32 registers X0…X30, XZR
LEGv8 operands how many memory doublewords
262 memory doublewords Memory[0], Memory [4], …, Memory[4,611,686,018,427,387,904]
assembly language for X1 = X2 + X3
ADD X1, X2, X3
assembly language X1 = X2 - X3
SUB X1, X2, X3
assembly language X1 = X2 + 20
ADDI X1, X2, 20
assembly language X1 = X2 - 20
SUBI X1, X2, 20
assembly language X1 = Memory[X2 + 40]
LDUR X1, [X2, 40]
assembly language Memory[X2 + 40] = X1
STUR X1, [X2, 40]
assembly language X1 = X2 & X3
AND X1, X2, X3
assembly language X1 = X2 | X3
ORR X1, X2, X3
assembly language X1 = X2 ^ X3
EOR X1, X2, X3
assembly language if (X1 == 0) go to PC + 4 + 100
CBZ X1, 25
assembly language if (X1 != 0) go to PC + 4 + 100
CBNZ X1, 25
assembly language if (condition true) go to PC + 4 + 100
B.cond 25
assembly language go to PC + 4 + 10000
B 2500
assembly language go to X30
BR X30
assembly language X30 = PC + 4; PC + 4 + 10000
BL 2500
A natural unit of access in a computer, usually a group of 32 bits.
Word
The size of a register in the LEGv8 architecture is blank
64 bits
Another natural unit of access in a computer, usually a group of 64 bits; corresponds to the size of a register in the LEGv8 architecture.
Doubleword
One major difference between the variables of a programming language and registers is the limited number of registers, typically blank on current computers, like LEGv8
32
A very large number of registers may blank the clock cycle time simply because it takes electronic signals longer when they must travel farther.
increase
A command that moves data between memory and registers.
Data transfer instruction
A value used to delineate the location of a specific data element within a memory array.
Address
The data transfer instruction that copies data from memory to a register is traditionally called blank.
load
The U in LDUR stands for blank as opposed to scaled immediate, which we explain in COD Section 2.19 (Fallacies and Pitfalls).
unscaled immediate
In an LDUR instruction, a blank is the starting address of an array in memory
base address
A blank is a register that holds an array’s base address
base register
A blank is a constant value added to a base address to locate a particular array element.
offset
Since LEGv8 addresses each byte, doubleword addresses are multiples of blank: there are blank bytes in a doubleword.
8
The instruction complementary to load is traditionally called blank
store
A requirement that data be aligned in memory on natural boundaries.
Alignment restriction
The process of putting less frequently used variables (or those needed later) into memory is called blank.
spilling registers
Also called binary bit. One of the two numbers in base 2, 0 or 1, that are the components of information.
Binary digit
The rightmost bit in an LEGv8 doubleword.
Least significant bit
The leftmost bit in an LEGv8 doubleword..
Most significant bit
Of a doubleword’s 64 bits, what is the leftmost bit numbered
63
What is the largest base ten number representable in 4 bits (assuming the “natural” representation)?
15
What is the largest base ten number representable in 8 bits (assuming the “natural” representation)?
255
What is the largest base ten number approximately representable by 32 bits (assuming the “natural” representation)?
4 billion
How is the largest base ten number representable by 64 bits calculated (assuming the “natural” representation)?
2^64 - 1
Hardware can be designed to add, subtract, multiply, and divide these binary bit patterns. If the number that is the proper result of such operations cannot be represented by these rightmost hardware bits, blank is said to have occurred.
overflow
A blank is a signed number representation where a single bit is used to represent the sign, and the remaining bits represent the magnitude.
sign and magnitude representation
A signed number representation where a leading 0 indicates a positive number and a leading 1 indicates a negative number. The complement of a value is obtained by complementing each bit (0 → 1 or 1 → 0), and then adding one to the result (explained further below).
Two’s complement
Signed versus unsigned applies to loads as well as to arithmetic. The function of a signed load is to copy the sign repeatedly to fill the rest of the register, known as a blank.
sign extension
A notation that represents the most negative value by 10 … 000two and the most positive value by 01 … 11two, leaving an equal number of negatives and positives but ending up with two zeros, one positive (00 … 00two) and one negative (11 … 11two). The term is also used to mean the inversion of every bit in a pattern: 0 to 1 and 1 to 0.
One’s complement
A notation that represents the most negative value by 00 … 000two and the most positive value by 11 … 11two, with 0 typically having the value 10 … 00two, thereby biasing the number such that the number plus the bias has a non-negative representation.
Biased notation
How is 0 represented in two’s complement?
All 0’s
A machine instruction is composed of blank, each field having several bits and representing some part of the instruction.
fields
A form of representation of an instruction composed of fields of binary numbers.
Instruction format
Binary representation used for communication within a computer system.
Machine language
How many total bits is a machine instruction?
32
Numbers in base 16.
Hexadecimal
The field that denotes the operation and format of an instruction.
Opcode
A blank is a register that receives the result of an operation.
destination register
ADD is an blank instruction with 5 fields: opcode, Rm, shamt, Rn and Rd.
“R-type”
ADDI and SUBI is an blank rather than “R-type” instruction.
“I-type” (I for immediate)
DUR and STUR are blank with op2 as an extension of the opcode field.
“D-type” formats
Today’s computers are built on what two key principles:
Instructions are represented as numbers.
Programs are stored in memory to be read or written, just like data.
Instructions are represented as numbers.
Programs are stored in memory to be read or written, just like data.
These principles lead to the blank
stored-program concept
blank can contain the source code for an editor program, the corresponding compiled machine code, the text that the compiled program is using, and even the compiler that generated the machine code.
memory
One consequence of instructions as numbers is that programs are often shipped as files of binary numbers. The commercial implication is that computers can inherit ready-made software provided they are compatible with an existing instruction set. Such blank often leads industry to align around a small number of instruction set architectures.
“binary compatibility”
LSL
shift left
«
LSL
LSR
shift right
> >
LSR
&
AND, ANDI
|
ORR, ORRI
~
NOT, EOR, EORI
A blank moves all the bits in a doubleword to the left or right, filling the emptied bits with 0s.
shift
Shifting left by i bits gives the same result as blank by 2^i
multiplying
A logical bit- by-bit operation with two operands that calculates a 1 only if there is a 1 in both operands.
AND
As you can see, AND can apply a bit pattern to a set of bits to force 0s where there is a 0 in the bit pattern. Such a bit pattern in conjunction with AND is traditionally called a blank, since the mask “conceals” some bits.
mask
A logical bit-by-bit operation with two operands that calculates a 1 if there is a 1 in either operand.
OR
A logical bit-by-bit operation with one operand that inverts the bits; that is, it replaces every 1 with a 0, and every 0 with a 1.
NOT
A logical bit-by-bit operation with two operands that calculates the exclusive OR of the two operands. That is, it calculates a 1 only if the values are different in the two operands.
EOR
This instruction means go to the statement labeled L1 if the value in register equals zero. The mnemonic CBZ stands for compare and branch if zero.
CBZ register, L1
It means go to the statement labeled L1 if the value in register does not equal zero. The mnemonic CBNZ stands for compare and branch if not zero. These two instructions are traditionally called conditional branches.
CBNZ register, L1
An instruction that tests a value and that allows for a subsequent transfer of control to a new address in the program based on the outcome of the test.
Conditional branch
A sequence of instructions without branches (except possibly at the end) and without branch targets or branch labels (except possibly at the beginning).
Basic block
the result that set the condition code had a 1 in the most significant bit;
negative (N)