## CPSC 220, Fall 2011 About the First Test

The first test in CS 220 will be given in class on Friday, October 28. It will cover everyting that we have done so far, including the labs and the reading. The readings include Chapters 3, 4, 5, and 6 from the Larc manual and the following sections from the textbook: Chapter 1, Sections 1 and 2; Chapter 2, Sections 1, 2, 3, and 4; and Appendix B, Section 1. You might also read Chapter 2, Sections 5, 6, and 7 from the textbook, even though they have not yet been officially assigned. Those sections work with the full MIPS machine language, but they cover material that we have looked at from the perspective of LARC.

You should also know about Java's bitwise logical and shift operators (from Lab 1), logic gates and circuits (from Lab 2), and how to write a Larc simulator (Lab 4).

The test will be made up of a variety of questions, including some or all of the following: writing programs, figuring out what some given code does, drawing and interpreting logic circuit diagrams, short answer questions, and longer essays.

You do not have to memorize the Larc machine language or assembly language. You will be given a sheet with tables from the Larc manual listing machine and assembly language instructions and traps. (The sheet will have the tables from pages 23, 28, 38, 47, and 48.)

Here are some terms and ideas that you should be familiar with:

```bitwise logical operators in Java for AND, OR, NOT, and XOR:  &, |, ~, ^
logical shift operators in Java: >>> and <<
arithmetic shift operator in Java: >>
what's "arithmetic" about the arithmetic shift operator?
using the shift and bitwise operators to set and test bits in a number
using the shift and bitwise operators to extract some bits from a number

switches as the fundamental building blocks of computers
relays, vacuum tubes, and transistors
how switches can be used to build logic gates

binary numbers
signed and unsigned integers
twos-complement representation of negative numbers
subtracting binary numbers by adding a twos-complement

logic gates
AND gate, OR gate, NOT gate, XOR gate
building logic circuits from gates
how to build a 1-bit adder circuit
how to build a 16-bit adder from 16 1-bit adders
how to build a subtraction circuit
multiplexor
control wires

basic components of a computer
memory (RAM) and memory addresses
ALU (Arithmetic/Logic Unit)
registers
program counter
ISA (Instruction Set Architecture)

LARC, a simple model computer
the LARC register file (16 16-bit numbers, register 0 is always 0)

LARC machine language
format of LARC machine language instructions
LIMM, SIMM, and sign extension
immediate values
conditional, relative branching
traps and the syscall instruction
representation of strings in LARC
accessing memory using load and store (lw and sw) instructions
using register zero for: copying a value, unconditional branch

assembly language and assemblers in general
LARC assembly language
the .text and .data sections of a program
compiler directives:  .asciiz "string", .word 17, .word LABEL, .space 17
labels
defining and using labels in a program
extended instructions that can produce multiple machine language instructions
using larger numbers in extended instructions, such as li \$3 1234 or lw \$2 100(\$3)
converting Java-like pseudocode into assembly language

LARC operation and simulation
the fetch-and-execute cycle
kernel mode, I/O, and traps
how the program counter is used
how the value in the program counter is modified
how registers and memory can be represented in a simulation
how instructions can be decomposed into their meaningful parts

what is a linker and why they are needed (from the reading in Section B.1)

```