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
Glyph-graph - A simple, yet versatile, package for graphing equations on a 2-dimensional text canvas

Glyth Graph Revision for 0.01 A simple, yet versatile, package for graphing equations on a 2-dimensional text canvas List of contents: Brief Introduct

Ivan 2 Oct 21, 2022
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

Benyamin Zojaji 25 Dec 15, 2022
Python-based tools for document analysis and OCR

ocropy OCRopus is a collection of document analysis programs, not a turn-key OCR system. In order to apply it to your documents, you may need to do so

OCRopus 3.2k Jan 04, 2023
This tool allows the user to convert a 16 by 16 image into a list with numbers representing an object/character.

Room Formatter This tool allows the user to convert a 16 by 16 image into a list with numbers representing an object/character. There is cur

Thomas Landstra 1 Nov 13, 2021
An python script to convert images to upscaled versions made out of one-colour emojis.

ABOUT This is an python script to convert png, jpg and gif(output isnt animated :( ) images to scaled versions made out of one-colour emojis. Please n

0 Oct 19, 2022
Detecting haze image with hazer.

hazer-py Detecting haze image with hazer. What is hazer Hazer is a lib for getting "haze degree". This repository is python version of hazer: https://

Joey777210 2 Dec 27, 2021
Tool made for the FWA Yearbook Team to resize multiple images quickly.

ImageResize Tool Tool made for the FWA Yearbook Team to resize multiple images quickly. Make sure to check this repo for future updates How to Use The

LGobin 1 Jan 07, 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
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
Make your master artistic punk avatar through machine learning world famous paintings

Master-art-punk Make your master artistic punk avatar through machine learning world famous paintings. 通过机器学习世界名画制作属于你的大师级艺术朋克头像 Nowadays, NFT is beco

蒋虎成 23 Jan 04, 2022
A simple programme for converting url into a qr code (.png file)

QrTk A simple lightweight programme for converting url into a qr code (.png file) Pre-Requisites Before installing the programme , you need to run the

Juss Patel 4 Nov 08, 2021
An application that maps an image of a LaTeX math equation to LaTeX code.

Convert images of LaTex math equations into LaTex code.

1.3k Jan 06, 2023
3D Reconstruction Software

Meshroom is a free, open-source 3D Reconstruction Software based on the AliceVision Photogrammetric Computer Vision framework. Learn more details abou

AliceVision 8.7k Jan 02, 2023
Create QR Code for link using Python

Quick Response QR is short and named for a quick read from a cell phone. Used to view information from transitory media and put it on your cell phone.

Coding Taggers 1 Jan 09, 2022
Javascript image annotation tool based on image segmentation.

JS Segment Annotator Javascript image annotation tool based on image segmentation. Label image regions with mouse. Written in vanilla Javascript, with

Kota Yamaguchi 513 Nov 15, 2022
Python library that finds the size / type of an image given its URI by fetching as little as needed

FastImage This is an implementation of the excellent Ruby library FastImage - but for Python. FastImage finds the size or type of an image given its u

Brian Muller 28 Mar 01, 2022
a lite weight photo editor written in python for day to day photo editing!

GNU-PhotoShop A lite weight Photo editing Program (currently CLI only) written in python3 for day to day photo editing. Disclaimer : Currently we don'

Kunal Sharma 5 May 30, 2022
Magic-Square - Creates a magic square by randomly generating a list until the list happens to be a magic square

Magic-Square Creates a magic square by randomly generating a list until the list happens to be a magic square. Done as simply as possible... Frequentl

Nick 2 Jan 01, 2022
cmdpxl: a totally practical command-line image editor

cmdpxl: a totally practical command-line image editor Features cmdpxl has many exciting functionalities, including Editing pixels one at a time! Savin

Jieruei Chang 475 Dec 23, 2022
Simple Python package to convert an image into a quantized image using a customizable palette

Simple Python package to convert an image into a quantized image using a customizable palette. Resulting image can be displayed by ePaper displays such as Waveshare displays.

Luis Obis 3 Apr 13, 2022