next up previous contents
Next: Describing Hardware Up: The Port Class Previous: The Input and Output

The Port_List Class

The Component class contains a Port_List (a linked list of pointers to ports) in the public section of its class. The Port_List class is almost identical to the Component_List class. As mentioned earlier, this similarity could be exploited using generic types or templates. Since C++ does not yet support templates, some code replication will be necessary.

The constructor and the add() methods are identical to the corresponding methods of the Component_List class with the exception that a pointer to a port rather than a pointer to a component is added to the list. The Port_List class is defined as follows:

class Port_List
        void            add(Port *);
        boolean         inputs_are_ready(ckt_time);
        boolean         is_lowest_level();
        void            descend();
        Port_Node       *prt_list;

The default constructor is automatically called to initialize I_List and O_List when a Component object is constructed.

The other three methods, inputs_are_ready(), is_lowest_level() and descend() are specific to the simulation of the circuit and not to its description. As such, elaboration upon these methods will be deferred until the next chapter.

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