Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Build the Decoder / controller At this point you have a lot of the basics that you need to start testing. You will need to

Build the Decoder/controller
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 16 bits. Look at figure 7.11 in your book. You will need a mux to choose between the immediate value and the RD2 output as the B source for the ALU. Dont worry about the mux driving the A2 input, that can be implemented in your decoder/controller.
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 7.2, 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 decoder/controller. This will have an input for the instruction word, i.e., 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 decoder/controller 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 1, 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 A3, the write port of your three-port register file. Finally, the bottom 12 bits provide the signed 12-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 WD3 input on the register file. You could just route the immediate value back to the WD3 input, however, for other instructions you will often want to route other registers back to the WD3 input. You will also need to enable writing on the register file by bring the WE3 input high. For now, you can just connect B to the WD3 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 WD3.
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 7.1-7.3 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 1 to adapt the books advice and methods to this project. Please provided an image of the completed task.
(1) Halt
(1)JMP
IMData 0000000
0000000
(1)MemToReg
(1)FlagsToReg
(1) BToReg
(1)RegWrite
(1) MemWrite
(1)ALUSrC
(1)FlagWrEn
UUUU
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions

Question

Debate the overexpansion of mental disorders attributed to the DSM.

Answered: 1 week ago