miSim

misim.microchip
Class PIC16X84

java.lang.Object
  |
  +--misim.MachineState
        |
        +--misim.Processor
              |
              +--misim.microchip.PIC16X84
All Implemented Interfaces:
java.lang.Runnable

public class PIC16X84
extends Processor

This extends the Processor class to emulate a complete PIC16F84 microcontroller.


Field Summary
static int EEAddr
           
static int EECon1
           
static int EECon2
           
static int EEData
           
static int Intcon
           
static int Option
           
static int PCLatH
           
static int PIC84_BANK_SIZE
           
static int PortA
           
static int PortB
           
static int TrisA
           
static int TrisB
           
 
Fields inherited from class misim.Processor
programMemorySize, RUN_ACCURATELY, RUN_FAST, RUN_OVER, RUN_SPEED, SETTING_CLOCK, SETTING_FAST_LOOP, SETTING_INTERRUPT, SETTING_RUN_TYPE, STATE_CLEAR, STATE_HALTED, STATE_LOADED, STATE_RUNNING, STATE_STOPPED
 
Fields inherited from class misim.MachineState
aliases, carryBit, chipData, clockListener, clockRate, clocks, CONFIG_CP, CONFIG_DP, CONFIG_OSC4, CONFIG_PWRTE, CONFIG_PWRTEI, CONFIG_WDTE, configStart, decimalBit, deviceId, eepromStart, instructionSet, PACKAGE_DIP, PACKAGE_PLCC, PACKAGE_QFP, PACKAGE_SOIC, PARAM_BANK_SIZE, PARAM_BANKS, PARAM_BIT_CP0, PARAM_BIT_DP0, PARAM_BIT_FOSC0, PARAM_BIT_FOSC1, PARAM_BIT_PWRTE, PARAM_BIT_PWRTEI, PARAM_BIT_WDTE, PARAM_CONFIG_ADDR, PARAM_CONFIG_START, PARAM_CONFIG_WORD, PARAM_DATA_SIZE, PARAM_DEVICES, PARAM_EEPROM_SIZE, PARAM_EEPROM_START, PARAM_ID_ADDR, PARAM_ID_SIZE, PARAM_ID_WIDTH, PARAM_INSTR_WIDTH, PARAM_PACKAGES, PARAM_PINS, PARAM_PROG_SIZE, PARAM_STACK_SIZE, pc, regOffset, regs, RESET_AS_PROGRAMMED, RESET_MCLR, RESET_POWER_UP, RESET_WATCHDOG, sleep, stack, stackPtr, trisBankOffset, w, wdTimer, zeroBit
 
Constructor Summary
PIC16X84(SettingsGroup settings, java.lang.String deviceName)
          Constructor - create the given device, using the current settings
 
Method Summary
 void enableGlobalInterrupts()
          This is called at the end of the RETFIE instruction, and should re-enable global interrupts.
 java.lang.String getDeviceName(int deviceId)
          Return the names of the devices supported by this processor.
 int getParameter(int paramId, int deviceId)
          Return a given statistic for the given device for this machineState implementation.
 java.lang.String getPinName(int pinNo, int deviceId, int packageType)
          Return the name of the given pin for this device
 int getPortPin(java.lang.String portName, int bitNo)
          Return the pin number that the given port bit is connected to
 void resetRegs(Register[] regs, int resetType)
          Reset all registers to their power-on values
 void setRegisters(Register[] regs, java.lang.String[] regNames, java.util.Hashtable portHash)
          Create and assign the registers that the device implements.
 
Methods inherited from class misim.Processor
addProcessorListener, addressWidth, disassemble, eraseAll, fastLoop, getConfig, getCpuSpeed, getDataSize, getMemSize, getRunType, getState, interruptOnStep, isAddressValid, loadBinary, optimise, overPic, readInstruction, removeProcessorListener, reset, resetData, run, runAccurately, runFastest, runOver, runPic, runToSpeed, setConfig, setEeprom, setFastLoop, setInterruptOnStep, setPC, setRunType, setState, startThread, stepPic, stopThread, validateAddress, writeData, writeInstruction
 
Methods inherited from class misim.MachineState
addClockListener, addPortListener, addPortListener, addResetListener, addressName, disassemble, eraseEeprom, getAliases, getAvailablePorts, getClockRate, getClocks, getDeviceId, getInstructionSet, getNewInstruction, getNthRegAddress, getNthRegName, getParameter, getPC, getPort, getReg, getTicks, getW, isNamed, namedRegisters, regChar, regName, regString, removeClockListener, removePortListener, removeResetListener, resetMachine, setAddresses, setAddressName, setAliases, setClockListener, setClockRate, setClocks, setInstructionSet, setReg, setRegName, setW, validReg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PortA

public static final int PortA

PortB

public static final int PortB

EEData

public static final int EEData

EEAddr

public static final int EEAddr

PCLatH

public static final int PCLatH

Intcon

public static final int Intcon

Option

public static final int Option

TrisA

public static final int TrisA

TrisB

public static final int TrisB

EECon1

public static final int EECon1

EECon2

public static final int EECon2

PIC84_BANK_SIZE

public static final int PIC84_BANK_SIZE
Constructor Detail

PIC16X84

public PIC16X84(SettingsGroup settings,
                java.lang.String deviceName)
         throws MiSimException
Constructor - create the given device, using the current settings
Parameters:
settings - The settings group for the processor
deviceName - The name of the specific device required
Throws:
MiSimException - if the device name is not supported
Method Detail

getParameter

public int getParameter(int paramId,
                        int deviceId)
Return a given statistic for the given device for this machineState implementation. The ID is given by one of the PARAM_ constants defined in this class. If the parameter has no defined value, this method returns -1
Overrides:
getParameter in class MachineState
Parameters:
paramId - The identifier for the required statistic
deviceId - The ID for the device being examined
Returns:
The requested value

getDeviceName

public java.lang.String getDeviceName(int deviceId)
Return the names of the devices supported by this processor. The number of devices supported can be discovered by calling getParameter( PARAM_DEVICES ). This method can then be called with the index of the device requested, and the name will be returned. If the id is out of range (the processor doesn't support that many devices) this method returns null.
Overrides:
getDeviceName in class MachineState
Parameters:
deviceId - The Index of the device name required
Returns:
The requested device name, or null

getPinName

public java.lang.String getPinName(int pinNo,
                                   int deviceId,
                                   int packageType)
Return the name of the given pin for this device
Overrides:
getPinName in class MachineState
Parameters:
pinNo - The pin number being requested
deviceId - Which specific device is being considered
packageType - The package type, eg. PACKAGE_DIP
Returns:
The name of that pin for the device

getPortPin

public int getPortPin(java.lang.String portName,
                      int bitNo)
Return the pin number that the given port bit is connected to
Overrides:
getPortPin in class MachineState
Parameters:
portName - The name of the required port
bitNo - The bt number for the port
Returns:
The pin number, or -1 if that port/bit is not connected to a pin

setRegisters

public void setRegisters(Register[] regs,
                         java.lang.String[] regNames,
                         java.util.Hashtable portHash)
Create and assign the registers that the device implements. This includes any port registers. The arrays and hashtable passed to this method should be populated by the appropriate data.
Overrides:
setRegisters in class MachineState
Parameters:
regs - The memory space to populate with registers
regNames - An array of the names of each register
portHash - A hashtable mapping the (String) port name to the (Port) object itself

resetRegs

public void resetRegs(Register[] regs,
                      int resetType)
Reset all registers to their power-on values
Overrides:
resetRegs in class MachineState
Parameters:
regs - The register array to reset

enableGlobalInterrupts

public void enableGlobalInterrupts()
This is called at the end of the RETFIE instruction, and should re-enable global interrupts.
Overrides:
enableGlobalInterrupts in class MachineState

miSim