CS 2733/2731, Fall 2004
Computer Organization II Review for Exam 1 (8 October 2004)
Topics:
Overview (Chapter 1)
1: Nothing directly asked about this, just for orientation.
32-bit ints (3.1, 3.2, 3.3)
Conversions: between binary, decimal, hexadecimal.
Representation of Integers: 2s complement for negative numbers.
Shortcut for negation:
write in binary, complement, add 1.
Shortcut for sign extention: copy sign bit to the left.
MIPS Assembly Language (Chapter 2)
Format, constants in hex (start with 0x)
or decimal, comments following #
Registers, 32: $0-$31, with symbolic names
(but don't need to memorize them)
Basic instructions
Arithmetic (add, sub,
and, or, sll,
srl, nor)
Arithmetic immediate (addi, andi,
ori)
Load/Store (lw, sw) --
uses offset in bytes to form an address
Load address (pseudo: la, uses lui
and ori)
Branches
bne, beq (offset in words from PC)
slt
all other branches are pseudo instructions
Jumps
j, jal (absolute addr in words)
jr (jump to address in a register)
Pseudo-instructions, and simulating them with real instructions:
li, move, la,
blt, mul, b
Coding loops
Arrays, and their access (in memory, must use lw
or sw).
Functions and function calls (use jal to call
and jr $ra to return.
Parameters to functions ($a0 - $a3),
returned values ($v0,
$v1), or on the stack.
Use of the stack: local variables, local (automatic) arrays
Saving registers during function call:
use the stack, save at the beginning (with sw),
restore at the end (with lw), must allocate
storage on stack and then free it at the end.
Recursion: Recitation 7. Stack is essential.
The assembly and compilation processes:
High-level source(C/C++), transformed by
compiler to:
Assembler language program, transformed by
assembler to:
Object file in machine language, transformed
with other object files by linker to:
Executable module, loaded into a computer by
loader and executed.
MIPS Machine Language (Chapter 2)
High order 6 bits is Op code, saying which instruction it is.
Basic types
R-type (register), usually 3 registers (arithmetic, logical,
slt, jr)
Op code is always 0, and low order 6 bits (the funct field)
says which R-type it is.
Registers given in order: operand1 (the rs field),
operand2 (the rt field),
destination (the rd field).
The shamt field is zero except for shifts
sll, srl.
I-type (immediate), lw, sw,
beq, bne, addi,
lui.
Starts with opcode field,
rs register field, rt register field,
followed by low order immediate field:
a 16-bit 2s-complement constant.
immediate field: an offset from the Program
Counter in words for beq and
bne.
An offset from the base register
in bytes for lw and
sw.
J-type (jump), j, jal
(Uses low order 26-bit constant, as a word address.
Get a 28-bit constant as a byte address.)
Hand conversion of machine language into assembly (dis-assembly)
[Not emphasized, since this is in Lab 7]
Hand conversion of assembly into machine language (assembly)
[Not emphasized, since this is in Lab 7]
Construction of NAND, NOR, NOT, AND, OR gates from CMOS transistors:gates from transistors (PDF).
Combinational Logic (B.1, B.2, B.3)
Truth tables, boolean algebra, logic equations
AND, OR and NOT gates
Combinational logic
Decoders
Multiplexors
Create logic circuit to represent arbitrary
truth table. (Skip PLAs, Don't Cares)
Possible Questions
(see also previous exams online):
For previous exams, follow links on main course page to previous course
pages and look at the bottom of these for previous exams.
About binary integers (especially 2s complement).
Asking for MIPS assembler programs, including
loops,
arrays (loads and stores),
functions (including
register conventions and saving/restoring registers using the stack).
Use of other assembler instructions, including
la (and how it uses
lui and ori to create
a 32-bit constant).
About other pseudo-instructions.
Format of MIPS machine instructions.
About the assembly process.
About the construction of gates for CMOS transistors (from handout).
About converting a truth table to a combinational logic circuit.