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

<<< Previous CBOLD Reference Home Next >>>


2.7. Flow of the main() Function

When a CBOLD program is run, main() makes several passes through the design. These passes are clearly visible in the source code of a typical main() as well as in its typical console output:

Registering.... Elapsed time: 0 s.
Connecting.... Elapsed time: 2 s.
Assigning reference designators.... Elapsed time: 0 s.
Filling netlist.... Elapsed time: 2 s.
Cleaning up netlist.... Elapsed time: 0 s.

Each pass completes in its entirety before main() goes on to the next pass. For example, the Register pass descends through the design hierarchy until every module, part, bundle and port is registered. Once this pass completes, main() proceeds to the Connect pass.

The CBOLD framework handles most of the details of the passes. The user code in main() required for implementing the passes is relatively simple. The code from the example CBOLD design can typically be used without modification. For example:

main() {
  CM_Root Root;            // CM_Root is always the highest-level module of a project
  Log << "Registering";
  reg( Root );             // register highest-level module
  Log << "Assigning reference designators";
  ifstream DSrce;          // read in previously assigned designators, if any
  OpenFileI( DSrce, DESIGN_NAME "_old_designators.txt" );
  Root.ReadReferenceDesignators( DSrce );
  Root.CheckReferenceDesignators();        // check for duplicates
#if 1                      // >>> write out all designators before layout commences
  ofstream DDest;          // write out designators for possible future use
  OpenFileO( DDest, OUTPUT_BASE "_new_designators.txt" );
  Root.WriteReferenceDesignators( DDest );
  Log << "Connecting";
  Root.ConnectAll();       // wire up hierarchy
  Log << "Post-Connecting";
  Root.PostConnectAll();   // perform any user-specified post-connect processing

Log is an instance of a CBOLD class that logs progress, including elapsed time, to the console.

In addition to mandatory processing, such as registering and connecting, main() may contain additional processing. For example, main() typically contains calls to CBOLD code that creates a bill of materials, a symbolic netlist, etc. See the Outputs section for examples.


<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact