esolang

Chip

A program is a circuit board drawn in text. Each clock cycle one byte goes in on eight pins and one byte comes out on eight more.

Phlarx · Turing complete: unknown · ●●● hard

Tested with 4 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

Phlarx made Chip to work like an integrated circuit. There is no instruction pointer. The letters A to H are the eight bits of the current input byte, a to h are the eight bits of the output byte, and everything in between is wiring and gates. Every cycle the board reads a byte, the signals settle, and the output pins are packed into a byte and written. A wire that touches Aa copies bit 0 straight through.

Read the story

Memory comes from parts that remember. Z holds its input for one cycle, M latches a bit, and the digits 0 to 7 with 8 and 9 make an 8-bit stack. ! is high only in the first cycle, so a row of Z behind it is a pulse that walks one cell to the right each cycle. TIO's Hello World is exactly that, with OR gates below the row picking which output bits each step lights up.

The machine

ElementDoes
A-H a-hInput and output bits, A and a the lowest
- \| + ^ v < > , . ' ` | Wires joining some of their four sides
xTwo wires that cross without touching
] ) } and [ ( {AND, OR, XOR from one side to the other, with a second input above or below
~NOT
/ \Switches, open when the line through them is 1 or 0
# @Half adders
* ! ?Always 1, 1 in the first cycle, a random bit
Z zDelay by one cycle
M mMemory cell
0-7 8 9An 8-bit stack, read with 8 and written with 9
t T S sEnd the program, end it silently, skip this output, hold this input

Every element asks its neighbours for their values when something asks it, so a signal is worked out by following the wires back to their sources. The program also ends when the input runs out.

Example

The Hello World has thirteen columns.
Expected: Chip

The Hello World has thirteen columns. In cycle n the pulse stands in column n, runs down it through the crossings x, and joins a row's OR chain wherever there is a ). Each row ends in an output bit, so column n spells the nth character. When the pulse reaches t the program stops. With no input given this implementation feeds zero bytes, as TIO's -w flag does, so the circuit runs until t.

Patterns it teaches

Further

Also in Spatial (2D and up)

Write your own in Run Convert a program from Chip

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: chip.

Command line

shib run chip -e '*Zt
 a'
shib manual chip

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/chip.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language