Skip to content

🚀 A general-purpose microprocessor design.

Notifications You must be signed in to change notification settings

saymow/microprocessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

General Microprocessor

     This accumulator microprocessor was built during the Computer Organization and Architecture from ICMC discipline and is completely based on what was taught on one compressed version of the Digital Logic and Microprocessor Design with VHDL - Enoch O Hwang book. Moreover, it was done for study purpose.


Specifications

  • 27 Instructions
  • 8 Registers (Besides the accumulator), each 8-bits wide
  • 32 bytes, each 8-bits wide, of program memory

Architecture


Instructions set

Data movement instructions

Instruction Encoding Operation Comment
LDA A,rrr 0001 0rrr A <= R[rrr] Load accumulator from register
STA rrr,A 0010 0rrr R[rrr] <= A Load register from accumulator
LDM A,aaaaaa 0011 0000
00 aaaaaa
A <= M[aaaaaa] Load accumulator from memory
STM aaaaaa,A 0100 0000
00 aaaaaa
M[aaaaaa] <= A Load memory from accumulator
LDI A,iiiiiiii 0100 0000
iiiiiiii
A <= iiiiiiii Load accumulator with intermediate value (iiiiiiii is a signed number)

Jump instructions

Instruction Encoding Operation Comment
JMP 0110 0000
00 aaaaaa
PC <= aaaaaa Absolute unconditional jump
JMPR 0110 smmm IF (smmm != 0) THEN
     IF (s == 0) THEN PC = PC + mmm
     ELSE PC = PC - mmm
Relative unconditional jump (smmm is a sign and magnitude format)
JZ 0111 0000
00 aaaaaa
IF (A == 0) THEN PC = aaaaaa Absolute jump if A is zero
JZR 0111 smmm IF (A == 0 and smmm != 0) THEN
     IF (s == 0) THEN PC = PC + mmm
     ELSE PC = PC - mmm
Relative jump if A is zero (smmm is a sign and magnitude format)
JNZ 1000 0000
00 aaaaaa
IF (A != 0) THEN PC = aaaaaa Absolute jump if A is not zero
JNZR 1000 smmm IF (A != 0 and smmm != 0) THEN
     IF (s == 0) THEN PC = PC + mmm
     ELSE PC = PC - mmm
Relative jump if A is not zero (smmm is a sign and magnitude format)
JP 1001 0000
00 aaaaaa
IF (A > 0) THEN PC = aaaaaa Absolute jump if A is positive
JPR 1000 smmm IF (A > 0 and smmm != 0) THEN
     IF (s == 0) THEN PC = PC + mmm
     ELSE PC = PC - mmm
Relative jump if A is positive (smmm is a sign and magnitude format)

Arithmetic and logical instructions

Instruction Encoding Operation Comment
AND A,rrr 1010 0rrr A <= A AND R[rrr] Accumulator and register
OR A,rrr 1011 0rrr A <= A OR R[rrr] Accumulator or register
ADD A,rrr 1100 0rrr A <= A + R[rrr] Accumulator + register
SUB A,rrr 1101 0rrr A <= A - R[rrr] Accumulator - register
NOT A 1110 0000 A <= NOT A Inverts the accumulator
INC A 1110 0001 A <= A + 1 Increments the accumulator
DEC A 1110 0010 A <= A - 1 Decrements the accumulator
SHFL A 1110 0011 A <= A << 1 Shifts the accumulator left
SHFR A 1110 0100 A <= A >> 1 Shifts the accumulator right
ROTR A 1110 0101 A <= RotateRight(A) Rotates the accumulator right

Input / Output and Miscellaneous

Instruction Encoding Operation Comment
IN A 1111 0000 A <= input Input to accumulator
OUT A 1111 0001 output <= A Output from accumulator
HALT 1111 0010 Halt Halt execution
NOP 0000 0000 No operation No operation

About

🚀 A general-purpose microprocessor design.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published