CMPEN 331 Exam 1 (Fall 2025)

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/97

flashcard set

Earn XP

Description and Tags

Pennsylvania State University; sourced from slides and partially from the Zybook

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

98 Terms

1
New cards

Classes of Computers

Desktop, server, and embedded computers

2
New cards

Algorithm determines…

…number of operations executed

3
New cards

Architecture determines…

…number of machine instructions executed per system

4
New cards

CPU/RAM determines…

…how fast instructions are executed

5
New cards

High-level language

Level of abstraction closer to problem domain; provides for productivity and portability

6
New cards

Assembly language

Textual representation of instructions

7
New cards

Hardware representation

Binary digits (bits); encoded instructions and data

8
New cards

Datapath

Within a CPU, performs operations on data

9
New cards

Control Unit

In a CPU, sequences datapath, memory

10
New cards

Cache Memory

Small fast SRAM memory for immediate access to data

11
New cards

Volatile Memory

Main memory, loses instructions and data when powered off

12
New cards

Non-Volatile Memory

Secondary memory, retains data when powered off

13
New cards

Throughput

Total work done per unit time

14
New cards

Performance Equation

1/Execution Time

15
New cards

Elapsed Time

Total response time, including ALL aspects; determines system performance

16
New cards

CPU Time

Time spent processing a given job; different programs are affected differently by CPU and system performance

17
New cards

ALU

In CPU, the Arithmetic and Logic Unit

18
New cards

CPU Time Equation

Time = Cycles/Frequency

19
New cards

4 Main Structural Components of a Computer

CPU, Memory, I/O, System Interconnection

20
New cards

4 Main Structural Components of a CPU

Control Unit, ALU (Arithmetics and Logic Unit), Registers, System Interconnection

21
New cards

Cache Memory

Layers of memory between processor and main memory; speeds up memory access by placing data closer to the core that’s likely to be used in the future

22
New cards

Moore’s Law

Theory that number of transistors that can be put on a single chip would double every year

23
New cards

Power equation in CMOS

P = CV²F

24
New cards

Power Wall

We can’t reduce voltage further nor can we remove more heat

25
New cards

Multicore Processors

More than one processor per chip, requires parallel programming which is difficult due to synchronization and communication optimization issues

26
New cards

Wafer

A wafer of silicon is divided into a matrix of small areas, each a few millimeters square

27
New cards

Chips

Make up a silicon wafer, contains many gates and/or memory cells plus a number of input/output attachment points

28
New cards

4 Desirable Characteristics of a Benchmark Program

  1. Portability: written in a high-level language

  2. Representation: representative of a particular programming domain

  3. Consistency: will produce consistent results when run under the same conditions

  4. Readability: results should be easy to understand

29
New cards

SPEC stands for…

Standard Performance Evaluation Corporation

30
New cards

SPEC

Programs used to measure performance, develops benchmarks for CPU, I/O, and more. A

31
New cards

Amdahl’s Law Equation

T = T_unaffected + T_affected/improvement factor

32
New cards

Amhdal’s Law

Law that deals with the potential speedup of the program using multiple processors over just one

33
New cards

MIPS Formula

Clock rate / (CPI * 10^6)

34
New cards

MIPS the performance metric stands for…

Millions of Instructions Per Second

35
New cards

MIPS the instruction architecture stands for…

Microprocessor without Interlocked Pipelined Stages

36
New cards

Big-endian

Lower addresses are sent to the leftmost bytes of a word (12 34 56 78). MIPS operates in this mode

37
New cards

Little-endian

Lower addresses are sent to the rightmost bytes of a word (78 56 34 12)

38
New cards

Register Transfer Notation for
add $s0, $s1, $s2

$s0 ← [$s1] + [$s2]

39
New cards

RISC stands for…

Reduced Instruction Set Computers

40
New cards

RISC

These architectures have one-word instructions and require arithmetic operands to be in registers

41
New cards

CISC stands for…

Complex Instruction Set Computers

42
New cards

CISC

These architectures have multi-word instructions and allow operands directly from memory

43
New cards

Load/Store Architecture

Architecutres in which only load and store instructions are used to access memory operands

44
New cards

Design Principle 1

Simplicity favors regularity

45
New cards

Temporary registers in MIPS range from…

$t0 to $t9

46
New cards

Saved registers in MIPS range from…

$s0 to $s7

47
New cards

Design Principle 2

Smaller is faster

48
New cards

Design Principle 3

Make the common case fast

49
New cards

3 Differences between Registers vs Memory

  1. Registers are faster to access

  2. Registers require less load/store instructions

  3. Compiler must use registers for variables as much as possible

50
New cards

R Format

op, rs, rt, rd, shamt, funct

51
New cards

MIPS Register File

Holds thirty-two 32-bit registers; two read ports, one write port

52
New cards

Which field is never used when an R-type operation is called that only requires two register fields (e.g. sll or srl)

rs

53
New cards

sll

sll rd, rt, shamt | shift rt left by shamt bits

54
New cards

srl

srl rd, rt, shamt | shift rt right by shamt bits

55
New cards

and

and rd, rs, rt | bitwise AND rs and rt

56
New cards

or

or rd, rs, rt | bitwise OR rs and rt

57
New cards

andi

andi rt, rs, const | bitwise AND rs and const

58
New cards

nor

nor rd, rs, rt | bitwise NOR rs and rt

59
New cards

Design Principle 4

Good design demands good compromises

60
New cards

beq

beq rs, rt, Label | if rs ≠ rt then branch to Label

61
New cards

bne

bne rs, rt, Label | if rs = rt then branch to Label

62
New cards

j <== This is the letter J btw the font on this site kinda sucks

j Label | unconditonally jump to Label

63
New cards

lw

lw rt, const(rs) | load word from rs with const bytes offset

64
New cards

slt

slt rd, rs, rt | set rd to 1 if rs is less than st, else 0

65
New cards

sltui

sltui rt, rs, const | set rd to 1 if unsigned rs is less than unsigned const, else 0

66
New cards

6 Steps to Call a Procedure

  1. Place parameters in registers

  2. Transfer control to procedure

  3. Acquire storage for procedure

  4. Perform procedure’s operations

  5. Place result in register for caller

  6. Return to place of call

67
New cards

Argument registers are prefixed with…

$a

68
New cards

Result values registers are prefixed with…

$v

69
New cards

Global pointer register for static data

$gp

70
New cards

Stack pointer register

$sp

71
New cards

Frame pointer register

$fp

72
New cards

Return address register

$ra

73
New cards

jal

jal Label | Puts following instruction address in $ra and jumps to a labelled procedure

74
New cards

jr

jr $ra | Jumps back to $ra, can be used for computed statements like switch/case statements

75
New cards

Instructions to save registers $s0, $s1 on stack

addi $sp, $sp, -8
sw $s0, 0($sp)
sw $s1, 4($sp)

76
New cards

Instructions to load registers $s0, $s1 from stack

lw $s0, 0($sp)
lw $s1, 4($sp)
addi $sp, $sp, 8

77
New cards

2 Things to Save When Calling a Nested Non-Leaf Procedure

  1. Return address

  2. Arguments and temporaries needed after the call

78
New cards

Stack grows in which direction?

Downwards

79
New cards

4 memory layout elements from top to bottom

Stack/heap, static data, program code, reserved

80
New cards

lb

lb rt, const(rs) | Load byte from rs with offset const bytes, places it in the rightmost 8 bits of a register

81
New cards

lui

lui, rt, const | Copies const into upper 16 bits of rt, and clears the remaining bits of rt to 0

82
New cards

Rewrite beq $s0, $s1, Label to be able to jump to Label if Label is greater than 16 bits away

bne $s0, $s1, Label2
j Label
Label2: …

83
New cards

The 5 Addressing Modes

Register, immediate, PC-Relative, base, and pseudo-direct addressing

84
New cards

Immediate addressing

Where a numeric value is embedded in the instruction as an operand

85
New cards

Register addressing

A source/destination operand is specified as from one of the general-purpose registers

86
New cards

PC-Relative addressing

Data specified by offset relative to the program counter; used by branch instructions

87
New cards

Base addressing

Data/instruction memory location is specified as an assignment offset from a register; used by lw, lb, sw, etc.

88
New cards

Pseudo-direct addressing

The memory address is embedded in the instruction; used in j

89
New cards

Pointer

A variable that uses its own name to identify an address

90
New cards

Indirection

Referencing a value through a pointer

91
New cards

4 Stages of Compiling a Program

Compiler, Assembler, Linker, Loader

92
New cards

Compiler

Converts a high-level language program, like a C program, to an assembly language program

93
New cards

Assembler

Converts an assembly language program to an object module in machine language

94
New cards

Linker

Combines multiple object modules into an executable machine language program

95
New cards

Loader

Places executable file into memory to be run by the computer

96
New cards

3 Steps of the Linker

  1. Place code and data modules symbolically in memory

  2. Determine addresses of data/instruction labels

  3. Patch both internal and external references

97
New cards

6 Steps of Loading a Program / the Loader

  1. Read header to determine segment sizes

  2. Create a virtual address space

  3. Copy text and initialized data into memory

  4. Set up arguments on stack

  5. Initialize all registers

  6. Jump to startup routine

98
New cards

Dynamic linking

Only link or load a library procedure when it is called during execution, rather than when the program is compiled