Skip to content
digiwleeaTools
LearnGlossaryAboutCheat sheetHow a CPU worksBuild a CPUToolsOpen the lab →

Wiremod logic gates: how Garry's Mod wiring maps to real logic

Wiremod is an open-source add-on for Garry's Mod (Apache-2.0, on GitHub and the Steam Workshop in Stable and Canary builds) that adds entities which talk to each other over wires, so you can build automatic and user-controlled contraptions: buttons, thrusters, screens, Expression 2 script chips and even a programmable CPU and GPU. Its gate entity has many modes. The logic gates are Not, And, Or, Exclusive Or, Not And, Not Or and Exclusive Not Or, and And and Or take up to eight inputs. Memory gates include a D-Latch, SR-Latch and RS-Latch, an edge-triggered Latch and Toggle, an Up/Down Counter and RAM, and there are bitwise, comparison, arithmetic and selection gates such as a 7 Segment Decoder. Wiremod's gates behave like real ones in most ways, with one big difference underneath.

How Wiremod's gates map to logic

A Wiremod wire carries a number, not a bit. Its source code defines the logic gates on that number: And outputs 1 if all inputs are greater than 0, Or if any is, and Not outputs 0 for an input greater than 0 and 1 otherwise, so 0 and negative values count as false. The D-Latch stores its Data input while Clk is greater than 0, so one latch holds a whole number, and the bitwise gates (And, Or, Xor, Not and shifts) work on the bits of that number. Because one wire is a number, a single Add or Greater Than gate does what takes a whole adder or comparator in hardware, which is what makes Wiremod quick to build with. (digiwleea is an independent project, not affiliated with Wiremod or Facepunch Studios.)

How real logic gates differ

In a chip each wire carries one bit, 0 or 1, and adding two numbers takes a chain of full adders, one per bit; a latch stores one bit, so a register is a row of them. There are no negative values on a wire: signed numbers are a pattern of bits read as two's complement. digiwleea lets you build those layers yourself in the browser, from CMOS transistors to gates, adders, latches, registers, RAM and an 8-bit CPU that runs a stored program, plus the assembly language behind it, with every part checked against its truth table and an AI tutor (Wleea) to help.

Wiremoddigiwleea
What a wire carriesA number; logic gates treat values above 0 as trueOne bit: 0 or 1
Logic gatesNot, And, Or, Xor, Nand, Nor, Xnor (And and Or up to 8 inputs)Built from transistors, then reused as parts
MemoryD-Latch, SR-Latch, RS-Latch, Toggle, counters and RAM, each holding a numberLatches and flip-flops that hold one bit each
ArithmeticOne gate: Add, Subtract, Greater Than and moreAdders and comparators built from gates
Runs inGarry's Mod (a paid game on Steam), as an add-onAny modern browser, nothing to install

Wiremod gates and the real circuits behind them

No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.

More comparisons: Games about logic and computers

See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.

Open the digiwleea lab →

Frequently asked

What logic gates does Wiremod have?

Its gate entity's logic modes are Not, And, Or, Exclusive Or, Not And, Not Or and Exclusive Not Or, and And and Or accept up to eight inputs. There are also memory gates (latches, a toggle, counters and RAM), bitwise, comparison, arithmetic and selection gates.

How does a Wiremod And gate treat numbers?

Its source code outputs 1 when every connected input is greater than 0, and 0 otherwise. Or outputs 1 when any input is greater than 0, and Not outputs 1 only when its input is 0 or negative.

How do you make memory with Wiremod?

Use a memory gate: the D-Latch stores its Data input while Clk is greater than 0, the SR-Latch and RS-Latch set and reset, and the Toggle flips on a rising edge. In hardware the same latches are gates fed back to each other, holding one bit each.

Is Wiremod like real digital logic?

In spirit. Its wires carry numbers instead of single bits, so one gate can add or compare whole values; in a chip that takes many 1-bit gates wired as adders and comparators. The ideas of gating, latches, counters and clocks carry straight over.