Class CPU

java.lang.Object
  |
  +--CPU

public class CPU
extends java.lang.Object

The CPU class simulates the central processing unit of a computer. In reality, this class just provides timekeeping and reporting services.

It defines the following constants for use by other classes:


Field Summary
static int ADDRESS_BIT_COUNT
          CPU.ADDRESS_BIT_COUNT is the number of bits in a CPU address.
static int LOGICAL_SIZE
          CPU.LOGICAL_SIZE is the number of bytes in the logical address space of the CPU.
static int PAGE_COUNT
          CPU.PAGE_COUNT is the number of pages in a task's logical address space.
 
Method Summary
static int getCurrentTime()
          CPU.getCurrentTime() returns the amount of time that the CPU has been running.
static void report(java.lang.String msg)
          CPU.report(msg) issues a report with content msg.
static void tick()
          CPU.tick() simulates a CPU clock cycle, adding 1 to the current time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADDRESS_BIT_COUNT

public static final int ADDRESS_BIT_COUNT
CPU.ADDRESS_BIT_COUNT is the number of bits in a CPU address.

See Also:
Constant Field Values

LOGICAL_SIZE

public static final int LOGICAL_SIZE
CPU.LOGICAL_SIZE is the number of bytes in the logical address space of the CPU.

This definition should not be changed. To change the address size, change the ADDRESS_BIT_COUNT definition.

See Also:
Constant Field Values

PAGE_COUNT

public static final int PAGE_COUNT
CPU.PAGE_COUNT is the number of pages in a task's logical address space.

This definition should not be changed. To change the number of pages, change the LOGICAL_SIZE definition or the MMU.PAGE_SIZE definition.

See Also:
Constant Field Values
Method Detail

getCurrentTime

public static int getCurrentTime()
CPU.getCurrentTime() returns the amount of time that the CPU has been running.


tick

public static void tick()
CPU.tick() simulates a CPU clock cycle, adding 1 to the current time.


report

public static void report(java.lang.String msg)
CPU.report(msg) issues a report with content msg.