This book attempts to capture the spirit of the ''Bronze Age'' of video games, when video games were designed as circuits, not as software. We'll delve into these circuits as they morph from Pong into programmable personal computers and game consoles. Instead of wire-wrap and breadboards, we'll use modern tools to approximate these old designs in a simulated environment from the comfort of our keyboards. At the end of this adventure, you should be well-equipped to begin exploring the world of FPGAs, and maybe even design your own game console. You'll use the 8bitworkshop.com IDE to write Verilog programs that represent digital circuits, and see your code run instantly in the browser.List of LogicDiscrete HardwareClocks and Flip-FlopsHDL (Hardware Description Language)Intro to VerilogThe 8bitworkshop IDEA Simple Clock DividerA Binary CounterVideo Signal GeneratorA Test PatternDigitsScoreboardA Moving BallSlipping CounterRAMTile GraphicsSwitches and PaddlesSpritesBetter SpritesRacing GameSprite RotationMotion VectorsTank GameShift RegistersSound EffectsTilemap RenderingScanline Sprite RenderingThe Arithmetic Logic UnitA Simple CPUA Configurable AssemblerRacing Game With CPUA 16-bit CPUFramebuffer GraphicsA Programmable Game SystemA Demo ProgramPractical Considerations for Real HardwareFPGA ExamplesAppendix Verilog ReferenceAppendix Troubleshooting
Greatly enjoying this book. One note: when hooking up the digits10_array module (which is incorrectly defined as digits10_case on the previous page), the line
wire g = display_on && bits[xofs ^ 3’b111];
...is using that XOR "^" character to flip the xofs.
The xofs is a 3-bit number that rises from 0 to 7 repeatedly as the scanline goes from left to right. This means that index 0 in our bits array would go on the left, then index 1 would be to the right of it, and so on.
But the way we defined our bits array doesn't work that way.
If we do:
bitarray[0][0] = 5’b00001;
then bitarray[0] would be 1 and bitarray [1] would be 0. In other words, because the least-significant bit in b'00001 is on the right in human notation, our "rightmost" bit is the least-significant one (the one you'd see at index 0).
(It's actually human notation that flips the bits from right to left, come to think of it.)
So if we used xofs as-is, it would start with the rightmost digit and move left. Which is fine, but it would horizontally flip the numbers we put into our bitarray definition.
To reverse that, xofs ^ 3'b111 will flip xofs from least-significant to most-significant. In other words, when xofs is 0, xofs ^ 3'b111 will be 7. When xofs is 1, xofs ^ 3'b111 will be 6. And so on.
Very nice companion website, interesting side stories, but it goes very fast, not explaining many thing deeply enough. The focus is also on the design, not on the Verilog language, which is fine, but not what I hoped for.