CPUProject
From ATI public wiki
Revision as of 18:51, 4 December 2014 by Siavoosh (Talk) (Created page with "CPU project is one of the projects designed in department of computer engineering at TTU as a lab project. The main aims of this project are: * Developing a generic CPU witho...")
CPU project is one of the projects designed in department of computer engineering at TTU as a lab project. The main aims of this project are:
- Developing a generic CPU without any fancy feature
- Writing a compiler for it
- Compiling GCC for this architecture
- Booting a light linux on it
Contents
CPU Design
Functionality Requirements
The CPU is supposed to be able to perform the following operations:
- Addition/Subtraction
- Increment/Decrement
- Arithmetic and Logical Shift
- Bitwise AND, OR, XOR and NOT
- Negation
- Load/Store
- Unconditional Branch (jump)
- Branch if zero / Branch if Overflow / Branch if Carry
- Clear Registers/Flags
- PUSH / POP
- NOP/HALT
Instruction Set Architecture (ISA)
The following instrcutions designed for the CPU:
Instruction | Description | OpCode | DPU Command | Data To DPU | MemAddress | Next PC |
---|---|---|---|---|---|---|
Add_A_B | A <-- A + B | Example | Example | Example | Example | Example |
Add_A_Mem | Example | Example | Example | Example | Example | Example |
Add_A_Dir | Example | Example | Example | Example | Example | Example |
Sub_A_B | Example | Example | Example | Example | Example | Example |
Sub_A_Mem | Example | Example | Example | Example | Example | Example |
Sub_A_Dir | Example | Example | Example | Example | Example | Example |
IncA | Example | Example | Example | Example | Example | Example |
DecA | Example | Example | Example | Example | Example | Example |
And_A_B | Example | Example | Example | Example | Example | Example |
OR_A_B | Example | Example | Example | Example | Example | Example |
XOR_A_B | Example | Example | Example | Example | Example | Example |
FlipA | Example | Example | Example | Example | Example | Example |
NegA | Example | Example | Example | Example | Example | Example |
Jmp | Example | Example | Example | Example | Example | Example |
JmpZ | Example | Example | Example | Example | Example | Example |
JmpOV | Example | Example | Example | Example | Example | Example |
Jmp_rel | Example | Example | Example | Example | Example | Example |
JMPEQ | Example | Example | Example | Example | Example | Example |
ClearZ | Example | Example | Example | Example | Example | Example |
ClearOV | Example | Example | Example | Example | Example | Example |
LoadPC | Example | Example | Example | Example | Example | Example |
SavePC | Example | Example | Example | Example | Example | Example |
ShiftArithR | Example | Example | Example | Example | Example | Example |
ShiftArithL | Example | Example | Example | Example | Example | Example |
ShiftA_R | Example | Example | Example | Example | Example | Example |
ShiftA_L | Example | Example | Example | Example | Example | Example |
Load_A_Mem | Example | Example | Example | Example | Example | Example |
Store_A_Mem | Example | Example | Example | Example | Example | Example |
Load_B_Dir | Example | Example | Example | Example | Example | Example |
Load_B_Mem | Example | Example | Example | Example | Example | Example |
JmpC | Example | Example | Example | Example | Example | Example |
ClearC | Example | Example | Example | Example | Example | Example |
ClearACC | Example | Example | Example | Example | Example | Example |
RRC | Example | Example | Example | Example | Example | Example |
PUSH | Example | Example | Example | Example | Example | Example |
POP | Example | Example | Example | Example | Example | Example |
RLC | Example | Example | Example | Example | Example | Example |
NOP | Example | Example | Example | Example | Example | Example |
HALT | Example | Example | Example | Example | Example | Example |
Other instructions implementation
the follwoing instructions can be also implemented with the ones in IS:
- Call "function_name":
PUSH SavePC Push Jmp "function address" POP
- Return:
POP Add_A_Dir 4 LoadPC