To model and implemented a CPU(Central Processing Unit) inside an FPGA, the CPU should be able to perform the task that of a normal CPU. The main processes are instruction fetch, instruction decode, memory read, execute and memory write back.
Hence,CPU’s main function is to Fetch instructions, decode them and execute the given instruction set. Instruction set is based on MIPS.
Instruction set:
Instruction
Function
Encoding
op
funct
add r1,r2,r3
addition: r1 <- r2 + r3
Register
000000
100000
sub r1,r2,r3
subtraction: r1 <- r2 – r3
Register
000000
100010
mult r1,r2,r3
multiply: r1 <- r2 * r3
Register
000000
100100
div r1,r2,r3
division: r1 <- r2 / r3
Register
000000
100101
and r1,r2,r3
bitwise and: r1 <- r2 and r3
Register
000000
101000
or r1,r2,r3
bitwise or: r1 <- r2 or r3
Register
000000
101001
slt r1,r2,r3
set less than: r1 <- 1 if r2 < r3, r1 <- 0 otherwise