Review M: The MINIAC machine: Questions
CPUs contain a specially designated register called a program counter. Explain what the program counter does.
What distinguishes the Harvard architecture (which the MINIAC uses) from the von Neumann architecture (used by ARM processors)?
Distinguish between the terms machine language and assembly language.
Translate the below five-instruction MINIAC program to machine language.
loop LI -1
ST 5
AD 5
BN loop
halt BZ halt
Write MINIAC assembly code that places into data memory at address 4 the negation of the value found in data memory at address 7.
Write MINIAC assembly code that looks at data memory at address 8 and places a 0 into data memory at address 6 if the number is even and 1 if it is odd.
Review M: The MINIAC machine: Solutions
The program counter holds the memory address indicating where to load the next instruction to be executed. It essentially keeps track of where the computer is currently located within the program it is executing.
In a Harvard architecture computer, the program instructions and the program data are stored in two separate memories, with different address spaces; by contrast, a von Neumann architecture stores both instructions and data alongside each other in the same memory.
Machine language specifies how a machine decodes binary data as instructions for it to execute. Assembly language specifies a textual representation easier for humans to read and write, that translates to machine language in a transparent manner.
loop | LI -1 | 10011111 |
ST 5 | 01000101 | |
AD 5 | 11000101 | |
BN loop | 00111101 | |
halt | BZ halt | 00000000 |
LI 0 # to negate RAM[7], compute 0 - RAM[7] and store at RAM[4]
SB 7
ST 4
LM 8 # load input, rotate 7 spots so 1 bit is in -128's bit
RL 7
BN odd # if top bit is 1, then original number was odd
LI 0 # otherwise, store 0 at address 8 and halt
ST 8
BZ 0
odd LI 1 # sore 1 at address 8 and halt
ST 8
LI 0
BZ 0