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
A simple plugin to view APR images in napari

napari-apr-viewer A simple plugin to view APR images in napari This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-

5 Jan 24, 2022
Transfers a image file(.png) to an Excel file(.xlsx)

Transfers a image file(.png) to an Excel file(.xlsx)

Junu Kwon 7 Feb 11, 2022
Sombra is simple Raytracer written in pure Python.

Sombra Sombra is simple Raytracer written in pure Python. It's main purpose is to help understand how raytracing works with a clean code. If you are l

Hernaldo Jesus Henriquez Nuñez 10 Jul 16, 2022
Fixes 500+ mislabeled MURA images

In this repository, new csv files are provided that fixes 500+ mislabeled MURA x-rays for all categories. The mislabeled x-rays mainly had hardware in them. This project only fixes the false negative

Pieter Zeilstra 4 May 18, 2022
Panel Competition Image Generator

Panel Competition Image Generator This project was build by a member of the NFH community and is open for everyone who wants to try it. Relevant links

Juliano Mendieta 1 Oct 22, 2021
This is the official source code of FreeCAD, a free and opensource multiplatform 3D parametric modeler.

Freedom to build what you want FreeCAD is an open-source parametric 3D modeler made primarily to design real-life objects of any size. Parametric modeling allows you to easily modify your design by g

FreeCAD 12.9k Jan 07, 2023
🎶😤 Generate an image indicating what you are listening to 😳

I'm Listening to This (song that I've sent you an image about detailing its metadata in a nifty way) Few lines describing your project. 📝 Table of Co

Connor B - Viibrant 4 Nov 03, 2021
QR-code Generator with a basic GUI.

Qr_generator_python Qr code generator with a basic GUI. ❔ About the QR-Code-Generator This project Generates QR codes to sites, e-mails and plain text

Tecixck 2 Oct 11, 2021
Hello, this project is an example of how to generate a QR Code using python 😁

Hello, this project is an example of how to generate a QR Code using python 😁

Davi Antonaji 2 Oct 12, 2021
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
A python program to generate ANSI art from images and videos

ANSI Art Generator A python program that creates ASCII art (with true color support if enabled) from images and videos Dependencies The program runs u

Pratyush Kumar 12 Nov 08, 2022
This repository will help you get label for images in Stanford Cars Dataset.

STANFORD CARS DATASET stanford-cars "The Cars dataset contains 16,185 images of 196 classes of cars. The data is split into 8,144 training images and

Nguyễn Trường Lâu 3 Sep 20, 2022
Nanosensor Image Processor (NanoImgPro), a python-based image analysis tool for dopamine nanosensors

NanoImgPro Nanosensor Image Processor (NanoImgPro), a python-based image analysis tool for dopamine nanosensors NanoImgPro.py contains the main class

1 Mar 02, 2022
Py3D - A 3d rendering engine written entirely in python

Py3D is a 3d rendering engine written entirely in python. It is a simple and eas

1up Community 2 Nov 14, 2022
Fast Image Retrieval is an open source image retrieval framework

Fast Image Retrieval is an open source image retrieval framework release by Center of Image and Signal Processing Lab (CISiP Lab), Universiti Malaya. This framework implements most of the major binar

CISiP Lab 39 Nov 25, 2022
Computer art based on quadtrees.

Quads Computer art based on quadtrees. The program targets an input image. The input image is split into four quadrants. Each quadrant is assigned an

Michael Fogleman 1.1k Dec 23, 2022
Rembg is a tool to remove images background.

Rembg is a tool to remove images background.

Daniel Gatis 7.8k Jan 05, 2023
Xmas-Tree-GIF-Tool - Convert any given animated gif file into an animation in GIFT CSV format

This repo is made to participate in Matt Parker's XmasTree 2021 event. Convert a

Aven Zitzelberger 2 Dec 30, 2021
㊙️ Create standard barcodes with Python. No external dependencies. 100% Organic Python.

python-barcode python-barcode provides a simple way to create barcodes in Python. There are no external dependencies when generating SVG files. Pillow

Hugo Barrera 419 Dec 26, 2022
A functional and efficient python implementation of the 3D version of Maxwell's equations

py-maxwell-fdfd Solving Maxwell's equations via A python implementation of the 3D curl-curl E-field equations. This code contains additional work to e

Nathan Zhao 12 Dec 11, 2022