Karan Diwan

Repeated Arithmetic Machine

A 4-bit feedback-driven computing machine, from a single self-correcting adder to a stored-program automaton.

This project began from a simple question: what if the output of an arithmetic operation could be fed back into its own input? The first prototype could only add and take feedback. Five versions later, the Repeated Arithmetic Machine (RAM) is a modular 4-bit system with feedback-driven control, automatic error correction, and the ability to execute programs stored in memory. It's the hardware root the rest of this work builds on, the point where the project crossed from circuits into a programmable system.

RAM V3 performing division, waveform demonstration
RAM V3 performing division: self-correcting, state-based control.

Evolution

The instruction set was not designed on paper first. It emerged from the machine's own hardware primitives, addition, subtraction, feedback correction, fault recovery, reset, and was mapped to assembly only afterward. Each instruction corresponds to a dedicated hardware operation rather than a microcoded sequence, so the software vocabulary of the machine was discovered from its hardware.

RAM V4 machine code instruction format
Machine-code instruction format, RAM V4.

Synthesis and verification

Every module was synthesized with Yosys, technology-mapped to the Sky130HD standard-cell library, and analyzed for timing and power to confirm the design is hardware-realizable rather than only functionally correct in simulation.

Post-synthesis characterization, Sky130HD
ModuleCellsAreaCritical pathPower
Operand Storage System9337.8 µm²0.64 ns57.3 µW
Arithmetic Unit8376.6 µm²1.56 ns174 µW
Feedback System425.0 µm²0.10 ns3.24 µW
RAM Engine (full system)21718.2 µm²1.99 ns186 µW
Estimated system Fmax is approximately 502 MHz, set by the RAM Engine's 1.99 ns critical path. The Arithmetic Unit alone accounts for 52% of area and 94% of power, making it the dominant cost in the system.
RTL simulation waveform of the RAM Engine
RTL simulation of the RAM Engine.

The assembly layer built on top of this machine is its own project. See Assembler.

Toolchain: Logisim, Icarus Verilog, Verilator, Yosys, OpenSTA, GTKWave, Sky130HD
View repository on GitHub →
← FIFO Architectures Next: Assembler →