import java.awt.*; /*********************************************************************** * File: ExtendedControlUnit.java * Aurthor: Dr. Dalton R. Hunkins * Computer Science Department * St. Bonaventure University * Date: 17 January 2006 * * Purpose: * The file is a stub that allows the reader/programmer to extend * the Control Unit within the Data Path Simulator, PathSim, to * handle additional MIPS operators. The extension is accomplished * through adding java code to the method execute. See the lab * instruction comment given below. * * Class Modified by: ***********************************************************************/ class ExtendedControlUnit extends ControlUnit { private DataLine input; private DataLine signal1, signal2, signal3; private DataLine signal4, signal5, signal6; private DataLine signal7, signal8, signal9; private DataPath parent; public ExtendedControlUnit(double x, double y, double w, double h, Color c, String label1, String label2, String name, DataLine input, DataLine signal1, DataLine signal2, DataLine signal3, DataLine signal4, DataLine signal5, DataLine signal6, DataLine signal7, DataLine signal8, DataLine signal9, DataPath parent) { super(x, y, w, h, c, label1, label2, name, input, signal1, signal2, signal3, signal4, signal5, signal6, signal7, signal8, signal9); this.input = input; this.signal1 = signal1; // RegDist this.signal2 = signal2; // Jump this.signal3 = signal3; // Branch this.signal4 = signal4; // MemRead this.signal5 = signal5; // MemToReg this.signal6 = signal6; // ALUop this.signal7 = signal7; // MemWrite this.signal8 = signal8; // ALUsrc this.signal9 = signal9; // RegWrite this.parent = parent; } public void executeAdd(){} public void executePart1() {} public void executePart2(){} public void execute() { int opCode = (int) hexStringToUnsigned(input.getValue()); /***************************************************************** INSTRUCTIONS FOR LAB C Currently, the method is handled by super.execute() as seen by the call written below. Since the parent super does nothing for the opcodes of the extensions to be added, you write your code here for those opcodes (or, at least, for the ones that you are handling). In particular, write your code to handle any (or all) of the following operation codes that is stored in opCoded 8 = 8 -> addi C = 12 -> andi D = 13 -> ori E = 14 -> xori 5 = 5 -> bne But do not forget that the opcodes 0, 2, 4, 35, and 43 must still be handled by an appropriate call(s) to super.execute(); Keep in mind that for your task, you must put appropriate values on each of the 9 control lines this.signal1 through this.signal9. Use the following for the value placed on the ALUop line (this.signal6) addi -> 3 andi -> 4 ori -> 5 xori -> 6 bne -> 7 In carrying out your task, you will use the following method. public void setValue(String value) precondition: value is any String postcondition: value is put on the data line and appears with a mouse click on the line For example, to put 3 on the line this.signal6, we make the call this.signal6.setValue("3"); *********************************************************************/ super.execute(); } }