Git Product home page Git Product logo

angstrom-cpu's Introduction

angstrom-cpu

A 4-bit accumulator-based CPU designed to do the bare minimum and nothing more.

Architecture

This started out sounding like a good/fun idea, but I kind of failed on execution...I should have really just made a simplified 8-bit CPU.

Summary

  • 4-bit, accumulator-based, harvard architecture
  • 16-bit instruction; 12-bit addressing; 65536 byte ROM (16x4096)
  • 4-bit word size; 12-bit addressing; 16384 byte RAM (4x4096)
  • One general purpose 8-bit register, the accumulator

Instruction Set

Opcode Mnemonic Description Example
0000 (0) LDA Load accumulator low nibble with memory example
0001 (1) LDI Load immediate into accumulator example
0010 (2) STA Store accumulator low nibble to memory example
0011 (3) INP Load input into accumulator example
0100 (4) OUT Load accumulator into output example
0101 (5) BRC Branch on carry flag set example
0110 (6) BRZ Branch on zero flag set example
0111 (7) JMP Unconditional jump to address example
1000 (8) ADI Add immediate to accumulator example
1001 (9) ADD Add memory to accumulator example
1010 (A) SUB Subtract memory to accumulator example
1011 (B) AND Logical AND accumulator with memory example
1100 (C) ORR Logical OR accumulator with memory example
1101 (D) XOR Logical XOR accumulator with memory example
1110 (E) LSL Logical shift left accumulator example
1111 (F) LSR Logical shift right accumulator example

Registers

Register Size Description
PC 12-bit program counter
AC 8-bit accumulator
FL 2-bit flags register

Status Flags

Mask Flag Description
01 Z Zero
10 C Carry

Control Signals

Signal Name
CTRL_ALU Enable ALU output
CTRL_MW Memory write
CTRL_MR Memory read
CTRL_JMP jump
CTRL_INP Enable input
CTRL_OUT Enable output

Verilog Testbenches

example: make target MOD=alu

CPU with test ROM: make target MOD=cpu

This makefile compiles the target module with iverilog, simulates it with vvp, and opens the waveform in gtkwave.

Assembler

TODO: I hope to make a really simple assembler for this at some point in the future.

References

angstrom-cpu's People

Contributors

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