Professional Documents
Culture Documents
Department
Submitted by: Aromin, Denisse Aubrey L. Buraga, Vincent Paul B. Dianzen, Fruzzel Paul P. Francia, Munich J. Garillo, Lois Eunice R. Jimenez, Mary Grace S. Tolentino, Joshua Nico V.
INTRODUCTION
The Simple-As-Possible (SAP)-1 computer is a very basic model of a microprocessor explained by Malvino. The SAP-1 design contains the basic necessities of a functional microprocessor. Its primary purpose is to develop a basic understanding of how a microprocessor works, interacts with memory and other parts of the system like input and output. The instruction set SAP-1 is very limited and simple. Its main purpose is to introduce all the crucial ideas behind computer operation without burying in unnecessary details. But even simple computer like SAP covers many advanced concepts. SAP-1 is the evolution toward modern computers. Be ready to SAP-1 and you will be ready to SAP-2.
The first four bits make the opcode while the last four bits make the operand (address).
Mnemonic LDA ADD SUB OUT HLT ANA ORA XRA RAL RAR Load addressed accumulator.
Add addressed memory contents to accumulator. 0001 Subtract addressed memory contents from accumulator. Load accumulator data into output register. Stop processing. AND Accumulator register. OR Accumulator register. contents contents with with 0010 1110 1111 designated 1010 designated 0101 0100 1000 1001
ARCHITECTURE
1. Program Counter (PC) Implemented in pc.v file. It is part of the control unit and counts from 0000 to 1111 and it signals the memory address of next instruction to be fetched and executed. It is reset to 0000 before each computer run. When the computer runs, the program counter sends address to 0000 to the memory and it is incremented to get 0001. 2. Input and MAR (MAR) Implemented in inputMAR.v file Below the program counter is the input and MAR block. It includes the address and data switch registers. The MAR is part of the SAP-1 memory. During a computer run, the address in PC is latched into Memory Address Register (MAR). 3. RAM Implemented in mem16k.v file. The RAM is a 16 x 8 static TTL. The program code to be executed and data for SAP1 computer is stored here. During a computer run, the RAM receives 4-bit addresses from MAR and a read operation is performed. Hence, the instruction or data word stored in RAM is placed on the W bus for use by some other part of the computer. It is asynchronous RAM, which means that the output data is available as soon as valid address and control signal are applied.
4. Instruction Register (IR) Implemented in ir.v file It is part of the control unit. To fetch an instruction from the memory the computer does a memory read operation. This places the memory
address contents in the W bus. IR contains the instruction (composed of OPCODE+ADDRESS) to be executed by SAP1 computer. 5. Controller- Sequencer Implemented in cu.v file. This resets the program counter to 0000 and wipes out the last instruction in the instruction register. It generates the control signals for each block so that actions occur in desired sequence. CLK signal is used to synchronize the overall operation of the SAP1 computer. A 12 bit word comes out of the Controller-Sequencer block. This control word determines how the registers will react to the next positive CLK edge. The 12 wires carrying the control word are called the control bus. 6. Accumulator
Implemented in accumulator.v file. It is a 8 bit buffer register that stores intermediate results during a
computer run and has two outputs. The two-state output goes to the W bus. Therefore the 8 bit accumulator word continuously drives the adder- subtracter. The same word appears on the W bus when Ea is high.
When Su is low, the sum out of the adder-subtracter is S = A + B. When Su is high the difference appears: A = A+B
8. B Register
Implemented in register.v file. It is 8 bit buffer register which is primarily used to hold the other
operand (one operand
is always accumulator) of mathematical operations. The two-state output of the B register drives the adder-subtracter, supplying the number to be added or subtracted from the contents of the accumulator. 9. Output Register
INSTRUCTION SET
Programming a computer means loading the instructions step-by-step into the memory before the start of the computer run. Before you can program a computer , you must learn its instruction set.
LDA
It stands for load the accumulator. A complete LDA instruction includes the hexadecimal address of the data to be loaded.
ADD
ADD is another SAP-1 instruction. A complete ADD instruction includes the address of the word to be added. The addressed RAM word goes to the B Register and the addersubtracter output to the accumulator.
SUB
A complete SUB instruction includes the address of the word to be subtracted. The addressed RAM word goes to the B Register and the adder-subtracter output to the accumulator.
OUT
The instruction OUT tells the SAP-1 computer to transfer the accumulator contents to the output port. After OUT has been executed, we can see the answer to the problem being solved.
HLT
HLT stands for HALT. This instruction tells the computer to stop processing data. HLT marks the end of a program, similar to the way a period marks the end of a sentence. HLT is complete by itself.
ANA
ANA means to AND the accumulator contents with the designated register. The result is stored in the accumulator. Two ANA instructions are available in SAP-2: ANA B ad ANA C.
ORA
ORA is the mnemonic for OR the accumulator with the designated register. The two ORA instructions in SAP-2 are ORA B and ORA C.
XRA
XRA means xor the accumulator with the designated register. The SAP-2 instruction set contains XRA B and XRA C.
RAL
RAL is the mnemonic for rotate the accumulator left. This instruction will shift all bits to the left and move the MSB into the LSB position.
RAR
RAR stands for rotate the accumulator right. The bits shift to the right, the LSB going to the MSB position.
SAP 1 ARCHITECTURE
W BUS
CP CLK CLR
LA
8 8
EP
PROGRAM COUNTER
4 8
ACCUMULATOR
CLK EA
LM CLK
Input AND MAR
4 8
SU EU
CE LI CLK CLR EI
16x8 RAM
8 8
LB
B REGISTER
CLK
INSTRUCTION REGISTER
4 4
8 8
LO
OUTPUT REGISTER
CLK
CONTROLLER SEQUENCER
12
BINARY DISPLAY
CP EP LM CE LI EI LA EA
SU EU LB LO
CONCLUSION
We became familiar with the working of a 8-bit microprocessor and the way each module contributes to the overall functioning of the computer. Although the concept of SAP1 is very simple, the knowledge gained while designing it can be extended to design of more complex microprocessors.
REFERENCE
Albert Paul Malvino. Digital Computer Electronics An Introduction to Microcomputers: SAP-1(Page 140). Tata McGraw-Hill Publishing Company Limited 1990.