Invariant Properties

  • rss
  • Home

8-bit Breadboard Computer: Good Encapsulation!

Bear Giles | May 25, 2020

I need to take a break from all-devops-all-the-time so I grabbed my Arduino toy chest (mostly sensors) and finally watched Ben Eater‘s excellent series on building an 8-bit computer on a breadboard.

Well… closer to a dozen breadboards.

There’s many hours of videos but you can tease out a dozen or so that have a really good example of encapsulation.

The first step is building basic logic circuits – AND, OR, INVERTER(NOT), NAND, and NOR(XOR – using discrete transistors. You can’t get more basic than that using electronics. (If you don’t limit yourself to electronics (transistors and vacuum tubes) uou can use electrical relays (relay ladder logic), pneumatic systems, or even mechanical systems like a stack of tinker toys.)

The next step is using these basic logic circuits to build “latches” and “flip-flops”. A “latch” holds a value even after the inputs have changed, a “flip-flop” has the practical effect of allowing you double the period of a clock cycle. That allows you to build binary counters.

It takes nearly a dozen videos to go from a “SR latch” to a “D flip-flop” but it’s an easy to follow series of progressive improvements. At each step an issue is identified and a solution identified. Sometimes there’s remaining issues, sometimes this creates a new issue, and the process continues.

One big difference from software is that the intermediate stages can still be very useful. If you know that you’ll never encounter the problematic input you can use the simpler circuits and reduce chip count and costs. You generally don’t see the same savings in software if you stay within the same abstraction layer.

The next step is using these latches and flip-flops to build adders (arithmetic control unit (ACU)), memory, etc.

The penultimate step is bundling these chips onto separate breadboards. We can start thinking of them in functional terms – clock, memory and registers, instruction pointer, microcode.

The final step is capturing one particularly nasty bit of logic in an EEPROM. A basic computer science truism is that a pure function (that is – one that does not depend on internal state) and a memory lookup are equivalent. You could use discrete logic to convert from the instruction set to the step of operations required to move data between elements of the processor but in this case it’s much better to use a memory lookup instead. It greatly reduces the risk of a wiring error, simplifies changing the “microcode” (e.g., to add a new instruction), etc.

We could build the “A register” out of discrete transistors, vacuum tubes, or even electrical relays (bombe, anyone?), but why? It comes down to who is looking at the circuitry. A human can only handle a few items at a time so a single breadboard containing at most 4 chips – no human could look at the equivalent collection of hundreds of transistors and make sense of it. It’s not worth our time or effort to peel back the encapsulation. If you do need to do it, e.g., to fit the logic in a FPGA or PLA, we’re still better off using a domain-specific language that allows the human to work at a high abstraction layer (e.g., registers or 3-to-8 decoders) and then uses an optimizer to eliminate redundant and unnecessary transistors.)

Further Ideas

I would have liked to seen how much of the existing circuitry could have been replaced by EEPROMs. E.g., the ‘clock’ uses a combination of analog electronics, switches, and logic chips to create the CLK, RST, ~RST signals used by the rest of the system. It seems like overkill – the cost of a small EEPROM is several times the cost of the individual logic chips – but perhaps a PLA could do the same work at about the same cost as the individual chips.

Another possibility is sticking with the EEPROM but combining related functionality. E.g., one of the main uses of the CLK is to increment the microcode counter. An EEPROM with an 8-bit output supports a 5-bit counter after accounting for the CLK, RST, and ~RST signals. Are there other places where related functionality can be combined?

Finally both approaches naturally lead to FPGA. In some ways it would be silly to have the ‘8-bit breadboard computer’ to be reduced to a single breadboard with a FPGA but at the same time it’s the culmination of a natural progression of encapsulating one abstraction layer after another.

Comments
No Comments »
Categories
Uncategorized
Comments rss Comments rss
Trackback Trackback

Archives

  • May 2020 (1)
  • March 2019 (1)
  • August 2018 (1)
  • May 2018 (1)
  • February 2018 (1)
  • November 2017 (4)
  • January 2017 (3)
  • June 2016 (1)
  • May 2016 (1)
  • April 2016 (2)
  • March 2016 (1)
  • February 2016 (3)
  • January 2016 (6)
  • December 2015 (2)
  • November 2015 (3)
  • October 2015 (2)
  • August 2015 (4)
  • July 2015 (2)
  • June 2015 (2)
  • January 2015 (1)
  • December 2014 (6)
  • October 2014 (1)
  • September 2014 (2)
  • August 2014 (1)
  • July 2014 (1)
  • June 2014 (2)
  • May 2014 (2)
  • April 2014 (1)
  • March 2014 (1)
  • February 2014 (3)
  • January 2014 (6)
  • December 2013 (13)
  • November 2013 (6)
  • October 2013 (3)
  • September 2013 (2)
  • August 2013 (5)
  • June 2013 (1)
  • May 2013 (2)
  • March 2013 (1)
  • November 2012 (1)
  • October 2012 (3)
  • September 2012 (2)
  • May 2012 (6)
  • January 2012 (2)
  • December 2011 (12)
  • July 2011 (1)
  • June 2011 (2)
  • May 2011 (5)
  • April 2011 (6)
  • March 2011 (4)
  • February 2011 (3)
  • October 2010 (6)
  • September 2010 (8)

Recent Posts

  • 8-bit Breadboard Computer: Good Encapsulation!
  • Where are all the posts?
  • Better Ad Blocking Through Pi-Hole and Local Caching
  • The difference between APIs and SPIs
  • Hadoop: User Impersonation with Kerberos Authentication

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Pages

  • About Me
  • Notebook: Common XML Tasks
  • Notebook: Database/Webapp Security
  • Notebook: Development Tips

Syndication

Java Code Geeks

Know Your Rights

Support Bloggers' Rights
Demand Your dotRIGHTS

Security

  • Dark Reading
  • Krebs On Security Krebs On Security
  • Naked Security Naked Security
  • Schneier on Security Schneier on Security
  • TaoSecurity TaoSecurity

Politics

  • ACLU ACLU
  • EFF EFF

News

  • Ars technica Ars technica
  • Kevin Drum at Mother Jones Kevin Drum at Mother Jones
  • Raw Story Raw Story
  • Tech Dirt Tech Dirt
  • Vice Vice

Spam Blocked

53,314 spam blocked by Akismet
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox