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

<<< Previous CBOLD Reference Home Next >>>

 

8.2. Assigning Reference Designators

If a design uses hierarchical reference designators, the designer must set reference bases. You typically do this in the Register() function of CM_Root. Here is an example from the IROD design:

class CM_Root : public TRootModule {
  ...
  virtual void Register() {
      //    subsystem                                     reference base
      // ---------------                                        --
    reg( Backplane       );  Backplane.SetReferenceBase(       "BK" );
    reg( ClockGeneration );  ClockGeneration.SetReferenceBase( "CG" );
    reg( DataExchange    );  DataExchange.SetReferenceBase(    "DX" );
    reg( DPU_Control     );  DPU_Control.SetReferenceBase(     "DC" );
    reg( FrontPanel      );  FrontPanel.SetReferenceBase(      "FP" );
    reg( Half_A          );  Half_A.SetReferenceBase(          "A"  );  // see CM_HalfROD for more ReferenceBase's
    reg( Half_B          );  Half_B.SetReferenceBase(          "B"  );
    reg( Host            );  Host.SetReferenceBase(            "HO" );
    reg( Interconnect    );  Interconnect.SetReferenceBase(    "IC" );
    reg( JTAG            );  JTAG.SetReferenceBase(            "JT" );
    reg( Power           );  Power.SetReferenceBase(           "PW" );
    reg( VME_Interface   );  VME_Interface.SetReferenceBase(   "VM" );
  }
 
  virtual void Connect() { ... }
};

Reference bases are applied hierarchically, affecting all parts at lower levels of the hierarchy. For example, all parts within the ClockGeneration module, including those in any member modules of CM_ClockGeneration, will be assigned a Base of "CG". If the user were to specify a reference base for a member module of ClockGeneration, e.g., "B", then all parts in that module and below it in the hierarchy would be assigned a Base of "CGB".

In the ClockGeneration example, automatic assignment of reference designator Numbers for the CG Base begins at 1. Likewise, automatic assignment of Numbers begins with 1 for the CGB Base. For example, if there are three resistors having Base CG and two having Base CGB, their reference designators would be CGR1, CGR2, CGR3, CGBR1, and CGBR2.

Naturally, long reference designators can become unwieldy, so hierarchical Reference Base's should be used sparingly. In some cases, however, a multi-part Reference Base is appropriate. Consider the two CM_HalfROD instances in the example above. "A" and "B" are specified as the Reference Bases for Half_A and Half_B. Each CM_HalfROD contains a member array of six CM_DPU modules. In CM_HalfROD, a character between '0' and '5' is specified as the Reference Base for each CM_DPU in the array. This results in the following Base assignments for the twelve CM_DPU's in the design:

A0, A1, ... A5 Bases for Half_A DPU's
B0, B1, ... B5 Bases for Half_B DPU's

This code is further annotated in the in the IROD Example Design.

The actual assignment of reference designators is performed in main() after the Register pass:

int main( int argc, char* argv[] ) {
  ...
  Log << "Assigning reference designators";
 
// read in previously assigned designators, if any
#if 1
  ifstream DSrce;
  OpenFileI( DSrce, DESIGN_NAME "_old_designators.txt" );
  Root.ReadReferenceDesignators( DSrce );
  DSrce.close();
#endif
 
  Root.AssignReferenceDesignators();
  Root.CheckReferenceDesignators();                  // check for duplicates
 
#if 1    // >>> write out all designators before layout commences
// write out designators for possible future use
  ofstream DDest;
  OpenFileO( DDest, OUTPUT_BASE "_new_designators.txt" );
  Root.WriteReferenceDesignators( DDest );
  DDest.close();
#endif
  ...
}

AssignReferenceDesignators() descends through the design hierarchy assigning reference designators based on:

1. manual assignments, if any, that ReadReferenceDesignators() read from a designator text file
2. reference bases specified by the designer via calls to SetReferenceBase(), if any
3. reference prefixes specified in part classes, typically from the associated part text file

The function CheckReferenceDesignators() checks that there are no duplicate reference designators. If a duplicate is found, an exception will be thrown as explained in the Error Handling section.

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact