This is project belongs to a task of my cs courses.
At first, I want to say the basic idea of this project design comes from the github project as follows:
jmahler/mips-cpu: https://github.com/jmahler/mips-cpu
with the basis of jmahler's project, I implemented a mips pipeline cpu with more functions and more supported instructions.
(Although I think it would have been better for me and jmahler to create more modules rather than smashing the top design file with hundreds of lines of codes...)
supported mips instructions:
-
addiu $rt, $rs, imme: unsigned addition immediate number
-
addi $rt, $rs, imme: addition with immediate number
-
add $rd, $rs, $rt: normal addition
-
sub $rd, $rs, $rt: normal subtraction
-
andi $rt, $rs, imme: bit operation and with immediate number
-
ori $rt, $rs, imme: bit operation or with immediate number
-
and $rd, $rs, $rt: normal bit operation and
-
or $rd, $rs, $rt: normal bit operation or
-
sll $rd, $rt, sa: shift left logical
-
slti $rt, $rs, imme: set less than with immediate number
-
slt $rd, $rs, $rt: set less than
-
sw $rt, imme($rs): store word to main memory
-
lw $rt, imme($rs): load word from main memory to register group
-
lhu $rt, imme($rs): load half word from main memory to register group, with higher 16 bits filled with zero
-
movn $rd, $rs, $rt: if rt value is not zero, move the value of rs to rd, else do nothing
-
beq $rt, $rs, imme: if rt equals to rs then branch
-
bne $rt, $rs, imme: if rt not equals to rs then branch
-
bltz $rs, imme: if the rs value is less than zero, then branch
-
j addr: jump to addr
-
jal addr: jump to addr and set register $31 with current pc + 4
-
jr $rs: jump to the address referred by the value of rs
-
halt: as its name, an instruction stop the cpu from normally executing.