Coolquest, Inc. Home Products Support About Contact
cbold_logo_gif C++BOLD Reference Manual cbold_logo_gif

<<< Previous CBOLD Reference Home Next >>>

 

7.2. Practical Guide to Connecting

7.2.1. Simple Connections Between Port Ranges
7.2.2. Named Connections
7.2.3. Connections to Bundles
7.2.4. Connections to Two-Port Parts
7.2.5. Compound Connections
7.2.6. The merge() Function
7.2.7. The wireall() Function
7.2.8. The wire() Function
7.2.9. Bundles and the wire() Function
7.2.10. Using the bus() Function

This section demonstrates the several forms of connections available through the CBOLD framework. The forms have the following in common:

1. Connections are made by statements within each module's Connect() function.
2. Connecting statements may only access this module's ports and the ports of this module's member modules, parts and bundles. A violation of this rule results in a runtime error. The rule is more precisely stated as: A module's Connect() may only access ports whose ultimate owner is the module or a member of the module.
3. Width mismatches result in runtime errors (except for merge()). For example, an error results if you attempt to connect an 8-wide port to a 16-wide port.
4. A connection is not required to include a physical part pin. For example, it is legal for a module to connect two of its ports together with no other internal connections to these ports.

While considering the connection examples below, bear in mind that the C++ compiler uses conversion operators in the CBOLD framework to automatically convert ports to equivalent port ranges. So for example, assuming Q and D are both 32-wide ports, the following statements are all equivalent:

Q          << Ram.D;
Q          << Ram.D( 31, 0 );
Q( 31, 0 ) << Ram.D;
Q( 31, 0 ) << Ram.D( 31, 0 );

The statements in the examples below are all assumed to be within a module's Connect() function. Recall that a module definition looks like:

class CM_MyModule : public TModule {
public:
  ...                          // member ports, modules, parts and bundles are   declared here
  virtual void Register() {
    ...                        // member ports, modules, parts and bundles are registered here
  }
 
  virtual void Connect() {
    ...                        // connecting statements go here
  }
};

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact