Code Monkey home page Code Monkey logo

risc-v_cpu's Introduction

CS61CPU - A 32-bit RISC-V CPU

This repository contains my work for the CS61C Fall 2022 Project 3, where I designed and implemented a 32-bit CPU based on the RISC-V instruction set architecture. This project was a hands-on opportunity to apply the concepts learned in CS61C, including computer architecture, digital logic design, and RISC-V assembly programming.

Project Overview

The CS61CPU is a single-cycle processor capable of executing a subset of the RISC-V instruction set. The design was implemented using Logisim, a graphical tool for designing and simulating digital logic circuits. This project was completed as part of the CS 61C course at the University of California, Berkeley.

For detailed project specifications and guidelines, visit the official project website.

Features

  • Arithmetic Logic Unit (ALU): Supports basic arithmetic and logical operations such as addition, subtraction, AND, OR, XOR, and shifts.
  • Register File: A set of 32 registers for storing intermediate computation results.
  • Immediate Generator: Generates immediate values from instructions for operations like addi.
  • Control Logic: Determines the operation of the ALU, the data flow, and the write-enable signals based on the current instruction.
  • Datapath: Integrates all components (ALU, Register File, Immediate Generator, Control Logic) to execute instructions.

Implementation Details

  • Part A: Basic CPU Design

    • Implemented ALU operations including add, sub, and, or, xor, sll, srl, and sra.
    • Designed a register file with read and write capabilities.
    • Created an immediate generator for addi instructions.
    • Assembled the datapath to execute the addi instruction.
  • Part B: Extended CPU Design

    • Extended the ALU and control logic to support additional RISC-V instructions such as load, store, branch, and jump instructions.
    • Implemented pipelining to improve instruction throughput.
    • Added support for handling hazards and implemented control logic for branch prediction.

Challenges and Learning Outcomes

  • Digital Logic Design: Gained hands-on experience with designing complex digital circuits.
  • RISC-V ISA: Deepened understanding of the RISC-V instruction set and its execution on hardware.
  • Computer Architecture Concepts: Applied concepts such as pipelining, hazard detection, and control logic in a practical project.

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.