Midterm 1- Slide Decks A3-A4 Flashcards

1
Q

What are the sub-parts of the CPU?

A

registers, ALU, control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What 4 types of instructions can all CPUs perform?

A
  1. Data movement instructions(transfer data from memory to CPU, and from CPU to memory, or between two registers)
  2. Arithmetic & logic operations on data(ADD, SUB, AND, XOR, NEG)
  3. Program sequencing and control instructions (unconditional/conditional branches)
  4. Input/output transfers(transfer data from device to memory, or memory to device)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How is a Read from performed?

A
  • memory retrieves content at address given by CPU
  • value in memory does not change (READ does not change bit string EVER!)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is the Write memory instruction performed?

A
  • Memory overwrites contents at address given by CPU with data given by CPU
  • value overwritten is LOST (bits change unless it has been preserved somewhere else before being overwritten
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which register in the CPU is used to hold the address of the instruction being executed?

A

Program counter (PC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which register in the CPU holds the instruction being executed (the bit string with the encoded instruction)?

A

Instruction register (IR)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What kind of program converts assembly language to machine language?

A

The assembler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a RISC Processor?

A

RISC processors have one-word instructions and require arithmetic operands to be in CPU registers; so in RISC, can’t have: add 100, 200 (adding words at addresses in memory). RISC processors have smaller instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a CISC Processor?

A

CISC processors have variable length instructions (many multi-word instructions) and allow ALU operands directly from memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Intels are what type of CPUs?

A

CISC processors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which type of CPUs are ARMs and Mac M1, M2, and M3?

A

RISC processors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which of the two types of processor architectures is called load/store?

A

RISC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How many assembly language instructions typically correspond to a single statement in a high-level language (such as Java, C++, or C)?

A

Multiple assembly language instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

When can the address in the PC register be incremented to the address of the next instruction?

A

After the address has been sent to memory, so that the instruction can be read/fetched from memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which kinds of instructions in the CPU are used to execute if or else (or loop) statements in a high-level language?

A

Branch/Jump instructions

BLZ- goes to label in instruction to execute next instruction if last ALU result was less that 0.

BR- will go to label to execute next instruction without any condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the Processor Status Register (or PSR)?

A

Four 1 bit flags in the PSR that are used by processor to store information about the result of executing an ALU instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What four flags does the PSR have?

A

S - Sign flag: Set to 1 by processor of result of last ALU operation was negative (msb of result is 1); otherwise set to 0
Z - Zero flag: Set to 1 by the processor if the result of the last ALU operation was 0; otherwise eat to 0
C - Carry flag: Set to 1 if result of last instruction generated a carry of 1; otherwise set to 0
O - Set to 1 if last two carries are different, otherwise set to 0.

18
Q

What are labels used for in assembly language?

A

To mark addresses of data or instructions in a program

19
Q

Do labels occupy any space in memory? Why or why not?

A

Labels use no space in memory because they are NOT data

20
Q

Which built-in data structures does the CPU recognize?

A

None. There are NO built-in data structures which the CPU recognizes

21
Q

What is a subroutine (function/procedure/method)?

A

Function: Some task may have to be done many times using different sets of data

Procedure: Implement task in one block of instructions; this is the subroutine

Method: We use a subroutine call. Will return to the instruction where the call was made

22
Q

How is a subroutine called?

A

Caller subroutine puts parameters for callee in frame of callee. When called, address of next instruction after call will be pushed onto stack

23
Q

How is a subroutine call different from a branch?

A

A return address must be saved

24
Q

In what two ways can the return address be saved?

A

Single link register and stack

25
Which way of saving a return address has a limitation on the number of subroutine calls which can be made before returning to the original calling subroutine?
**Stack, since the size is fixed and it has a limit**. We do not have an infinite amount of memory
26
Besides being used to save a return address, what other kinds of data related to a subroutine call can a stack be used for?
Parameters and return value
27
How many instructions in assembly language correspond to a single machine language instruction?
One assembly instruction always per machine language instruction
28
Does every type of CPU (Intel, ARM, Mac M1, SPARC, PowerPC, MIPS etc.) use the same assembly language?
No, each CPU has its own assembly language and some (like Intels) have several
29
How many assembly language instructions does a high-level language statement (Java, C++, C, etc.) correspond to?
Typically more than one; high-level language statements typically require multiple assembly instructions
30
Which real CPU architecture is the Y86-64 simulated CPU based on?
Intel X86-64
31
What is Instruction Set Architecture (ISA)?
**The human programmer visible machine interface**. This means part of hardware which the programmer can see (such as instruction set, register, memory organization)
32
What are the two major types of ISAs today?
RISC and CISC
33
How many registers does Y86-64 have?
15 64-bit registers
34
Why is the number of registers in Y86 unlike a real CPU?
Real CPUs always have a number of registers equal to a power of 2
35
How many condition codes (or flags) does Y86 have, and what are they?
**There are 3 condition codes (or flags) and they are ZF(zero), SF(negative), OF(overflow)**.No carry flag because we are dealing with signed ints only, no unsigned overflow possible
36
How are the condition codes/flags in Y86 set by the processor?
**Single- bit flags set by arithmetic or logical instruction**. ZF- Set if the result of the last ALU operation is 0 SF- Set if the result of last ALU operation resulted in sign bit (msb of result is 1) OF- Set if result of last ALU operation resulted in signed overflow **No C flag because Y86 CPU works only on signed numbers**
37
What kinds of operands can the Y86 simulated CPU work on?
Signed Operands
38
What sizes of operands can the Y86 simulated CPU work on? How is this different from real CPUs?
Only 8 bytes (64 bits). Real CPUs can work on data of different sizes 1 bytes, 2 bytes, 4 bytes, or 8 bytes.
39
What size are addresses in Y86?
8 bytes (64 bits)
40
What is the difference in the way multi-byte data is stored in memory in a big-endian versus a little-endian system?
Big-endian: **most significant byte of data is stored at lowest address**; **least significant byte stores at highest number address** Little-endian: **least significant byte is stored first** and **most significant byte is stored last**
41
Is Y86 (and Intel) big-endian or little-endian?
Little-endian