Monday, 23 May 2011


The Digital Division

Little Nephew has a physics exam today, so we've been busy revising the curriculum over the weekend. Near as I can tell he's hitting full marks in the first five out of the six component units: Movement, Radiation, Telecommunications, Electricity, Sound and Music. Not that the sample questions are a great indicator of a candidate's proficiency. I'm certain you could replace your grasp of physics by the algorithm, "Divide the first number by the second", and score about 65% using that stratagem alone. He does seem already to have grasped this fact.

The sixth and final unit covers the basics of Digital Electronics. Whether because it's the most recently introduced (we have previously had multiple sessions on the other areas), or because there are no number pairs to divide into each other, this does appear to be his one comparatively weak spot.

I've written previously about the efficacy of bringing practical demonstrations and aides-mémoires into our lessons, and for several months had been toying with the idea of writing a simulator for the basic digital electronic components - gates, flip-flops, registers, switches, LEDs and so on. Even made a few aborted attempts, in C#, Logo, and Scratch. But these kept getting bogged down by one particular detail: propagation delay. If a given circuit would in reality oscillate, then I felt that the model should do likewise. Unfortunately, this single choice opens the floodgates to a torrent of design decisions, turning the unwary engineer into a startled frozen rabbit...


Eventually yesterday, while he took his well-earned break and game of L.A. Noire between units 5 and 6, I decided I'd reinvented enough wheels for this month; performed a quick web search; and downloaded a 30 day demo of the first digital electronics simulator found. This was, and I could never have wished for a more perfectly dovetailed fit to match our educational requirements. Had it up and running in three seconds. Had example circuits from his textbook entered and working ten seconds after that. Okay I might be exaggerating a little; it's actually a cross-platform web based app, requiring installation of Adobe AIR to provide the offline standalone version. But that's just how it felt. Everything dragged and clicked exactly as expected, working instantly, with not a single word of prompting. Surely the only possible definition of the perfect UI.

Designer Josh Tynjala has Kept It Simple, Stupid. There's no fatally misguided attempt to model propagation delay accurately, which I see now is technology dependent anyway. After all, some ways of constructing real, physical logic gates, instead of allowing runaway oscillating designs, might go into a thermally destructive linear mode. Rather than second-guess your technology tradeoffs, Josh's gates simply tolerate forced inconsistencies, and leave aberrant behaviours to be discovered in later, practical lashups with real components. Bravo.

What's In The Box

The supplied component set was also more than ideal for our needs (hyperbole intended). Gates include inverters, and n-input gates (2 ≤ n ≤ 8) in all flavours (AND, OR, NAND, NOR, XOR, XNOR). A nice touch is the configurability of these last two for either odd/even parity or "=1" behaviour. At the next level of integration, there are flip-flops of the SR, D, JK and T kinds. Input controls include fixed logic levels, toggle and pushbutton switches, and a square wave generator. Outputs can go to either single lamps or 4-input hex digit displays.

Despite my earlier remarks on propagation time, the available components do include a buffer. According to the documentation, this "simply propagates the signal it receives. In the real world, a buffer will boost the electrical signal, if it has lost strength. In Logicly's simulation, one may use the buffer to affect propagation time." Hmm, I read that as: "future expansion".

Three demo circuits are provided to help get you started on more advanced projects: a D Latch memory cell, 1-bit Full Adder, and a Ripple Counter. Best of all, you can try the free demo online (no download required, but does need Flash 10).


The circuit editor has configurable grid size and snap. Logic gate symbols are switchable between the distinctive shapes of the ANSI/IEEE standard, and the rectangles used by the IEC. Wire colours are used to indicate logic levels 0, 1 or indeterminate; these colours can be disabled or customised. Finally, unconnected inputs can be assigned a default logic level. When I started playing with chips in the 1970s, everything was TTL, and floating inputs went to logic "1". Some cretins even used this fact in their designs. The same idiots who bequeathed us the millennium bug, no doubt.

My Wish List

A killer feature would be the ability to package your own debugged circuit into its own little chip, a bit like the supplied flip-flop components, making it available for reuse in further designs. That's a lot of work, but I'm sure Josh has already thought of it plenty of times. Just the same, think I'll email him with the suggestion. Alternatively, or additionally, some more components from the MSI range would be good. Shift registers, multi-bit adders, that sort of thing. Lastly, a native Print option in the standalone version might not hurt a lot.

So... Did It Work?

Little Nephew is sitting his exam as I write this. I know he'll do extremely well.

No comments:

Post a Comment