GithubHelp home page GithubHelp logo

bbmips's Introduction

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

bbmips's People

Contributors

i1i1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.