
Almurut II is the system on a chip of ASC2, the AUCA Simple Computer: a 32-bit computer with its own instruction set, named Alm, an AI accelerator, and its own Unix-like kernel, named Rach2. The computer is small enough to study from end to end and capable enough to run Linux. ASC2 runs three operating systems: Rach2; xv6, the teaching system of MIT; and Linux 6.18, the mainline kernel with the MMU and paging. It has two C compilers, TinyCC and Clang with an LLVM backend for Alm, an assembler, and an emulator. All of it, with the demos, their animations, and the measurements, is in the platform repository: https://github.com/toksaitov/asc2-project.

| Part | In short |
|---|---|
| Instruction set | Alm, inspired by the classic x86 and ARM: 69 opcodes, every instruction one word of 32 bits |
| CPU | 13 registers and an instruction cache of 32 words |
| System | Kernel and user mode, interrupts, an MMU with paging, addresses of 32 bits (4 GB) |
| AI accelerator | A systolic array of four cells, twelve weights, twelve inputs, eight instructions |
| Operating systems | Rach2, xv6, and Linux 6.18 |
| Speed | A layout timed for 79.8 MHz; the whole computer runs at 37.5 MHz on an FPGA |
| Size | 16 tiles (8x2) of SKY130, 1378 by 226 micrometers |
The chip holds the CPU with its MMU, its instruction cache, and the AI accelerator, and beside it a bus unit, a debug port, a keyboard controller, an interrupt controller, and a timer. A microcontroller beside the chip, the RP2350B of the demo board, is its bridge to memory, storage, and peripherals: it serves the RAM, the boot ROM, a disk, a console, a clock, a screen, and a button over a bus of ten wires, and it plays the keyboard. The devices of the bridge are firmware, so a new one needs no new chip.

Alm is inspired by the classic x86 and ARM instruction sets, so one small machine teaches both sides of the popular ISAs. As on a 32-bit x86, a program works with flags, the devices answer at I/O ports, the ports of a PC, and the page tables have two levels. As on ARM, every instruction is one word of 32 bits, simple loads and stores, lr and sr, reach memory in place of a mov of many forms, call leaves the return address in a link register, and each mode has its own stack pointer. More: asc2-project/asc2-emulated/Readme.md.
| Instructions | Operation |
|---|---|
mov, li, lih |
Copy a register; load 16 bits with their sign; replace the upper 16 bits |
lr, lrh, lrb, lrhu, lrbu |
Load 4, 2, or 1 bytes from a register plus a displacement; u loads without the sign |
sr, srh, srb |
Store 4, 2, or 1 bytes |
push, pop |
The stack |
add, adc, sub, sbb, cmp |
Arithmetic |
and, test, or, xor, not |
Logic |
shl, shr, sar |
Shifts |
mul, dot4 |
The low 32 bits of a product; four products of signed bytes that are added to a register |
popcnt, ssat, usat |
The count of the set bits; a value held in -128 to 127, or in 0 to 127 |
dotv, dotm, learn, xsh, moves of w0 to w2 and x0 to x2 |
The AI accelerator, described below |
jmp, je, jne, jl, jge, jle, jg, jb, jae, jbe, ja |
Jumps to a label or to the address in a register |
sete, setne, and the other eight conditions |
1 or 0 from a condition |
call, ret |
Subroutines |
int |
A call into the kernel |
hlt, cli, sti, iret, inb, outb, moves of cr0 to cr8 |
Kernel mode only: halt, interrupts off and on, return from a handler, the I/O ports, control registers |
The accelerator is a systolic array: four equal cells in a row, each multiplying two signed bytes and handing its sum to the next. It keeps twelve weights and twelve inputs on the chip, a signed byte each, in three rows of four, and the cells take the rows one after another. Multiplying and adding up is the step at the heart of a neural network: a neuron of twelve inputs is one instruction, and a step of its training one more.
| Instruction | What it does |
|---|---|
dotv |
Adds all twelve products to a register: one neuron |
dotm |
Gives the sum of each row to its own register: three neurons |
learn |
Moves every weight by its input times an error: training |
xsh |
Moves the inputs on by one byte: a filter over a stream |
dot4 |
Multiplies the four bytes of two registers, adds the products |
ssat, usat |
Hold a result within a byte; usat is a rectified linear unit |
popcnt |
Counts bits, for networks with weights of one bit |
With the cache and the accelerator, a step of learning runs 38.8 times faster than as plain code on the same chip with the cache off. The kernel uses the accelerator itself: a neuron in its scheduler guesses whether a process will sleep before its turn ends, and about nine guesses of ten are right. In the showcase, a neuron starts with nothing and learns to fly a burkut between pillars from every crash. More: asc2-project/asc2-kb/array-design.md.

The CPU has what a course on operating systems needs: a kernel mode and a user mode, interrupts and exceptions, and paging, where the CPU reads the page tables by itself. The kernel Rach2 uses all of it: every program is a process with its own memory, and the timer shares the CPU between them. xv6 and Linux run on the same hardware: Linux boots into a BusyBox shell on the logic of this chip and on the Tang Nano 20K FPGA board with 8 MB of RAM. More: asc2-rach2/, asc2-xv6/, and asc2-linux/ in asc2-project.
The chip and the bridge talk over the eight bidirectional pins, a byte at a time: the chip changes REQ for each byte, and the bridge answers each change by bringing ACK to the level of REQ. A request is a header byte, four address bytes, and the data of a write; the answer is a status byte and the data of a read. The chip checks every answer and repeats a request that got none, and a sequence bit lets the bridge see the repeat, so every access happens once. Once it has handed the pins to the bridge for an answer, the chip drives them again only after the answer or a quiet time. If three repeats in a row go unanswered from the first byte, the chip lets the bus go and raises BUS_OFF, and the bridge resets it. FRAME is high while a request is open, UIO_OE while the chip drives the pins. More: asc2-project/asc2-kb/bus-protocol-v1.md.
While STOP is high, the CPU waits between two instructions, so the bridge can run a program one instruction at a time. The debug port shows the whole state of the CPU, 644 bits, on three pins: each rise of DBG_CK shows the next bit on DBG_DO, or bit 0 again while DBG_DI is high. The port starts open, and a kernel can lock it until the next reset. SAFE_N, read at the reset, chooses the safe start when low: the instruction cache stays empty, every fetch carries its address, and bit 643 of the debug port is set. It must hold from five running clocks before the reset ends (or the clock stops) to eight clocks after.
The demo board alone runs the whole computer. With the firmware of ASC2, the RP2350B of the board is the bridge: it selects the design, makes the clock and the reset, holds SAFE_N high, and answers the requests of the chip. Four steps lead from a first program on the chip to a tour of the whole computer. They need the Pico SDK (PICO_SDK_PATH), picotool, the Arm GCC toolchain, a C compiler, Make, and Python 3.
Build the firmware. N is the address of the design on the shuttle, the first badge under the title. Hold BOOT of the board while the USB cable goes in, and copy build-tt/bridge.uf2 to the drive that appears. It takes the place of the stock firmware of the board.
git clone https://github.com/toksaitov/asc2-project
cd asc2-project/asc2-bridge/firmware
cmake -B build-tt -DPICO_BOARD=tt_demoboard_v3 -DTT_DESIGN=N
make -C build-tt
Run a first program on the chip. It prints Hello from Almurut II! and then prints back what is typed; ctrl+] leaves it.
cd ../..
alias bridge="python3 -I $PWD/asc2-bridge/host/bridge.py"
make -C asc2-assembler
asc2-assembler/asa asc2-firmware/hello.s hello
bridge run hello
Boot the kernel from its disk. It greets with Rach2 for Almurut II, and the shell waits at $.
make -C asc2-rach2
bridge disk put asc2-rach2/build/disk.img
bridge run asc2-rach2/build/rach2.bin
Type tour. Ten programs run in about eight minutes, from the AI accelerator at work to 3D graphics and a short film. Each program prints what it has found, and it also draws on the screen if the board has one. More: asc2-project/asc2-bridge/Readme.md.
The Readme of the platform goes on from there: programs in C with TinyCC and Clang, xv6, and Linux.
On the board, the switches are off, and the Pmod sockets and the clock header are free. Outputs 4, 6 and 7 are not used: the chip holds 4 high, as a silent serial line, and 6 and 7 low. In simulation, the test of the chip's repository runs 26 self-checking programs on the chip, 19 of them on its gates too.
The demo board alone runs the whole computer: its RP2350B is the bridge, and a computer on its USB port is the terminal. The bridge also plays the PS/2 keyboard on KBD_CLK and KBD_DATA and drives both pins at all times, so this firmware does not support a real keyboard on them.
An OLED screen of 128 by 64 pixels (SSD1306 or SH1106) and a push button on the analog header of the board are optional and add the graphics, the games, and the stepper. The wires are in the Readme of the bridge, under "The Demo Board of Tiny Tapeout": asc2-project/asc2-bridge/Readme.md.
Thanks to students, faculty, and management of the Software Engineering Department, the administration of the American University of Central Asia, and the whole AUCA community for support, ideas, and recommendations.

| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | ACK | REQ | D0 |
| 1 | IRQ | DBG_DO | D1 |
| 2 | DBG_CK | UIO_OE | D2 |
| 3 | SAFE_N | FRAME | D3 |
| 4 | DBG_DI | D4 | |
| 5 | KBD_CLK | BUS_OFF | D5 |
| 6 | KBD_DATA | D6 | |
| 7 | STOP | D7 |