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

<<< Previous CBOLD Reference Home Next >>>

 

11.2.3.2. AR_INCL

The AR_INCL directive can be used to insert arbitrary lines in Register(). The lines are inserted after any existing user lines in Register() but otherwise in the order encountered with respect to other AR_INCL lines and members that are auto registered.

AR_INCL can be used to add comments to Register(), to conditionally register members, to call member functions of modules that are auto registered, etc. For example:

class CM_LVDS_Repeater : public TModule {      // wrapper for SN65LVDS100D buffer/repeater
  bool          AC_CoupleUsed;
public:
  void          UseAC_Couple(){ AC_CoupleUsed = true;  }  // user may override default
  CM_LVDS_Repeater() {          AC_CoupleUsed = false; }  // default behavior in constructor
  ...
 
// AR_INCL // member ports
  port              IN;              // AR_BUS(1,0)  differential pair
  port              OUT;             // AR_BUS(1,0)  differential pair
  port              VCC3_3;
  port              GND;
 
// AR_INCL // member modules and parts
  CP_SN65LVDS100D   Repeater;
  CP_CDC_POS        CDC;
 
// AR_INCL if ( AC_CoupleUsed ) {
  CP_R49_9P1          Rterm50_[2];   // two-resistor terminator to Vtt
  CP_C603_220NF       AC_Couple[2];  // DC blocking capacitors
// AR_INCL } else {
  CP_R100P1           Rterm100;      // differential terminator
// AR_INCL }
 
  virtual void Register() {
    // member ports                   // auto_reg
    regb( IN, 1, 0              );    // auto_reg
    regb( OUT, 1, 0             );    // auto_reg
    reg(  VCC3_3                );    // auto_reg
    reg(  GND                   );    // auto_reg
    // member modules and parts       // auto_reg
    reg(  Repeater              );    // auto_reg
    reg(  CDC                   );    // auto_reg
    if ( AC_CoupleUsed ) {            // auto_reg
    rega( Rterm50_, 2           );    // auto_reg
    rega( AC_Couple, 2          );    // auto_reg
    } else {                          // auto_reg
    reg(  Rterm100              );    // auto_reg
    }                                 // auto_reg
  }
 
  virtual void Connect() {
  ...
  }
};

In the example above, a module that has a CM_LVDS_Repeater as a member must call CM_LVDS_Repeater:: UseAC_Couple() before it registers the member if it wants to use the AC coupling option. AR_INCL can again be used to simplify this task:

class CM_MyModule : public TModule {  // example module using LVDS repeaters
public:
 
// AR_INCL // member ports
...
 
// AR_INCL // member modules and parts
  CM_LVDS_Repeater   RepeaterDC;   // DC-coupled receiver
// AR_INCL RepeaterAC.UseAC_Couple();
  CM_LVDS_Repeater   RepeaterAC;   // AC-coupled receiver
 
  virtual void Register() {
    // member ports                   // auto_reg
    ...
    // member modules and parts       // auto_reg
    reg(  RepeaterDC            );    // auto_reg
    RepeaterAC.UseAC_Couple();        // auto_reg
    reg(  RepeaterAC            );    // auto_reg
  }
 
  virtual void Connect() {
  ...
  }
};

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact