Sap 1
Sap 1
Simple-As-Possible Computer
Simple-As-Possible(SAP) Computer has been designed for beginners. The main purpose of SAP is to introduce all the crucial ideas behind computer operation. There are three different generations of SAP. (SAP-1 SAP-2 SAP-3)
SAP-1 Computer
SAP-1 is a computer because it stores a program and data before calculations begin; then it automatically carries out the program instructions without human intervention. And yet, SAP-1 is a primitive computing machine. When compared to a modern computer, it is like a Neanderthal human compared to a modern person. SAP-1 is the first stage in the evolution toward modern computers.
SAP-1 ARCHITECTURE
SAP-1 Architecture
Architecture is the conceptual design and fundamental operational structure of a computer system. It is the blueprint and functional description of requirements and design implementations for various parts of a computer.
PROGRAM COUNTER
8 ACCUMULATOR 8 8
W Bus 8
ADDER SUBTRACTOR 8
B REGISTER
SAP-1 Architecture
SAP-1 Architecture is a Bus-Organized Computer. All register outputs to W Bus are three-state; these allows orderly transfer of data. All other register outputs are two-state; these outputs continuously drive the boxes they are connected to.
Three-State
DATA IN DATA OUT
ENABLE 0 1 1 Din X 0 1 Dout OPEN 0 1
ENABLE
Din 0
Dout
= OPEN
Din 1
Dout
= CLOSED
Bus-Organized Computer
Bus is a group of wires that transmit a binary word. It is a common transmission path between the three-state registers.
A REGISTER
4 4 BUS
4 4
C REGISTER
B REGISTER
4 4
4 4
D REGISTER
Data Transfers
The advantage of bus organization is the ease of transferring a word from one register to another. To begin with, the same CLK signal drives all the registers, but nothing happens until you apply HIGH(1) signal to the control inputs(LOAD and ENABLE). In other words, as long as all LOAD and ENABLE inputs are LOW(0), the registers are isolated from the bus. CLR input clears the word in the register when HIGH(1).
EXAMPLE: except D.
Transfer word 0101 from A to B. Then from B to C and from C to D. After all registers have the binary word, Clear all register
LA CLR EA 0101 A C
LC CLR EC
LB CLR EB B D
LD CLR ED
LA 1 CLR EA 0101 A C
LC CLR EC
LB CLR EB 0101 B D
LD CLR ED
LC CLR EC
LB CLR 1 EB 0101 B D
LD CLR ED
LC CLR EC 1
LD CLR ED
LC CLR EC 1
LD CLR ED
CP EP CLK CLR LM CLK INPUT and MEMORY ADDRESS REGISTER 4 RAM 4 RAM 8 8 4 PROGRAM COUNTER 4
LA EA CLK SU EU
CE LI EI CLK CLR
LB CLK LO CLK
SAP-1 Architecture
The SAP-1 Control unit consists of the Program counter, the Instruction Register and the Controller-Sequencer that produces the control word, the clear signals and the clock signal. The SAP-1 ALU(Arithmetic Logic unit) consists of an Accumulator, an Adder/Subtractor and a B Register. The SAP-1 Memory has the Memory Address Register and a 16x8 RAM. The SAP-1 I/O unit includes the programming switches, Output register and Binary display.
Program counter
Program counter is a circuit counter that counts from 0000 to 1111. The binary word output of the counter (0000 to 1111) corresponds to the memory location or address(00H to 10H) of RAM where the instruction is written.
Random-Access Memory(RAM)
Before a computer run, the instruction or data word is stored in the RAM by using address and data switch registers. During a computer run, the RAM receives the 4-bit address from the MAR and a read operation is performed. In this way, the instruction or data word stored in the RAM is placed on the W bus for use in some other part of the computer.
RAM
CE D0 D1 D2 D3 WE O0 O1 O2 O3 A3 A2 A1 A0
To write data on the RAM: ----Address the memory where the data will be written. [SAP-1 uses two 16x4 TTL RAM. In this case, there are 16 memory locations(address) to write on with 4 bits of data.] ----Clear both CE and WE to perform write operation. Example: Write 1001 on 10H.
0 1 0 0 1
1 0 1
0 ------1001
0
AH BH CH
To read data from the RAM: ----Address the memory where the data will be read. ----Clear CE and set WE to perform Read operation. Example: Read the data stored in 10H.
0 A0 A3 Address bits D 0 D3 Data Input O0 O 3 Data Output (threestate) CE Chip Enable WE Write Enable
1 1 0 0 1 ------1001 AH BH CH
1 0 1
Instruction Register
Instruction register is a part of control unit and a buffer register that fetch an instruction from the RAM when the computer does a memory read operation. The upper nibble(MSB) output of the instruction register goes directly to the Controller-Sequencer, the lower nibble(LSB) is a three-state output that is read onto the W bus when needed.
Controller-Sequencer
This controls the whole operation of the computer(like a supervisor telling everyone what to do) by sending out 12-bit word called control word. The control word has the format of: CON = CPEPLMCE LIEILAEA SUEULBLO Also, the controller-sequencer contains the Clock generator which sends out CLK and CLK signals and the Master reset which sends out CLR and CLR signals.
Accumulator
Accumulator is a part of ALU and a buffer register that stores intermediate answers during computer run. Accumulator has two sets of outputs. The first set of output is two-state and is directly connected to Adder/Subtractor. The second set of output is a three-state and is directly connected to the W bus. Also called as the A Register.
B Register
B register is a part of ALU and another buffer register which contains the number to be added or subtracted to the contents of the accumulator.
Adder/Subtractor
The adder/subtractor is consists of two 4-bit full adder that can perform addition and subtraction(by using 2's complement).
Output Register
Output register is the register that receives the processed data from the accumulator and drives the output display of SAP-1. Also called as output port because it processed data can leave the computer through this register. In microcomputers, the output ports are connected to interface circuits that drive peripheral devices.
Binary Display
The binary display is a row of 8 LEDs. Because the binary display is connected to the output port, it shows the contents of the processed data.
LDA
LDA means ''LoaD the Accumulator''. A complete LDA instruction includes the address or memory location(written in hexadecimal to avoid confusion). Example: LDA 8H
LDA 8H means ''Load the accumulator with the contents of memory location 8H''
ADD
ADD is another SAP-1 instruction. A complete ADD instruction includes the address or memory location where given data is stored to be added. Example: ADD AH
ADD AH means ''ADD the contents of memory location AH to the contents of accumulator''.
SUB
SUB is another SAP-1 instruction. A complete SUB instruction includes the address or memory location where given data is stored to be subtracted. Example: SUB CH
SUB CH means ''SUB the contents of memory location CH to the contents of accumulator''.
OUT
The instruction OUT tells the SAP-1 computer to transfer the accumulator contents to the output port. OUT is complete by itself; that is you do not have to include an address or memory location when using OUT. Example: OUT
HLT
HLT means ''HaLT''. This instruction tells the computer to stop processing data. HLT marks the end of a program. It is necessary to use HLT instruction at the end of every SAP-1 program; otherwise, you will get a computer trash(meaningless answers caused by runaway processing). HLT is complete by itself; that is you do not have to include an address or memory location when using HLT. Example: HLT
SAP-1 PROGRAMMING
SAP-1 Program
Example:
ADDRESS 0H 1H 2H 3H 4H 5H 6H 7H 8H 9H
CONTENTS LDA 6H ADD 7H ADD 8H SUB 9H OUT HLT 0000 1010 0000 0101 0010 0011 0011 0010
SAP-1 Program
To load the instruction and data word into SAP-1, we need to convert the source program(original program with mnemonics) into object program(program written in machine language). This means, instructions in mnemonic will be converted in operation code. Mnemonic LDA ADD SUB OUT HLT Op code 0000 0001 0010 1110 1111
Example: ADDRESS 0H 1H 2H 3H 4H
Translate the program into SAP-1 machine language. CONTENTS LDA 9H ADD AH SUB BH OUT HLT
LDA=0000 ADD=0001 SUB=0010 OUT=1110 HLT=1111 ADDRESS 0000 0001 0010 0011 0100 CONTENTS 0000 1001 0001 1010 0010 1011 1110 xxxx 1111 xxxx
The T4, T5 and T6 are execution cycles. In these states, the instruction is carried out or performed. There are different execution cycles for each instructions. It is called microinstruction. For example, LDA has three microinstructions for each timing states. Microinstructions that were group together is called macroinstructions.
STATE T4 T5 T6 T4 T5 T6 T4 T5 T6 T4 T5 T6
CON 1A3 2C3 3E3 1A3 2E1 3C7 1A3 2E1 3CF 3F2 3E3 3E3
T State T1 T2 T3 EXECUTION CYCLE T State T4 LDA T5 LDA T6 LDA T4 ADD T5 ADD T6 ADD T4 SUB T5 SUB T6 SUB T4 OUT
CON 5E3 BE3 263 CON 1A3 2C3 3E3 1A3 2E1 3C7 1A3 2E1 3CF 3F2
EP CP CE LI
Active LM
Active LM EI CE LA none LM EI CE LB LA EU LM EI CE LB LA SU EU EA LO