jbreadboard.v1_00
Interface ChipModel


public interface ChipModel

The interface for implementing Chips for the Java BreadBoard Simulator.  When implementing the simulate method you will have access to the useful methods in 
ChipAccess.

For the ChipModel to be recognised by the program it must be in package chips, and can then be placed in the chips folder.   If the model requires other classes these do not have to be in the chips package but will need to be placed relative to the parent of the chips folder.

Examples:
SN7400.java, SN7470.java

Much of the code for the chip models can be easily copied from the above example files.


Method Summary
 void setAccess( jbreadboard.ChipAccess a)
          Sets the chip access object for access to useful methods
 void simulate()
          Invoked when input changes in simulation.
 void reset()
          Invoked when the simulation is reset.
 String getChipText()
          Returns the text to display on top of the chip.
 String getDescription()
          Returns the description of the chip for the information pane.
String
getManufacturer ()
          Returns the name of the chip's Manufacturer.
String
getDiagram ()
          Returns the filename for the pinout diagram.
int
getNumberOfPins ()
          Returns the number of pins on one side of the chip
boolean
isWide()
          Returns true if this chip is wide.
String
getPinType (int pin)
          Returns the type of the selected pin.
String[]
getDerivatives ()
          Returns an array of the different chip derivatives. eg SN5400, SN54LS00, SN54S00
int
getDerivative ()
          Returns the index of the selected derivative.
String[]
getPackages ()
          Returns an array of the different chip packages available for the selected derivative.
int
getPackage ()
          Returns index of the selected package.
void
setDerivative (int d)
          Sets selected derivative index.
void
setPackage (int p)
          Sets selected package index
 

Method Detail

setAccess

public void setAccess(jbreadboard.ChipAccess a)
The ChipAccess Object will be passed to the chip model after creation.  It provides useful methods to the chip model such as reading and writing to pins.


simulate

public void simulate()
The method called by the simulation routine when the signal on a pin with type IN, IO or CLO changes.


reset

public void reset()
Called when the simulation is reset.  Useful for clearing internal state variables if there are any.


getChipText

public String getChipText()
Should return the text to appear on top of the chip.


getDescription

public String getDescription()
Should return a brief description of the chip.


getManufacturer

public String getManufacturer()
Should return the Chip Manufacturers name.


getDiagram

public String getDiagram()
Should return the file name for a diagram that displays the functions of the chips pins.  The diagram itself should be a gif file and be placed in the chips directory with the class file for the chip model.


getNumberOfPins

public int getNumberOfPins()
Should return the number of pins down one side of the chip.  ie. for a SN7400 the number returned is 7.


isWide

public boolean isWide()
Returning true will cause the method that draws the chip to make it a "wide" chip 48 pixels high instead of the usual 32.


getPinType

public String getPinType(int pin)
Should return the type of the pin in the parameter.  Pins are labelled starting at zero, numbered across the bottom of the pin from left to right then back across the top from right to left.
Valid Types are:
        NC - Not Connected
        IN - Input
        IO - Input and Output
        OCO - Open Collector Output
        CLO - Clocking output eg the outputs on a clock.
        OUT - Ouput type.
Devices with outputs that can be enabled and disabled should probably return IO for those pins.
If an invalid pin type is returned it will get treated as if it were not connected.

getDerivatives

public String[] getDerivatives()
Should return an array of derivatives for that chip eg for the 7400, {"SN5400","SN54LS00","SN54S00","SN7400","SN74LS00","SN74S00"} is returned.
This array should have at least one entry.


getDerivative

public int getDerivative()
Should return the index of the currently selected derivative.


getPackages

public String[] getPackages()
Should return an array of packages for the selected derivative eg with SN5400 as the derivative {"J","W"} will be returned.


getPackage

public int getPackage()
Returns the index of the currently selected package.


setDerivative

public void setDerivative(int d)
Sets the selected derivative index.


setPackage

public void setPackage(int p)
Sets the selected package index.