Administrator
|
This post was updated on .
There are many ways to approach the design.
TDD is a great method, provided you are making considered and deliberate decisions in order to pass tests. If you are just randomly changing things hoping that some new test will happen to pass, then that's a very different matter.
Since the CPU data path layout is given to you, you can focus on the instruction decoding to generate all of the control signals. You certainly could do a truth table, but I sure would not want to. A fully enumerated truth table would have eighteen inputs (sixteen from the instruction and two from the ALU flag bits) yielding over 260,000 rows. You would also have numerous outputs of your truth table. So don't go down that rabbit hole.
The better way is to pick one of the control signals that needs to be generated, study what the functional purpose of that signal is, and then design the logic to generate that signal given a particular instruction (and, in some cases, the ALU outputs).
By functional purpose, I mean that while a particular signal might go to a Mux, it's functional purpose is not just to select which of the two input signals appears on the output of that Mux. What does it accomplish in the context of the CPU? Describe it succinctly in words. For instance, you might say that a particular control signal chooses whether the data from the A register or the M register (the data and the currently addressed RAM location) is given to the Y input of the ALU.
The next step is to take that description and write it in terms of what that signal needs to be in terms of the instruction (and whatever else might be needed). At that point you are in a pretty good position to design the logic to make things happen correctly.
|