Git Product home page Git Product logo

bbcpu's Introduction

BBSoftCPU

A Verilog HDL implementation of a breadboard TTL CPU design. The design itself is based on the series of educational videos by Ben Eater.

Testing can be done on the Lattice iCE40 family of FPGAs. The specific board used during development is:

This particular family of FPGAs is currently supported by a fully open source toolchain. For anyone interested further information is available at:

There are several notable modifications from the original design:

  • There is no internal bus or tri-state logic. The latter is rarely if ever supported internally on current FPGAs. Muxers are used as a replacement.
  • The ALU doesn't have sequantial logic.
  • Registers A, B are part of the main CPU module.
  • The control logic is not triggered by the negative clock edge. The positive clock edge is used throughout.
  • The 'OUT' instruction doesn't output to any display HW. The FPGA board used for testing does have an extra UART port. The instruction will transmit the value of register 'A' on the second port.

Build environment

Ubuntu 16.04 or newer. The toolchain and verilog simulator can be installed via:

sudo apt-get install build-essential arachne-pnr iverilog

You could also install GtkWave for viewing the simulation waveforms:

sudo apt-get install gtkwave

And minicom for receiving the output:

sudo apt-get install minicom

Running the simulator test bench

The simulator can be invoked via:

make

The output should be a 'top_test_fibonacci.vcd' file that can be viewed using GtkWave:

gtkwave top_test_fibonacci.vcd

USB permissions for the FPGA board

Before flashing the FPGA board, the USB access permissions need a minor adjustment that will allow the tools to write a bitstream on the device. Create a new file at:

/etc/udev/rules.d/53-lattice-ftdi.rules

Add this line inside:

ACTION=="add", ATTR{idVendor}=="0403", ATTR{idProduct}=="6010", MODE:="666"

Flashing

Make sure that the icestick board is connected to the host PC. Flashing the bitstream on the FPGA can be done by invoking:

make flash

Receiving output

The default program will currently calculate the fibonacci sequence of numbers. As mentioned before the 'OUT' instruction will transmit the register 'A' contents on the second UART port. The serial device will usually appear on the host as '/dev/ttyUSB1'. The configuration used right now is:

  • baudrate: 19000
  • bits: 8
  • parity: none
  • stop bits: 2
  • no hw flow control

The data comes in as binary so for nicer output you can instruct minicom to display in hex mode:

minicom -H

This is not an official Google product

bbcpu's People

Contributors

epeevs avatar

Stargazers

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

Watchers

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