Chapter 4 Notes

Microarchitecture Level

IJVM (microarchitecture) contains a microprogram to fetch, decode, and execute IJVM instructions.

public class Interp {
  static int PC; 		// program counter holds address of next instr
  static int AC; 		// the accumulator, a register for doing arithmetic
  static int instr; 		// a holding register for the current instruction
  static int instr3type; 	// the instruction type (opcode)
  static int data3loc; 		// the address of the data, or −1 if none
  static int data; 		// holds the current operand
  static boolean run3bit = true; // a bit that can be turned off to halt the ma

  public static void interpret(int memory[ ], int starting3address) {
   // This procedure interprets programs for a simple machine with instructions
   // one memory operand. The machine has a register AC (accumulator), used
   // arithmetic. The ADD instruction adds an integer in memory to the AC, for e
   // The interpreter keeps running until the run bit is turned off by the HALT ins
   // The state of a process running on this machine consists of the memory, the
   // program counter, the run bit, and the AC. The input parameters consist of
   // of the memory image and the starting address.
	PC = starting3address;
	while (run3bit) {
		instr = memory[PC]; // fetch next instruction into instr
		PC = PC + 1; // increment program counter
		instr3type = get3instr3type(instr); // determine instruction type
		data3loc = find3data(instr, instr3type);// locate data (−1 if none)
		
		if (data3loc >= 0) // if data3loc is −1, there is no operand
			data = memory[data3loc]; // fetch the data
		execute(instr3type, data); //execute instruction
	}
  }

  private static int get3instr3type(int addr) { ... }
  private static int find3data(int instr, int type) { ... }
  private static void execute(int type, int data){ ... }
}

Fig. 2-3. An interpreter for a simple computer (written in Java). Tannenbaum.

Data Path

ALU Operations

bulletF0 and F1 determine ALU operation
bulletENA, ENB individually enable the inputs
bulletINVA, invert left input
bulletINC force a carry into low-order bit

Data Path Timing

bulletSet up data path signals
bulletDrive H and B bus
bulletALU and shifter work
bulletResults move along C bus to registers
bulletRising edge of next clock cycle, load registers (register driving B bus stops)

Memory Operation

bullet32 Bit memory port
bulletMAR - memory address register - Word addresses
bulletMDR - memory data register
bullet8 Bit port
bulletPC - Byte addresses
bulletMBR (low order 8 bits) read only from memory
bulletMBR can be copied onto the B bus either as a signed or unsigned value.

Microinstructions

bullet29 signals to control the data path
bullet9 to control writing from C bus into registers
bullet9 to control copy from registers onto B bus
bullet8 to control the ALU and shifter functions
bullet2 to indicate read/write via MAR/MDR
bullet1 to indicate memory fetch via PC/MBR
bulletMemory read operations start at the end of a cycle, the memory is loaded on the next cycle and available in the cycle(s) after that.
bullet4 bits needed  to control B bus (9 signals, 7 wasted)

bullet24 bits to control the data path
bulletAddr / JAM - Address of potential next microinstruction / How it is selected

Sequencer information

bulletState of every control signal
bulletAddress of next microinstruction

Control Store

bullet512 Words, each one a 36 bit microinstruction
bulletInstructions are not in sequential order
bulletMPC - MicroProgram Counter (really just a pointer, not a counter)
bulletMIR - MicroInstruction Register (hold the current micro instruction)

Operation

bulletMIR is loaded from the word in the control store pointed to by MPC
bulletSignals propagate out. A register is put on the B bus, ALU knows what operation.
bulletALU, N, Z, and shifter outputs are stable
bulletLoad the registers and N, Z flipflops
bulletAll the resluts have been saved and the results of the previous memory operations are available and the MPC has been loaded

Calculation of the next micro-instruction

bullet9 bit Next-address field is copied to MPC
bulletIf one or more JAM bits are 1, more work is needed
bulletJAMN is set - N flip-flop is ORed with high bit of MPC
bulletJAMZ is set - Z flip-flop is ORed there
bulletJMPC is set - 8 MBR bits are ORed with the low-order bits of the Next address field, this allows an efficient multiway branch to any of 256 addresses

MIC Improvements
 
bulletBasic appproches:
bulletReduce the number of clock cycles needed to execute an instruction (Path length)
bulletMerge the interpreter loop into the microcode
 
bulletSimplify organization so clock cycle can be shorter
bulletGo from a 2 bus to a 3 bus design
 
bulletOverlap the execution of instructions
bulletHave instructions fetched from memory by a specialized functional unit
 
bulletPipelining
bullet4 instructions executing simultaneously. More cycles per instruction but
a new one started and finished each cycle.
 
bulletImproving performance
bulletCache Memory
bulletSplit (data/instruction cache)
bulletMultilevel
bulletSpatial locality - fetch more data than is needed
bulletTemporal locality discard least recently used entries
bulletCache lines : valid / tag / data
bulletBranch Prediction
bulletOut-of-order execution with register renaming
Secret registers allow overlapped / out-of-order execution
bulletSpeculative execution