Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Start building the Decoder / controller At this point you have a lot of the basics that you need to start testing. You will need
Start building the Decodercontroller
At this point you have a lot of the basics that you need to start testing. You will need to add a sign extender to sign extend the immediate values to bits. Look at figure in your book. You will need a mux to choose between the immediate value and the RD output as the B source for the ALU. Dont worry about the mux driving the A input, that can be implemented in your decodercontroller
It has to be said that its not really possible to just drop pieces in and expect it to all work the first time. At this point you will want to add a basic decoder controller, but, dont try to develop it all at once. Think about how to decode each instruction and then determine how these choices will cause data to be routed in various places in the Datapath. Take a look at table the main decoder truth table. Some things are different with your CPU, for example, you only have one type of immediate data so there is no need to have an ImmSrc output from the controller.
So at this point you will want to start fleshing out your decodercontroller This will have an input for the instruction word, ie the Instruction Memory data bits. It will also have an input for your latched flags as you will need those for conditional jumps. Dont worry too much about that at this point. You will not finish this block now. In fact, you will be working on this block until the end of the project. You will add outputs as needed and will most likely refactor the internals several times as you realize that your Datapath needs adaptation. Dont be afraid to temporarily hardwire bits of the instruction word in order to test external elements. Then, when youre sure that your other elements are correct, make changes in your decodercontroller to merge the newly debugged instructions with the existing instructions.
What you want to start doing is building just what you need for specific instructions and then start testing each instruction. The best instruction to start with is the MOV Rd Immediate. This will move an immediate value into any register and thus will set you up for testing your ALU among other things.
Implementing MOV Rd Imm
Take a look at the main decoder table in the Appendix. You will see that there are eight total instructions to move an immediate value into a register. However, you should take note about how easy these are to decode. They are the only instructions in the instruction set where the most significant bit is one. This means that if the MSB is then you are processing one of these instructions. If its not one, then you have something else. The next three bits determine the register that data will be written into, in other words, they will provide the address for A the write port of your threeport register file. Finally, the bottom bits provide the signed bit immediate value.
So you will need to use the bit that tells you that youre processing one of these instructions to route the output of the immediate instruction into the B input of the ALU. Your book uses ALUSrc for this. Then also, you will want to route that B output back in the WD input on the register file. You could just route the immediate value back to the WD input, however, for other instructions you will often want to route other registers back to the WD input. You will also need to enable writing on the register file by bring the WE input high. For now, you can just connect B to the WD input later you will need to use another MUX here so that the output of data memory, or the flags, can also be routed back into WD
If you have wired this up correctly, you should be able to execute a MOV Rd Imm instruction and you should see the immediate value on the B ALU display on the front panel. Do not proceed further until you get this working. This is the only instruction that I will describe completely. It is important that you understand this basic development cycle before moving on You may ask me almost any directed questions about this specific instruction and I will answer it unambiguously. Consider it your training instruction.
Implementing the ALU operations
After you get the MOV Rd Imm instruction working, your next step will be to get all of the ALU instructions working. These are also simple to decode as the top three bits are the same for all ALU functions, and the next four bits determine the ALU function. As you develop more of your CPU it will start to look very similar to the structure presented in of your textbook. There are a number of differences owing to the differences between the books implementation of a simple CPU and disARM. You will want to read the book carefully along with Appendix to adapt the books advice and methods to this project.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started