Coolquest, Inc. | Home | Products | Support | About | Contact | |||
|
<<< Previous | CBOLD Reference Home | Next >>> |
To create a design, the designer derives new classes from the CBOLD base classes. Below is the skeleton of a user–defined module:
class CM_MyModule : public TModule { public: // instantiate member bundles, ports, modules and parts here virtual void Register() { // this mandatory function registers all members with the CBOLD framework // register member bundles, ports, modules and parts here } virtual void Connect() { // this mandatory function makes connections internal to the module // make all connections here } }; // the semicolon is required!
The above declaration states that the new class CM_MyModule is derived from the existing class TModule. The keyword "public" in the first line is required to maintain public access to members of TModule. The keyword "public" in the second line is required to allow public access to the members declared after the keyword. The importance of virtual functions is discussed in the C++ Primer. The CBOLD framework automatically calls all of the design's Register() and Connect() functions during the respective passes of the main() function.
The Register() function provides CBOLD with information about each port, module and part member. Although this is the primary purpose of Register(), the function may be used for additional processing. See Additional Processing in Register() for examples.
Several CBOLD macros ease registering as shown in the following table reproduced from the Registering Macros section.
Macro | Description |
---|---|
reg( aName ) |
registers a single member with a simple designator (no Number) |
regn( aName, aNumber ) |
registers a single element of an array member with a full designator (string + Number) (rarely used) |
rega( aName, aCount ) |
registers each element of an array member |
regb( aName, aL, aR ) |
registers a bus port (with left and right range) with a simple designator |
regab( aName, aCount, aL, aR ) |
registers each element of an array of bus ports (with left and right range) |
A runtime error results if user code attempts to make a connection to a non-registered member.
At first, you should register members manually, just to become familiar with the process. Eventually, you should use the auto_reg Support Tool to automate the process of registering members.
<<< Previous | CBOLD Reference Home | Next >>> |
Legal | Copyright © 2007 by Coolquest, Inc. | Contact |