Skip to content

Latest commit

Β 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

                          β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—        β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— 
                          β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—      β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
                          β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
                          β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β•šβ•β•β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—
                          β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•      β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•
                          β•šβ•β•  β•šβ•β•β•β•β•šβ•β•   β•šβ•β•   β•šβ•β•  β•šβ•β• β•šβ•β•β•β•β•β•        β•šβ•β•β•β•β• 

Nitro-8 Β Β·Β  Custom 8-bit CPU

Built With Language Architecture Display Instructions RAM ROM Storage Status License Made In


Nitro-8 is a fully functional 8-bit CPU designed and built entirely from scratch in Logisim Evolution β€” featuring a hardwired ALU, custom 16-instruction ISA, banked ROM, 256-byte RAM, a 16Γ—16 RGB pixel display, and a modular 20-unit sprite storage system.



Table of Contents


Overview

Nitro-8 is a custom 8-bit processor built entirely from logic gates up β€” no shortcuts, no black-box components. Every subsystem, from the half adder at the bottom of the ALU to the MUX-driven sprite storage at the top, was constructed and verified gate by gate inside Logisim Evolution.

The CPU can fetch, decode, and execute real assembly instructions, perform arithmetic and bitwise operations, read and write memory, and render pixel-art graphics on a live 16Γ—16 RGB display β€” all in a single integrated circuit.

Built as part of a Computer Architecture course at NFC IET Multan, this project demonstrates end-to-end understanding of digital logic, processor microarchitecture, memory systems, and low-level programming.


Features

Category Capability
ALU ADD, SUB, AND, OR, XOR, NOT, SHL, SHR β€” all 8-bit
Registers RegA, RegB β€” two general-purpose 8-bit registers
Program Counter 8-bit PC with increment, load, and synchronous reset
Instruction Register 16-bit IR with opcode / operand split
Control Unit Hardwired, decodes 16+ instructions into micro-signals
RAM 256 Γ— 8 read/write data memory
ROM 2048 Γ— 16 banked program memory with SETBANK switching
Video 16Γ—16 RGB display, XTerm256 8-bit color, direct pixel write
Storage 20 independent Sprite Unit ROMs, MUX-selected
Assembler Custom Python assembler β†’ Logisim ROM hex format
Control Flow JMP, JZ (conditional), HLT, NOP
Reset Full synchronous reset across all registers and memory

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         NITRO-8 CPU                             β”‚
β”‚                                                                 β”‚
β”‚   Clock ──► PC ──► ROM / Storage ──► IR ──► Control Unit       β”‚
β”‚                                                   β”‚             β”‚
β”‚                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚                              β–Ό                                  β”‚
β”‚                        RegA ──► ALU ◄── RegB                    β”‚
β”‚                              β”‚                                  β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
β”‚                    β–Ό                    β–Ό                       β”‚
β”‚             VideoRAM ──► RGB Display   RAM (data)               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Components Built from Scratch

  • Half Adder β†’ Full Adder β†’ 8-bit Ripple Carry Adder
  • 8-bit ALU (8 operations)
  • 8-bit D flip-flop Register Γ— 2
  • 8-bit Program Counter (inc / load / reset)
  • 16-bit Instruction Register (opcode + operand split)
  • Hardwired Control Unit (16 instructions)
  • RAM8 β€” 256Γ—8 synchronous read/write
  • ROM8 β€” 2048Γ—16 with bank switching
  • VideoRAM β€” direct pixel write to RGB Video component
  • Storage System β€” 20 Unit ROMs, 5-bit MUX selection

Live Simulation


Nitro-8 Live Simulation β€” CPU running sprite programs on the 16Γ—16 RGB display

Nitro-8 live simulation β€” the CPU fetching, decoding, and executing sprite programs, cycling through all 20 Storage Units and painting pixel art on the 16Γ—16 RGB display.



Circuit Overview

β‘  Β  Main CPU β€” Full Circuit

Nitro-8 β€” Full Main CPU Circuit in Logisim Evolution

Complete Nitro-8 CPU β€” ALU, registers, PC, ROM, RAM, control unit, and video display, all wired and running.


β‘‘ Β  Control Unit Β Β |Β Β  β‘’ Β  Storage System

Nitro-8 Hardwired Control Unit
Hardwired Control Unit decoding 16+ instructions into micro-control signals
Nitro-8 Storage System β€” 20 Sprite Units
20-Unit Sprite Storage System with MUX-based selection

β‘£ Β  ALU Β Β |Β Β  β‘€ Β  8-bit Register

Nitro-8 8-bit ALU
8-bit ALU performing arithmetic and logic operations
Nitro-8 8-bit Register
8-bit D flip-flop based register

β‘₯ Β  8-bit Adder Β Β |Β Β  ⑦ Β  RAM

Nitro-8 8-bit Ripple Carry Adder
8-bit Ripple Carry Adder built from full adder chains
Nitro-8 256-byte RAM
256Γ—8 synchronous RAM with read/write support

β‘§ Β  Program Counter Β Β |Β Β  ⑨ Β  Instruction Register

Nitro-8 Program Counter
8-bit Program Counter with increment, load, and synchronous reset
Nitro-8 16-bit Instruction Register
16-bit Instruction Register splitting opcode and operand

β‘© Β  RGB Display Output

Nitro-8 16Γ—16 RGB Display Output

16Γ—16 RGB pixel display rendering a sprite in XTerm256 8-bit color


Instruction Set

Opcode Mnemonic Operation
10nn LOAD_A n RegA ← n
11nn LOAD_B n RegB ← n
2000 ADD RegA ← RegA + RegB
2100 SUB RegA ← RegA βˆ’ RegB
2200 AND RegA ← RegA AND RegB
2300 OR RegA ← RegA OR RegB
30nn STORE n RAM[n] ← RegA
40nn JMP n PC ← n
50nn JZ n if RegA = 0 β†’ PC ← n
60nn VSTORE n VideoRAM[n] ← RegA (color)
6100 VSTORE_B VideoRAM[RegB] ← RegA
7000 INC RegA ← RegA + 1
7100 INC_B RegB ← RegB + 1
80nn LOAD_RAM n RegA ← RAM[n]
90nn SETBANK n ROM bank ← n
F000 HLT Halt execution
0000 NOP No operation

RGB Display

The Nitro-8 drives a 16Γ—16 pixel RGB display using Logisim Evolution's RGB Video component in XTerm256 8-bit color mode, giving 256 distinct colors addressable by a single byte.

Pixel addressing:

Address = (row βˆ’ 1) Γ— 16 + (col βˆ’ 1)
Row 1, Col 1 β†’ 0x00      Row 16, Col 16 β†’ 0xFF

Programs rendered on the display:

  • Alphabet letters β€” N, I, T, R, O, 8
  • Pixel-art sprites β€” heart, robot, rocket, car
  • Rainbow stripe fill
  • Checkerboard and border patterns
  • Diagonal X pattern

Storage System

The Storage subsystem contains 20 independent Unit ROMs. Each Unit holds one complete sprite or letter program. A 5-bit counter advances the active Unit via a MUX β€” when one program halts, the next Unit fires automatically.

Storage
β”œβ”€β”€ Unit 01  β€” Letter N
β”œβ”€β”€ Unit 02  β€” Letter I
β”œβ”€β”€ Unit 03  β€” Letter T
β”œβ”€β”€ Unit 04  β€” Letter R
β”œβ”€β”€ Unit 05  β€” Letter O
β”œβ”€β”€ Unit 06  β€” Letter 8
β”œβ”€β”€ Unit 07  β€” Sprite (expandable)
β”œβ”€β”€ ...
└── Unit 20  β€” (expandable)

Python Assembler

The project ships a Python assembler that compiles human-readable Nitro-8 assembly into the hex format expected by Logisim's ROM editor.

python assembler.py

Input β†’ Output example:

; Source
LOAD_A 05
LOAD_B 03
ADD
HLT
; ROM hex output
1005 0000 1103 0000 2000 0000 F000 0000
0000 0000 0000 0000 ...  (padded to 256 entries)

NOPs are automatically inserted between instructions to satisfy the CPU's fetch cycle, and output is zero-padded to 256 entries for direct paste into the Logisim ROM editor.


Demo Programs

5 + 3 = 8 Β (arithmetic)
LOAD_A 05
LOAD_B 03
ADD
HLT
Countdown 5 β†’ 0 Β (loop + branch)
LOAD_A 05
LOAD_B 01
SUB          ; RegA = RegA - 1
JZ   0B      ; if zero β†’ halt
JMP  02      ; else loop
HLT
Draw pink heart Β (VSTORE pixel painting)
LOAD_A D3    ; XTerm256 pink
VSTORE 34
VSTORE 35
VSTORE 37
VSTORE 38
; ... remaining pixel addresses
HLT

Build Order

The CPU was assembled incrementally, each layer verified before the next was added:

 1  Half Adder               11  RAM
 2  Full Adder               12  JMP + JZ instructions
 3  8-bit Ripple Carry Adder 13  RGB Video Display
 4  ALU                      14  VSTORE + VSTORE_B
 5  8-bit Register           15  INC + INC_B
 6  Program Counter          16  LOAD_RAM
 7  ROM                      17  SETBANK + bank switching
 8  Instruction Register     18  Storage system (20 Units)
 9  Control Unit             19  Python assembler
10  Main CPU integration

Tools Used

Tool Version Purpose
Logisim Evolution v4.1.0 Circuit design & simulation
Python 3.x Custom assembler
Git β€” Version control
GitHub β€” Hosting & CDN asset delivery

Project Structure

Nitro-8/
β”œβ”€β”€ CPU.circ                  ← Main Logisim circuit
β”œβ”€β”€ assembler.py              ← Python assembler
β”œβ”€β”€ README.md
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ demo/
β”‚   β”‚   └── demo1.gif         ← Live simulation recording
β”‚   └── screenshots/
β”‚       β”œβ”€β”€ main.png          ← Full CPU circuit
β”‚       β”œβ”€β”€ ControlUnit.png   ← Hardwired control unit
β”‚       β”œβ”€β”€ StorageUnit.png   ← 20-unit sprite storage
β”‚       └── Screen.png        ← RGB display output
└── programs/                 ← Assembly programs (coming soon)

Author


Noman Rafique (Nomi)

BS Artificial Intelligence Β Β·Β  NFC IET Multan, Pakistan Semester 2 Β Β·Β  GPA 4.0 / 4.0


GitHub LinkedIn



License

This project is open source and available under the MIT License.



Built with patience, logic gates, and a lot of debugging.  🧠



About

πŸ’»Nitro-8 β€” a fully functional 8-bit CPU built from scratch in Logisim Evolution, featuring a hardwired ALU, 16-instruction ISA, 256-byte RAM, banked ROM, 16Γ—16 RGB display, 20-unit sprite storage, and a custom Python assembler

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages