Skip to content

kyriosaa/sap-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAP-1 8-bit Breadboard Computer

Computer Architecture Digital Logic Assembly

SAP-1 (Simple As Possible - 1) is a fully functional 8-bit computer built entirely from scratch using basic logic chips and breadboards. My version is based on Ben Eater's design with power distribution changes along with IC placement and wiring differences.

The computer works without any code and can be manually programmed by using DIP switches. Arduino code is used to program EEPROM lookup tables so numbers can be displayed properly. More complex programs such as multiplication or sequencing are written in Assembly and manually entered via DIP switches.

🎥 Demo video // Countdown // Powers of 2 // Multiples of 3 🎥

I've made a PCB version of this project with some design changes, you can check it out at my SAP-1 Mk2 Repository.

Sections
Core Components
Instruction Set
Operation Cycle
Programming
Images

Core Components

CPU Architecture

  • A Register (Accumulator) – The main register that stores data for math operations.
  • B Register – The secondary register to hold the second operand for ALU operations.
  • Instruction Register – Stores the current instruction being executed.
  • Memory Address Register (MAR) – Holds the specific memory address being accessed in RAM.
  • Arithmetic Logic Unit (ALU) – Does the addition and subtraction.
  • Flags Register – Checks for overflow or underflow values.
  • Program Counter – Keeps track of which instruction to execute next.
  • EEPROM Programmer – For CPU microcode & display programming.

Memory & I/O

  • 16-byte RAM – Stores both the program instructions and data.
  • 4-bit Address – Can access 16 memory locations (can store either instructions or data).
  • 7-Segment Display – Decimal display for output.
  • Clock Control – Includes a potentiometer for controlling clock speed, along with the option to set the clock to automatic or manual.
  • Reset Button – Includes a button to reset the computer and rerun any loaded programs.
  • Control Switches – Includes DIP switches and buttons for manual programming.

Instruction Set

I've programmed a complete instruction set in the CPU microcode

0000    NOP - No operation
0001    LDA - Load from memory to A register
0010    ADD - Add memory to A register
0011    SUB - Subtract memory from A register
0100    STA - Store A register to memory
0101    LDI - Load immediate value to A register
0110    JMP - Jump to address
0111    JC  - Jump if carry (overflow)
1000    JZ  - Jump if zero  (underflow)
1110    OUT - Output A register to display
1111    HLT - Halt computer

For info on how to input the assembly program, look at Programming

Operation Cycle

  1. Fetch - The program counter addresses memory, then instruction is loaded into the instruction register
  2. Decode - Control logic interprets the opcode to figure out which operation to perform
  3. Execute - The control signals are activated to do the instruction
  4. Increment - If there's no jump, the program counter advances to the next instruction

Programming

SAP-1 Programs

  • Programs (like multiplication, powers of 2, etc.) are written in Assembly and manually entered via DIP switches into the RAM
Manual Programming Instructions

1. Switch to the memory address you want to program the instruction on
2. Input the instruction opcode (first 4 bits) and the operand/target address (last 4 bits)
3. For data storage locations, just input the 8-bit binary value directly

Examples: 
Load number from address 15: 0001 1111
Output:                      1110 0000
Jump to address 3:           0110 0011
Data storage (123):          0111 1011

Display Setup

Example Programs

Images

Project overview

Control word

EEPROM

EEPROM programmer

Other photos

About

A Turing-complete 8-bit computer built entirely on breadboards using discrete logic chips

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Contributors