Elements of Computing Systems Chapter 5b

Tom Stuart edited this page Feb 25, 2015 · 4 revisions
Clone this wiki locally


We welcomed back Tom and James who missed our previous meeting (Elements of Computing Systems Chapter 5) and briefly recapped what progress we had made. We briefly discussed the issues we'd had last week, keen to avoid making the same mistakes again, especially focussing on improving our debugging ability (as so much time was spent being unsure of whether there was a bug in the simulator or in our code).

After a quick run-through of our completed Memory, we started to tackle the rest of the Computer.


We began by discussing our plan of attack for the CPU: debating whether to start with a simple Decoder chip and then implementing the proposed architecture from the book. While it would give us a small unit to start with, we decided against extracting this so early on as it seemed premature without knowing how the rest of the CPU connected together. With that in mind, we worked backwards from the outputs of the book's proposed architecture, simply stubbing out internal wires with false as we went.

We then used the tests provided with the project to guide us closer to the solution, implementing functionality in the sequence it was used in the test script.

There was some frustration as we hit test failures and were guilty of using trial and error to proceed but there was a call for clearer understanding before we simply raced ahead. By methodically using test failures and implementing only the functionality to make that test pass, we tried to avoid introducing too much complexity at once.

At 8:29 pm (after our most difficult exercise yet), we managed to make all tests pass for the CPU: https://github.com/computationclub/nand2tetris/commit/f0b8420efd5e24951259a1ce7c439eaeeb559142

As we won't be revisiting this material again in the next meeting, we decided to push on to glue together the final piece: the Computer itself as it largely just wires together existing chips. Thankfully, mere minutes later, we had our Computer: https://github.com/computationclub/nand2tetris/commit/9930339b786c0dfc76f05e635b2fa201dd68902c What's more, we saw it draw a little rectangle on screen and felt triumph in our collective hearts.

We discussed the possibility of refactoring our solution by extracting the decoding and jump logic into separate chips which might produce more readable code (forcing us to name the various instruction pins) but this was relegated to extracurricular homework as we'll be moving onto the next chapter in our next meeting.


Thanks again to Leo and Geckoboard for hosting the meeting and James for driving the simulator.