Computer Architecture Example CSE 410 Fall 98  

Memory
There is a memory of 1000 locations, numbered from 0 to 999. Each location is capable of holding a number. Since instructions are numbers, each location is also capable of holding an instruction.



Processor Registers
The processor contains the following special locations, called registers.
Instructions
Each instruction consists of a 1-digit opcode followed by a three-digit location number, also called the address. There are 9 opcodes, listed below.

OpcodeMnemonicDescriptionNotes
0haltHalt the computer(address is ignored)
1loadLoad from locationaccum<-location
2storeStore to locationlocation<-accum
3addAddaccum<-accum+location
4subSubstractaccum<-accum-location
5mulMultiplyaccum<-accum*location
6divDivideaccum<-accum/location
7brBranch to addresspc<-address
8brposBranch if accum>0if (accum>0) pc<-address

Example: compute y=x*x+4*x-5
10:	1100		accum <- x
11:	5100		accum <- x*x
12:	2019		temporary <- x*x
13:	1100		accum <- x
14:	5020		accum <- 4*x
15:	4021		accum <- 4*x-5
16:	3019		accum <- x*x+4*x-5
17:	2101		y <- accum
18:	0000		halt
19:	0000		(temporary location)
20:	0004		(constant 4)
21:	0005		(constant 5)