CRC

This document presents the CRC analysis of the classes used for logic simulation. It presents a detailed description of the class messages and instance variables for each class. Since any logic circuit is setup as a graph of components, where each component is not merely a node in a graph. There are certain rules by which this graph is constructed. No component can arbitrarily connect to any other component. These rules must be inforced for correct and predictable simulation of the circuit. These rules are listed below:
  1. No two output terminals can be connected together.
  2. No two input terminals can be connected together.
  3. Two unconnected nodes cannot be connected to each other.
  4. All other connections are permitted.
These constraints are enforced by the GUI.

Class Component

Derived from

Object

Description

Abstract base class to model a generic component with 'n' input terminals and 'm' output terminals. The 'n' input terminals are logically maintained as a dependency list of size 'n'.  These are references to the 'n' components and their respective terminals that feed their output signal to this component. The set of 'm' output terminals are each lists of dependent components that this component fans out to.
Functions action: and evaluateTerminal: are subclass responsibilites.

Class Variables

Instance Variables

Messages

  • evaluateTerminal: anOutputTerminalIndex

  • Evaluates the value of the terminal referenced by 'anOutputTerminalIndex'. This function implements the logical expression of the gate or its truth table which ever is applicable. This a purely virtual function and it is the duty of the derived class to implement this function.
  • changeTerminal: anInputTerminalIndex to: aTristateValue

  • This message implements the dependency mechanism. On receiving a change message from any component for which it itself is a dependent, it must recompute its mapping functions. If the result of this function changes any of its outputs, then it informs, specifically those dependents of the change. This is performed recursively. This function also verifies with the help of the semaphore, if the simulation has entered an inconsistent loop, in which case it reports the exception to the GUI. In addition this method calls the action method of component to do something if a change has occured at any of the output terminals.
  • action: anOutputTerminalIndex

  • This is a purely virtual function and is a subclass responsibility.
  • reset

  • This messages resets all Terminal values (viz. anArrayOfInputTerminalValues and anArrayOfOutputTerminalValues) to undefined (which is the tristate).
  • connectTerminal: aTerminalIndex toTerminal: anotherTerminalIndex ofComponent: aComponent

  • This message is sent by the GUI to establish the dependency of terminals of one component on terminals of another component. It is not clear as to whether this message should inforce some of the rules. If it does then it will return a succeed or fail value depending on whether the connection is valid or not.
  • disconnectTerminal: aTerminalIndex toTerminal: anotherTerminalIndex ofComponent: aComponent

  • Performs the reverse operation of connectTerminal:toTerminal:ofComponent.
  • valueOfTerminal: aTerminalIndex

  • Returns the tristate value of the output terminal aTerminalIndex.

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class Output

    Derived from

    Component

    Description

    Intended to model an LED. This componet has just one input terminal and no output terminals. numberOfInputs=1, numberOfOutputs=0.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class Input

    Derived from

    Component

    Description

    Intended to model a switch. This component has just one output terminal and no input terminals. numberOfInputs=0, numberOfOutputs=1.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class And

    Derived from

    Component

    Description

    Models an 'and' gate. numberOfInputs=2, numberOfOutputs=1.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class Or

    Derived from

    Component

    Description

    Models an 'or' gate. numberOfInputs=2, numberOfOutputs=1.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class Not

    Derived from

    Component

    Description

    Models a 'not' gate.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class Node

    Derived from

    Component

    Description

    Models a junction or node in circuit analysis. numberOfInputs=1, numberOfOutputs=1.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomView, ComponentCustomController.

    Class Circuit

    Derived from

    Component

    Description

    Models a black box component which is constructed with other components. This class holds a collection of components that are dependent on each other.

    Class Variables

    Instance Variables

    Messages

    Collaborators

    ComponentCustomController, ComponentCustomView.