Re: Chapter 1 efficiency considerations
Posted by WBahn on Jul 11, 2020; 10:30pm
URL: http://nand2tetris-questions-and-answers-forum.52.s1.nabble.com/Chapter-1-efficiency-considerations-tp4034841p4034846.html
No, you weren't misreading it.
For THIS project, all of the combinatorial logic blocks are constructed using nothing but 2-input Nand gates, either directly or indirectly. You also have the sequential logic portion of the design and those are all build using a D-type flip flop as the primitive building block.
For THIS project, there is no real point in trying to design it with "efficiency" in mind, in large part because whatever metric you might have used to determine if one design is more efficient than another design largely loses its meaning when you are constrained to use just 2-input Nand gates as your primitive building block.
So, for THIS project, focus first and foremost on getting ANY design that functions correctly. The degree to which you can come up with an "elegant" design is nice and can be good practice, but completely immaterial as far as completing the project is concerned.
Yes, the authors only care about a functioning solution. That's the only thing that the test files check for. The Xor gate example that they show in Figure 1.6 use is a shining case in point. They use higher-level gates to implement the logic because doing so makes the mapping between the Boolean logic that describes a 2-input Xor gate and the logic design glaringly obvious. This is very much in line with their primary approach of increasing the complexity and level of abstraction of the design one small step at a time and then using each level as the basis for the next level.
But from any reasonable metric for "efficiency" it is an absolutely horrible design. An Xor can be implemented, even under the constraints of this project, using four 2-input Nand gates yielding a design that uses 16 transistors and exhibits 3 gate delays. But their design would use 36 transistors and exhibit 5 gate delays. But that doesn't matter for THIS project, because the ONLY thing that matters is that the design function correctly.
No, I don't speak on behalf of the authors, but I have had quite a bit of interaction with them and I've gotten a pretty good understanding of what their goals and rationale are for how they are going about things the way they do (which doesn't mean that I can guarantee that I'm right about that in any particular instance).