Skip to content
/ bbmips Public

Simple processor implementation with assembler and disassembler.

Notifications You must be signed in to change notification settings

i1i1/bbmips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

I wanted to make a simple processor in verilog and build some environment around it. It is very much similar to MIPS, but lacks many of its features(that’s why it is called “BBMIPS”). Here is ISA of it.

ISA

Register naming

64 registers total

zero - Register that always contains 0 (Read only!) [0]

at - Assembler temporary register, avoid using! [1]

v0-v3 - Return value registers [2, 5]

a0-a7 - Argument registers [6, 13]

t0-t23 - Temporary registers [14, 37]

s0-s22 - Saved registers [38, 61]

ra - Return address register [61]

sp - Stack pointer [62]

pc - program counter (Read only!) [63]

Instruction types

Register type

op (4)r0 (6)r1 (6)r2 (6)func (10)

Immediate

op (4)r0 (6)r1 (6)n(16)

Instructions

instructiontypeopfuncDescription
jie r0, r1, r2reg00Jumps to r0 if r1 == r2
jil r0, r1, r2reg01Jumps to r0 if r1 < r2
jier r0, r1, r2reg02Jumps to PC+r0 if r1 == r2
jilr r0, r1, r2reg03Jumps to PC+r0 if r1 < r2
or r0, r1, r2reg04r0 = r1 | r2
and r0, r1, r2reg05r0 = r1 & r2
xor r0, r1, r2reg06r0 = r1 ^ r2
nor r0, r1, r2reg07r0 = ~(r1 | r2)
sub r0, r1, r2reg08r0 = r1 - r2
add r0, r1, r2reg09r0 = r1 + r2
mul r0, r1, r2reg010r0 = r1 * r2
div r0, r1, r2reg011r0 = r1 / r2
mod r0, r1, r2reg012r0 = r1 % r2
sll r0, r1, r2reg013r0 = r1 << r2
sla r0, r1, r2reg014r0 = r1 <<< r2
srl r0, r1, r2reg015r0 = r1 >> r2
sra r0, r1, r2reg016r0 = r1 >>> r2
addi r0, r1, nimm1-r0 = r1 + n
addiu r0, r1, nimm2-r0 = r1 + n
lb r0, n(r1)imm3-load byte to r0 from r1 + n
lbu r0, n(r1)imm4-load ubyte to r0 from r1 + n
lh r0, n(r1)imm5-load half to r0 from r1 + n
lhu r0, n(r1)imm6-load uhalf to r0 from r1 + n
lw r0, n(r1)imm7-load word to r0 from r1 + n
stb r0, n(r1)imm8-store byte from r0 at r1 + n
sth r0, n(r1)imm9-store half from r0 at r1 + n
stw r0, n(r1)imm10-store word from r0 at r1 + n
syscall n, r0, r1imm11-syscall n, r0 is arg, r1 is res

Syscalls

syscallDescription
0exit with r0 as exit code
1read integer into r0
2write integer r0
3write ascii character from r0[7:0]

Other environment and project

Here you can find some tools for BBMIPS.

  • Assembler in bbas directory
  • Disassembler in disas directory
  • Processor implementation in verilog in proc directory
  • Some test programs in test directory

Just run and test it.

$ make test

About

Simple processor implementation with assembler and disassembler.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages