Pixel Brush Processing Unit

Related tags

Image ProcessingPBPU
Overview

Pixel Brush Processing Unit

The Pixel Brush Processing Unit (PBPU for short) is a simple 4-Bit CPU I designed in Logisim while I was still in school and had nothing better to do during Class.

It's instruction set is thus extremely primitive.

Instruction Set

Mnemonic Inputs Name Description Added with Revision
NOP - No Operation No operation is executed Mk.1
ADD - Add X and Y are added, the result is written to Z Mk.1
SUB - Subtract X and Y are subtracted, the result is written to Z Mk.1
WT1 0-15 Write to Loc11 The given value is written to the upper 4 Bits of the Location Register Mk.1
WT2 0-15 Write to Loc22 The given value is written to the lower 4 Bits of the Location Registern Register Mk.1
WTX 0-15 Write to X The given value is written to the X Register Mk.1
WTY 0-15 Write to Y The given value is written to the Y Register Mk.1
WTZ 0-15 Write to Z The given value is written to the Z Register Mk.1
ZTR - Write Z to RAM The contents of Z are put into the current RAM Location Mk.1
RTZ - Read from RAM to Z The contents of the selected RAM Location are put into the Z Register Mk.1 (Revised in Mk.2)
PC1 0-15 Write to PC13 The given value is written to the upper 4 Bits of the PC4 Register Mk.2
PC2 0-15 Write to PC25 The given value is written to the lower 4 Bits of the PC4 Register Mk.2
JMP - Jump to PC4 Transfers the Contents of the PC4 Register into the actual Program Counter, as long as the Z Register is 0 Mk.2
RTX - Read from RAM to X The contents of the selected RAM Location are put into the X Register Mk.3
RTY - Read from RAM to Y The contents of the selected RAM Location are put into the Y Register Mk.3
USC - Use Carry Toggles the usage of the Carry Bit for the next Arithmetic Operation Mk.3 (Revised in Mk.4)

Assembler

I recently made a custom Assembler in Python for the PBPU Mk.4 according to this Instruction Set.

PBPU Assembler (Tested with Python 3.8)

Simply put your .asm file in as a Command-Line Argument and it should spit out an Assembled .bin file.

Syntax Highlighting for Notepad++

Just seems useful to have when Programming

Examples

There's also a fully commented Program which puts a Smiley on the Mark 2's PPU Screen.

Mark 2 Smiley Program

PBPU Smiley (Assembly)

PBPU Smiley (Binary)

Link to a Video Showcasing this Program on the Mark 2

Addition Program

PBPU Add (Assembly)

PBPU Add (Binary)

Important to remember when Programming

  • You only have 256 Bytes of ROM, so your Program can't be bigger than that without a cheaty workaround
  • Only 256 4-Bit Bytes of RAM (4 of which are reserved for the 4x4 Screen Matrix)
  • Only 4-Bit Math
  • No Input whatsoever (Unless one of the RAM Locations is used for it in some cheaty workaround way)

History

Original Goal

The original Goal was to design a simple, yet functional 4-Bit CPU that could execute simple Programs.

The PBPU had 3 iterations initially: The Mark 1, 2 and 3.

Pre-Mark 1 (3rd of May, 2021)

The first designs of the PBPU already contained the primary 4-Bit registers, X, Y and Z, alongside the Location Register. The 256 Bytes of RAM were also already being considered at this stage.

Mark 1 (3rd of May, 2021)

The Mark 1 was the first functional iteration of the CPU, only boasting the first 9 Instructions. It could only really perform Mathmatical operations and save these to RAM.

Mark 2 (4th of May, 2021)

The Mark 2 expanded on the Mark 1's instruction set, extending it by 4 additional Instructions, meant to add Jumps and Conditionals to aid in the CPU being Turing Complete. However, it unfortunatley failed due to the JMP Command being rather buggy, not even properly checking the Status of the Z Register.

It also saw the introduction of the PBPU's Picture Processing Unit (PPU for short), a simple 4x4 LED Matrix that displayed 4 Bits as a single row of Pixels. Link to a Video Showcasing the Mk.2

Mark 3 (6th of May, 2021)

The last Iteration of the PBPU, the Mark 3, introduced the final 16 instructions, allowing to more easily load values into Registers for more complex operations.

The PPU was also expanded to use an 8x8 Grid, this was however scrapped due to it being too difficult to effectively write to.

Talks of a proper I/O interface came along but these never came to be.

Mark 4 (10th of November, 2021)

The Mark 4 is the latest Revision of the PBPU, meant to finally have it work exactly as intended.

It's still in the early stages of re-learning how a lot of the circuits in the old designs worked, especially due to the switch from Logisim Classic to Logisim Evolution. I also no longer have access to the old Logisim Files, which makes this increasingly difficult.

Update (11th of November, 2021)

The Mark 4 appears to be functional, now supporting all originally inteded features! pbpuMk4Logisim.png It's messy, yes, but that can be worked out in the Mark 5. It also no longer relies on a messy self-built decoder, allowing for each Clock Cycle to run one instruction.

The only currently known "bug" is the need for a NOP at the start of ROM, since the 1st Cylce Instruction is never loaded and executed.

Here's a Diagram to detail how it works pbpumk4.svg

And one that shows how this translates to the Mark 4 pbpumk4.svg

Old Datasheet

This is the Datasheet where I hand-compiled my Programs and came up with all the Instructions (Old) PBPU Datasheet

To-do

  • Refine Assembler to accept relative jumps and calculate offsets
  • Macros to more easily jump

Footnotes

  1. RAM Location 1 (upper 4 bits)

  2. RAM Location 2 (lower 4 bits)

  3. Program Counter 1 (lower 4 bits)

  4. Program Counter 2 3 4

  5. Program Counter 2 (upper 4 bits)

You might also like...
starfish is a Python library for processing images of image-based spatial transcriptomics.
starfish is a Python library for processing images of image-based spatial transcriptomics.

starfish: scalable pipelines for image-based transcriptomics starfish is a Python library for processing images of image-based spatial transcriptomics

GPU-accelerated image processing using cupy and CUDA
GPU-accelerated image processing using cupy and CUDA

napari-cupy-image-processing GPU-accelerated image processing using cupy and CUDA This napari plugin was generated with Cookiecutter using with @napar

image-processing exercises.
image-processing exercises.

image_processing Assignment 21 Checkered Board Create a chess table using numpy and opencv. view: Color Correction Reverse black and white colors with

clesperanto is a graphical user interface for GPU-accelerated image processing.
clesperanto is a graphical user interface for GPU-accelerated image processing.

clesperanto is a graphical user interface for a multi-platform multi-language framework for GPU-accelerated image processing. It is based on napari and the pyclesperanto-prototype.

Simple Python image processing & automatization project for a simple web based game
Simple Python image processing & automatization project for a simple web based game

What is this? Simple Python image processing & automatization project for a simple web based game Made using only Github Copilot (except the color and

Image Processing - Make noise images clean

影像處理-影像降躁化(去躁化) (Image Processing - Make Noise Images Clean) 得力於電腦效能的大幅提升以及GPU的平行運算架構,讓我們能夠更快速且有效地訓練AI,並將AI技術應用於不同領域。本篇將帶給大家的是 「將深度學習應用於影像處理中的影像降躁化 」,

Napari simpleitk image processing
Napari simpleitk image processing

napari-simpleitk-image-processing (n-SimpleITK) Process images using SimpleITK in napari Usage Filters of this napari plugin can be found in the Tools

A small Python module for BMP image processing.

micropython-microbmp A small Python module for BMP image processing. It supports BMP image of 1/2/4/8/24-bit colour depth. Loading supports compressio

An executor that performs standard pre-processing and normalization on images.

An executor that performs standard pre-processing and normalization on images.

Releases(Release)
Owner
Pixel Brush
Pixel Brush
The friendly PIL fork (Python Imaging Library)

Pillow Python Imaging Library (Fork) Pillow is the friendly PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lund

Pillow 10.4k Dec 31, 2022
Bringing vtk.js into Dash and Python

Dash VTK Dash VTK lets you integrate the vtk.js visualization pipeline directly into your Dash app. It is powered by react-vtk-js. Docs Demo Explorer

Plotly 88 Nov 29, 2022
Small wrapper around 3dmol.js and html2canvas for creating self-contained HTML files that display a 3D molecular representation.

Description Small wrapper around 3dmol.js and html2canvas for creating self-contained HTML files that display a 3D molecular representation. Double cl

David Meijer 1 Dec 02, 2021
Instagram-like image filters.

PyGram Instagram-like image filters. Usage First, import the client: from filters import * Instanciate a filter and apply it: f = Nashville("image.jp

Ajay Kumar Nagaraj 0 Oct 18, 2022
Bot by image recognition simulating (random) human clicks

bbbot22 bot por reconhecimento de imagem simulando cliques humanos (aleatórios) inb4: sim, esse é basicamente o mesmo bot de 2021 porque a Globo não t

Yuri 2 Apr 05, 2022
Demo of using Auto Encoder for Image Denoising

Demo of using Auto Encoder for Image Denoising

2 Aug 04, 2022
Computer art based on joining transparent images

Computer Art There is no must in art because art is free. Introduction The following tutorial exaplains how to generate computer art based on a series

Computer Art 12 Jul 30, 2022
Nudity detection with Python

nude.py About Nudity detection with Python. Port of nude.js to Python. Installation from pip: $ pip install --upgrade nudepy from easy_install: $ eas

Hideo Hattori 881 Jan 06, 2023
QSIprep: Preprocessing and analysis of q-space images

QSIprep: Preprocessing and analysis of q-space images Full documentation at https://qsiprep.readthedocs.io About qsiprep configures pipelines for proc

Lifespan Informatics and Neuroimaging Center 88 Dec 15, 2022
Convert Image to ASCII Art

Convert Image to ASCII Art Persiapan aplikasi ini menggunakan bahasa python dan beberapa package python. oleh karena itu harus menginstall python dan

Huda Damar 48 Dec 20, 2022
sK1 2.0 cross-platform vector graphics editor

sK1 2.0 sK1 2.0 is a cross-platform open source vector graphics editor similar to CorelDRAW, Adobe Illustrator, or Freehand. sK1 is oriented for prepr

sK1 Project 238 Dec 04, 2022
An automated Comic Book downloader (cbr/cbz) for use with SABnzbd, NZBGet and torrents

Mylar Note that feature development has stopped as we have moved to Mylar3. EOL for this project is the end of 2020 and will no longer be supported. T

979 Dec 13, 2022
Kainat 13 Mar 07, 2022
An API that renders HTML/CSS content to PNG using Chromium

html_png An API that renders HTML/CSS content to PNG using Chromium Disclaimer I am not responsible if you happen to make your own instance of this AP

10 Aug 08, 2022
Python pygame project that turns your images to matrix rain

Matrix-Rain-An-Image This project implements the classic Matrix digital rain effect in python with pygame to build up an image provided with multiple

7 Dec 11, 2022
3D printer / slicing GUI built on top of the Uranium framework

Cura Ultimaker Cura is a state-of-the-art slicer application to prepare your 3D models for printing with a 3D printer. With hundreds of settings and h

Ultimaker 4.4k Jan 02, 2023
Simple AI app that is guessing color of apple in picture

Apple Color Determinant Application that is guessing color of apple from image Install Pillow, sklearn and numpy, using command for your package manag

Gleb Nikitin 1 Oct 25, 2021
An executor that performs standard pre-processing and normalization on images.

An executor that performs standard pre-processing and normalization on images.

Jina AI 6 Jun 30, 2022
Simple utility to tinker with OPlus images

OPlus image utilities Prerequisites Linux running kernel 5.4 or up (check with uname -r) Image rebuilding Used to rebuild read-only erofs images into

Wiley Lau 15 Dec 28, 2022
A tool and a library for SVG path data transformations.

SVG path data transformation toolkit A tool and a library for SVG path data transformations. Currently it supports a translation and a scaling. Usage

Igor Mikushkin 2 Mar 07, 2022