Microprocessor Design: Simple As Possible-2
Microprocessor Design: Simple As Possible-2
Microprocessor Design: Simple As Possible-2
Microprocessor
Design
SAP-2 Registers
The subroutine counter can pitch bits for the program counter during two
components run. This occurs when a new instruction takes program control
away from the PC at given it to the SC.
It has 8-bits therefore it can count from 00H to FFH and has 256 memory
locations. A CLR signal resets the PC before each computer run.
It receives 8 bit address from the PC/SC which ever has program control
during fetch cycle also it receives an 8-bits address field from the IR during
an execution cycle.
SAP-2 Registers
Interface circuits convert signals from peripheral devices to binary signals suitable for entry
into a computer. A high LN load this word into the Input register and a high EN can read
the input word onto the W bus for transfer to the accumulator.
Accumulator
The two-state output goes directly to the arithmetic logic unit ALU. The three-state output
goes to the W bus. Therefore, the 12-bit accumulator word continuously drives the ALU;
the same word appears on the W bus when EA is high.
It has 4 select bits that determine the arithmetic and logic operation performed on words A
and B.
The select bits S3 through S0 cover 0000 through 1111, which can select 16 arithmetic and
logic functions. SAP-2 uses three arithmetic functions (NULL, ADD, SUB) and seven logic
functions (Complement A, Complement B, OR, AND, NOR, NAND, and XOR).
SAP-2 Registers
B Register
The high LB and positive clock edge load the word on the W bus into the
B register. The two- state output of the B register drives the ALU.
Index Register (X)
The index register has an increment input INX and a decrement input
DEX.
High INX means index register counts up; High DEX means it counts
down.
Output Register (O)
The output register connects to an interface circuit. The interface
circuit converts the contents of the output register into signals suitable
for driving the peripheral devices
SAP-2 Instruction Set
Memory Reference Instructions
8-bit address
CLK
Field
IR
EI
CON
High EI and LP
CLA
CLA means “clear the accumulator”.
The execution of a CLA resets all
accumulator bits to zero.
XCH
XCH is the mnemonic for “exchange
accumulator and index.”
During the execution of an XCH, the words
in the accumulator and index register are
interchanged.
DEX
DEX means “decrement the index
register.”
The execution of a DEX decreases the
contents of the index register by one.
INX
INX means “increment the index register.”
This instruction adds one to the index
register.
CMA
CMA stands for “complement the
accumulator.”
The execution of a CMA inverts each bit in
the accumulator, producing 1’s
complement.
CMB
CMB stands for “complement the B
register.”
This instruction inverts each bit in the B
register, resulting in the 1’s complement.
IOR
IOR means “inclusive OR,” identical to the
OR function. The execution of an IOR will
OR the corresponding bits in the
accumulator and B register, the result
appears in the accumulator.
AND, NOR, NAN, XOR perform bitwise
operation to the content of the
accumulator and B register.
BRB
BRB is the mnemonic for “branch back”.
The BRB is used at the end of each
subroutine to get back to the main
program. BRB is to a subroutine as HLT is
to the main program.
INP
INP means “input”. This instruction is
executed in two phases. The first
execution phase loads the input register
with a word from the interface circuit. The
second execution phase transfers this
word to the accumulator.
OUT
OUT stands for “output”. When the
instruction is executed, the accumulator
word is loaded into the output register.
Op-code and Select Code
1111 XXXX XXXX
Op code
Select code
Don’t cares
To program any operate instruction, start with four 1s, follow the
select code , and end with four don’t cares.
NOP = 1111 0000 XXXX
CLA = 1111 0001 XXXX
MRIs and jump instructions use an address field but operate
instructions don’t, because all the operands are already in the
working registers.
SAP-2 Programming
Create a
program a
program that
multiplies two
integers. Use 12
and 8 for this
example.
SAP-2 Programming