Coder Social home page Coder Social logo

howardlau1999 / yatcpu Goto Github PK

View Code? Open in Web Editor NEW
80.0 3.0 12.0 549 KB

Yet another toy CPU.

License: Apache License 2.0

Scala 50.33% Tcl 24.40% Makefile 1.00% C 13.57% Assembly 0.97% PowerShell 0.04% Verilog 2.40% C++ 1.32% CMake 0.62% Shell 0.02% Batchfile 0.02% Python 5.05% Dockerfile 0.24%
risc-v riscv chisel3 chisel-generator cpu

yatcpu's Introduction

YatCPU

简体中文 | English

YatCPU(Yet another toy CPU) is a simple three-stage pipeline RISC-V implementation written in Chisel 3 HDL with support for AXI4-Lite, featuring its painless hands-on experience and VGA output for fun.

You can play Tetris on your own CPU!

tetris-demo

You can also run an NES emulator!

litenes-demo

Heavily inspired by tinyriscv, this project is still in its very early stage and under active development. We are looking forward to your feedback and contributions!

Development Plans

  • L1 I-cache and D-cache
  • Branch predictor
  • Run Yat-sen OS RISC-V
  • RV32M
  • Pass RISC-V compliance test
  • Run CoreMark benchmarks

Prerequisites

You

  • Basic knowledge of digital logic and design principles
  • Basic knowledge of C/C++
  • (Optional) A FPGA development board

Your computer

  • Windows 10 or higher / Linux (Debian, Ubuntu, WSL1/2 or other distros) / macOS
    • We have tested on Windows 10 and WSL Debian 11
    • macOS is able to run the software simulation, but unable to write FPGA boards
  • Java 8 or higher
  • Scala 2.13.8 (not 3)
  • sbt
  • (Optional) Latest Verilator
  • (Optional) Vivado 2020.1 or higher

Getting Started

Please refer to YatCPU Docs for more documentation.

yatcpu's People

Contributors

actions-user avatar howardlau1999 avatar hrpccs avatar onewaylab avatar tiger9tu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yatcpu's Issues

Schedule processes when the hardware timer ticks

The very first step towards a working minimal operating system is the ability to do some initialization work after booting up and handle interrupts where it can have a chance to schedule and switch processes.

To achieve this, we should

  • Write the entry function which does all the initialization work including initializing necessary data structures and setting up interrupt handler
  • Define a minimal structure of PCB(Process Control Block)
  • Implement the context switch function
  • Implement a very basic scheduler
  • Call the scheduler and switch to target process when the hardware timer ticks

调整 src 目录下的代码结构

考虑到以后可能会移植到 basys3 之外不同的板子上,是不是把 CPU 本身的代码和到特定板子的移植代码分离比较好,比如再建一个 /src/fpga 目录

Implement register renaming

Register renaming is a common feature among modern processors; it can improve throughput by reducing structure hazards.

We need to keep track of the status of physical registers and assign free registers to logical registers when needed.

Load the executable from Flash

It is painful and time-wasting each time we want to load a different executable because we need to go through the whole process of synthesis and implementation again and again.

Sometimes the only difference is the executable itself, so it would be time-saving if we could load the program from a programmable Flash such as the onboard QSPI Flash.

Write a minimal shell

After we implement a minimal process scheduling mechanism in #13 , we can write a minimal shell which reads and parses user input from UART and performs the corresponding operations.

Support integer multiplication and division

This feature involves designing a pipeline co-processor to perform integer multiplication and division. The co-processor may stall the pipeline during the calculation and write back the result to destination register.

Implement L1 caches

The processor is now fetching instructions and doing memory operations via a shared bus. It can be seen that the pipeline is mostly stalled due to slow bus operations. Modern processors offer caches to fill the gap between the core and the bus.

Although we have a von-Neumann architecture CPU, L1 caches are usually split into I-cache(I$) and D-cache(D$) for instructions and data respectively.

These caches are commonly set-associative and implemented as SRAMs. The caches should keep record of cache line status and request bus for memory operations if needed.

Weekly Catch-up #1

The developers will keep you posted by summarizing the progress made in the past week.

调整 src 目录下的代码结构

考虑到以后可能会移植到 basys3 之外不同的板子上,是不是把 CPU 本身的代码和到特定板子的移植代码分离比较好,比如再建一个 /src/fpga 目录

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.