DLX MultiCycle Implementation (Part 2): Due March 6th at Class Time



Introduction

You are to extend the DLX MultiCycle Implementation to include the JALR,JAL, JR instructions. You are also to modify the control so that the branch delay slot is implemented. This will affect all branches and jumps.

Set Up

You are to use the same files you did for the previous simulation. Copy the following files:


  cp ~reese/EE4713/j_test.s  vhdl/src/mcyc_test.s
  cp ~reese/EE4713/j_test.obj   vhdl/src/mcyc_test.obj

This will overwrite the current 'mcyc_test.s', 'mcyc_test.obj' files with 'j_test.s' and 'j_test.obj'. The 'j_test' program will test your implementation of the JAL,JALR,JR instructions and the branch delay slot. The VHDL configuration 'cfg_mcyc_test' will load the 'mcyc_test.obj' file on startup. To run this configuration, do:
 qhsim -lib ../obj/qhdl/dlxmcyc cfg_mcyc_test
The correct register values at the end of the simulation are specified in 'mcyc_test.s'.

Tips

You may want to implement the branch delay slot FIRST since any code you add to implement the JR/JALR/JAL instructions will be affected by this. Your basic approach to implement the branch delay slot should be the following:

  1. In the current implementation, the PC is modified during the execute state of the change of control instructions. The PC is modified by loading it from either the branch address register or jump address register. You will need to change this so that the PC is NOT modified (remains at PC+4); instead, cause a flag (one or more flip-flops) to be modified to remember that a change of control has to take place. Call this flag the PC_MOD (PC modify) flag.
  2. In the decode stage, you need to check the PC_MOD flag. If it is set, then the PC must to be loaded with a new value. Be sure to clear the PC_MOD flag after you have checked it. This process will ensure that the PC will not be modified with the new jump or branch address until the decode stage of the next instruction; thus the instruction in the branch delay slot will always be executed.
To implement your 'flag' flip-flop(s) in VHDL, look at how the 'state' flip-flops are implemented and follow the same procedure. You would need to declare signals called 'pc_mod_nstate' and 'pc_mod_pstate', and use them in the same manner as the 'nstate_fsm', 'pstate_fsm' signals are used.

You can use the old 'acid_test.s' file to test the basic functionality of the branch delay slot code. You may want to modify the 'acid_test.s' file to put some meaningful instructions in the branch delay slots. Remember, you have to execute:

     dlx2obj.branch acid_test.s
to update the 'acid_test.obj' file if you make modifications to the 'acid_test.s' file. You should always verify that any changes you make to the '.s' files work as expected in 'dlxsim' BEFORE running 'dlx2obj.branch'.

Extending the datapath to handle 'jr', 'jalr', 'jal' instructions is fairly straightforward. It WILL require modification of 'dlx.vhd' in addition to 'control.vhd'.

To Turn In

You must turn in a short, typed report that discusses the changes you made to both the DATAPATH and the CONTROL logic. Include an abbreviated finite state diagram for your control. It is not necessary to show all of the signals in your FSM; simply write a short description of what each state does and show the flow between states. Pay particular care to the states used for the instructions which you added in this simulation. I also want a datapath diagram with highlights that show what you added to support the new instructions. It is not necessary to turn in hardcopy of your code. You must also perform the following submission procedure for your code:

  1. Create a directory called 'sim4'.
  2. Copy ONLY the vhdl files which you have modified to this directory.
  3. Put a README file in the 'sim4' directory which tells me the status of your simulation (working or not working, if not working, then describe what is broken).
  4. Execute the script '~reese/bin/submit_sim4.sh' from the directory ABOVE the 'sim4' directory (from the current directory, you should be able to see 'sim4' as a subdirectory). This will pack up the contents of the 'sim4' directory and email them to me.
It will NOT be necessary to demo your code to me; I will check it. If I have problems with your code I will contact you.