Softwired Controller
Softwired Controller
BASIC PROCESSOR-0
(Developed from 4-bit registers)
Instructions non-MRI – IN ; OUT ; MOV A,B ; MOV B,A ; INC ; DEC; CMP; HLT;
MRI - LDA adr ; STA adr ; ADD adr; JMP adr ; JZ adr;
(i)RAM – 16*4 bit, ROM - ; ALL registers of 4-bit size (6 clocks needed – 4 fetch clock and 2 for execution)
(ii) RAM – 256*4bit, ROM- ? , PC, TMP and MAR are 8-bit ,rest of 4-bit (8 clocks needed – 6 fetch clock and 2 for execution)
Instruction set
Memory reference instructions(MRI)-
direct and indirect -AND, OR,XOR,ADD, SUB,ADM,LDA, STA, BUN,BZ,BN (branch unconditional,branch zero, branch negative)
direct only-BSA (branch and save return address) , ISZ (increment memory and skip next instruction if memory becomes zero)
Instruction format
d15 d0
I OPCODE EA
1 4 11 ← bits
21 instructions – 11 instructions use address (11-bit) as direct or indirect mode to calculate effective address of operand. (instructions with I=0
or 1, the MSB)
2 instructions use direct address mode and remaining 8 instructions are not using 11-bit address.
(For non MRI , 11-bit address can be further decoded to support more non instruction. NOT INCLUDED). **
A special logic ckt is used to map (using d3-d0(opcode bits) to logic ckt. ) for 5 instructions (opcode > 11010 ) CAR[6]=1.
To decode/execute a instruction we need 4 micro instructions in general. Each micro instruction has at most three micro-operations and other
logic/address bits. Therefore 84 (21*4)rows are required in control ROM to store these micro instructions. we take 256 row ROM. The width of
each row is 22 bits.
Bits of each Field of micro instruction is connected to suitable size decoder. As only one micro-Control signal can be
activated by one decoder at a time . Multiple micro-control signals (micro-operations) required simultaneously in a
micro-instruction are placed in different field.
F1 micro operations F2 micro operations
Register transfer symbol Register transfer symbol
0000 NOP 000 NOP
0001 AC<- AC+MDR ADD 001 MAR<-MDR DRTAR
0010 AC<- AC-MDR SUB 010 MAR<-PC PCTAR
0011 AC<- AC | MDR OR 011 [MAR]<-MDR WRITE
0100 AC<- AC &MDR AND 100 MDR<-[MAR] READ
0101 AC<- AC+MDR XOR 101 MDR <-AC ACTDR
0110 AC<-complement COM 110 MDR<-MDR+1 INCDR
0111 AC<- shift left SHL 111 PC<-7FFh ,INTF=0 INTPC
1000 AC<- shift right SHR
1001 AC <-0 CLRAC
1010 AC<-AC+1 INCAC F3 micro operations
1011 AC<-MDR DRTAC Register transfer symbol
1100 Inr <-AC,R=0 IRTAC 00 NOP
1101 AC->outr,W=0 ACTOR 01 MDR <-PC PCTDR
1110 PC <-MAR ARTPC 10 PC<-PC+1 INCPC
1111 AR<-7FEh INTAR 11 Clock disabled HLT
The HLT signal deactivates the system clock . System can be reset by external reset button that sets the PC=00 and CAR(IR) to FC h (11111100).
(Same for Power on)
There are 8 flags taken into consideration. There status decide the condition/ flow of microcodes.
CD (condition)
bits condition flag meaning
000 Always 1 U Unconditional branch
001 DR(15) I Indirect opcode
010 AC(15) S Sign bit
011 AC=0 Z Zero value in AC
100 carry C Carry bit from add,sub operation
101 INF R Input port bit , set when new data arrives,reset when read by system
110 OUTF W output port bit , reset when new data written ,set when read by external device
111 INTF F h/w interrupt,current PC is stored at 7FEh , and PC is loaded with 7FFh, reset flag
Interrupt handling-
INTAR micro operation loads 7FEh TO MAR, INTPC loads 7FFh to PC, the address of interrupted programme is stored at 7FEh. Address of
ISR at 7FFh, (branching instruction , normally indirect branch instruction that is BUN xx)
Instruction IN works only if R=1 (read from input port)
Instruction OUT works only if W=1 (write to output port)
BR (branch)
bits
00 IF CD=1 (true) CAR<- AD JMP at AD
ELSE CAR<-CAR+1
01 IF CD=1(true) SBR<-CAR+1 ,CAR<- AD, CALL AD
ELSE CAR<-CAR+1
10 CAR<-SBR RET
11 CAR[5-2]=DR[14-11], CAR[7,6,1,0]=0 MAP* (decoding)
*For opcode > than 11010 , CAR bit 6 is set 1
@24 (BUN)
NOP NOP NOP I call indrct
ARTPC NOP NOP U JMP fetch
@84 Int @ 88
NOP NOP NOP Z JMP @86 NOP NOP PCTDR U JMP next
NOP NOP NOP U JMP fetch INTAR NOP NOP U JMP next
NOP NOP INCPC U JMP fetch NOP WRITE NOP U JMP next
NOP INTPC NOP U JMP @FD