Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Digital Logic Sim

​A minimalistic digital logic simulator · By Sebastian Lague

Weird Bug with registers

A topic by DNAterror created Apr 22, 2025 Views: 148 Replies: 1
Viewing posts 1 to 2

when ever i spawn in a register (same ones he made in the second video) they have a random value which wouldn't be an issue but if the random value is a 0 then it wont let me write data to the variable and anytime i use a chip which contains registers its randomly generates meaning i have to respawn the chip upwards of 100 times

TL;DR - working as intended.

In real life, latches and flipflops start in an unknown state. In the simulation *some* style of latches and flip-flops (those built on cross-NOR and cross-NAND gates) also start in an unknown state. Within the simulation AND-NOT-OR style latches start in a known state. There's a bit more nuance to it, but that's the gist.

https://github.com/SebLague/Digital-Logic-Sim/issues/326

Just like in real life, you need some sort of asynchronous Clear signal during your Reset cycle to get the register to initialize to zero.