next up previous contents
Next: Examples Up: Describing Hardware Previous: Describing Hardware

The Method

The technique used to describe hardware can be outlined in six major steps:

  1. Identify the internal circuit elements of the component. After the end of this step, one should have I input ports, O output ports, S subcomponents and W wires.
  2. Create a class for the component. Make sure that this class is derived from Component so that it will inherit all the features of this base class. The parameters passed to the constructor of the class should include I + O references to connector objects, a parameter for the delay of the component and a parameter for the name of the component. The constructor should be in the public part of the class. The elements identified above should be encapsulated within the class. Keeping them in the private portion of the class prevents the relationships amongst the wires, subcomponents and ports from becoming corrupt by something from outside the class.
  3. Connect primary inputs and outputs. When defining the constructor, calls are made to the I + O port constructors. This expresses the connectivity between the ports of the component and the connectors of the external environment. This will have the effect of connecting the I/O ports with the primary inputs and outputs of the circuit. Calling the I/O port constructors also has the effect of placing the ports in their respective linked lists. This is hidden from the user. It is often useful to disguise the call to the port constructors by using a CONNECT macro:

        #define CONNECT(Port, Wire, name)    Port(this, Wire, name)
  4. Call the W constructors for the wires. This will bring the wires into existence and place an initial value on each wire.
  5. Construct each of the S subcomponents. One important point to remember when constructing the subcomponents is to pass only the wires and ports that are declared within the component class to the subcomponent constructors. If the external connectors passed to the encompassing component constructor are passed to the encapsulated subcomponents, then the designer may risk corrupting the description.
  6. Create I + O external wires, and instantiate the component. This is usually done in the main() program of the C++ code. The external wires act as signal sources when hooked up to an input port. When connected to an output port, they act as signal destinations.

next up previous contents
Next: Examples Up: Describing Hardware Previous: Describing Hardware

Donald Craig
Sat Jul 13 16:02:11 NDT 1996