Giter VIP home page Giter VIP logo

projectcpu's Introduction

Instruction set completion project for a CPU with below features.

16-bit Instruction Word (IW) of ProjectCPU:

                                IW 
                |----------------------------------|
 bit position   |15    13 | 12                    0| 
                |----------------------------------|
 field name     | opcode |           A             | 
                |----------------------------------|
 bit width      |   3b   |          13b            | 
                |----------------------------------|

(Every memory location and W are 16 bits)

Instruction Set of ProjectCPU:

ADD ->

 unsigned Add
     opcode = 0
     W = W + (*A)
     write(readFromAddress(A) +W) to W
     *A = value (content of) address A = mem[A] (mem means memory)
     = means write (assign)

NOR ->

 bitwise NOR
     opcode = 1                  
     W = ~(W | (*A))             

SRRL ->

 Shift Rotate Right or Left
     opcode = 2
     if((*A) is less than 16) W = W >> (*A)   
	 else if((*A) is between 16 and 31) W = W << lower4bits(*A)
	 else if((*A) is between 32 and 47) W = RotateRight W by lower4bits(*A)
	 else W = RotateLeft W by lower4bits(*A)

GT ->

 Unsigned Greater Than
     opcode = 3
     W = W > (*A)            

SZ ->

 Skip on Zero
     opcode = 4
     PC = ((*A) == 0) ? (PC+2) : (PC+1)

CP2W ->

 Copy to W
     opcode = 5
     W = *A           

CPfW ->

 Copy from W    CPfW 0         
     opcode = 6                     
     *A = W

JMP ->

 Jump
     opcode = 7
     PC = lower13bits(*A)

INDIRECT ADRESSING

There are no special instructions for indirect addressing. Instead, every instruction can operate in indirect addressing mode.

That is, if A==0, replace *A above with **2.

Every program starts like this:

0: JMP 1
1: 3
2: // indirection register
3: // program actually starts here

projectcpu's People

Contributors

saydemr 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.