Code Monkey home page Code Monkey logo

simple-processor's Introduction

Simple Processor

A simple, multicycle processor with 4 instructions. Can be implemented in Basys3 FPGA with button a debouncer and a simple display. The processor processes 4-bit data in a 8x4 register file, and a 16x4 data memory. Data memory and the register file are initialized with the following data:

Data Memory := {4'hf, 4'he, 4'hd, 4'hc,
                4'hb, 4'ha, 4'h9, 4'h8,
                4'h7, 4'h6, 4'h5, 4'h4,
                4'h3, 4'h2, 4'h1, 4'h0} // D[i] = i, for i ranging from 0 to 15, where i is a 4-bit number

Register File := {8{4'h0}} // all zeros

Instruction Set

Instructions used in the processor are 12 bits. The first three bits represent the instruction and may be called as op.

Load

000-XX-R2R1R0-D3D2D1D0

  • A load instruction's op value is 000. Next two bits are don't cares. R2:0 bits represent the write address of the register file, and D3:0 bits represent the data memory address. The value DM[D] is written into RF[R].

Store

001-XX-R2R1R0-D3D2D1D0

  • A store instruction's op value is 001. Next two bits are don't cares. R2:0 bits represent the read address of the register file, and D3:0 bits represent the data memory address. The value RF[R] is written into DM[D].

Add

101-W2W1W0-B2B1B0-A2A1A0

  • An add instruction's op value is 101. W2:0 represents the write address of the register file, A2:0 and B2:0, represents the first and second read address port of the register file, respectively. The value RF[A] + RF[B] is written into RF[W].

Subtract

110-W2W1W0-B2B1B0-A2A1A0

  • A substract instruction's op value is 110. W2:0 represents the write address of the register file, A2:0 and B2:0, represents the first and second read address port of the register file, respectively. The value RF[A] - RF[B] is written into RF[W].

Display

When an instruction is executed, important data is displayed in the sevent segment display. What is displayed differs in different instructions.

Load & Store

The 4-bit data being read/stored is shown in the display. For instance, if the instruction reads 4 from the data memory and writes it back to the register file, the display would show:

00-4

Add & Sub

The 4-bit data being added and substracted, and the result of the summation/substraction is shown in the display. For instance, if the add instruction reads 5 and 7 from the register file and writes it back to any place in the register file, the display would show:

57-C

Push Buttons

  • Center
    • Resets the program counter and clears the display. The contents of the memory and register file does not change.
  • Left
    • Executes the next instruction in the instruction memory.
  • Right
    • Executes the instruction in the switches, located in switches SW11 to SW0.

Design

HLSM Diagram

HLSM diagram

Reduced FSM Diagram

Controller FSM

Block Diagrams

The processor is connected to 2 button debouncers and the sevent segment display: Top Module

The processor is composed of two modules, datapath and controller. They are connected to each other like the following:

Processor

The datapath

Datapath

The controller

Controller

Please read more in the project report for the contents of the ROMs.

simple-processor's People

Contributors

zubeyir-bodur 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.