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

<<< Previous CBOLD Reference Home Next >>>

 

2.3. Creating a New Design

To create a new design, it is best to start by modifying a copy of an existing design:

1. Copy the skeleton subdirectory to a new subdirectory within the cbold directory, and create a new subdirectory for its output. For example, copy the skeleton design directory and all of its contents to the new directory my_design, and create the new directory output/my_design:

/cbold this directory contains all CBOLD source files and all design directories
   /parts this directory contains all part header files
   /skeleton this directory contains the skeleton example design
   /my_design this directory contains your new design
   /output/skeleton output of the skeleton design will be written to this directory
   /output/my_design output of your new design will be written to this directory
   ... all other CBOLD source files

2. In the my_design directory, rename skeleton.cpp to my_design.cpp. Likewise, rename skeleton.h to my_design.h, and rename skel_sub.h to my_sub.h.

3. Follow the directions contained in the special comments in my_design.cpp, my_design.h and my_sub.h. These changes are summarized in the table below.

File Description/Changes
my_design.cpp This file contains the design's main() function. Change #include "skeleton.h" to #include "my_design.h". No other changes to this file are required unless you want to modify output functionality.
my_design.h my_sub.h These files are the main design header file and an example subsystem header file. Follow the directions noted in comments containing the arrow (<===). These comments are reproduced in the code excerpts below.

From skeleton.h (my_design.h):

/*                                                                               *\
    This file is part of the CBOLD(tm) framework for electronic design capture.
                         Copyright (C) 2007 Coolquest, Inc.

      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation; either version 2 of the License, or
      (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License along
      with this program; if not, write to the Free Software Foundation, Inc.,
      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

    For more about the CBOLD framework and Coolquest, Inc., see www.cbold.com.
\*                                                                               */
 
// file skeleton.h:  example skeleton design file
 
#ifndef _skeleton_h_                                  // <=== change these lines to match your file name
#define _skeleton_h_
 
#include "cb_base.h"
#include "cb_shorthand.h"
#include "cb_memo.h"
 
// above:  standard code
// below:  design-specific code
 
// This is the skeleton design main header file.                             <===
// To adapt this file to your design, see comments that contain this arrow:  <===
// See also skeleton.cpp and skel_sub.h.                                     <===
 
// file paths, etc.
#define  DESIGN_NAME  "skeleton"                      // <=== name of design -- used primarily to form file names
//                    dir for all CBOLD output  subdir. for this design   base of file name
#define  OUTPUT_BASE  OUTPUT_PATH DIR_SEP       DESIGN_NAME DIR_SEP       DESIGN_NAME        // concatenation of path and name --> base for output file names
 
// <=== Be sure that directory OUTPUT_BASE exists, otherwise a runtime error will result.
// <=== For the skeleton design, OUTPUT_BASE is cbold/output/skeleton.
// <=== To see/change OUTPUT_PATH, see cb_user_pref.h.
 
// misc. header files, if needed
//#include <locale>                                   // <=== example standard header file
 
// header files needed by many subsystems
#include "decoupling.h"                               // <=== example header file -- be sure the included file's directory is in your compiler's include path
 
// subsystem header files
#include "skel_sub.h"                                 // <=== example subsystem header file -- be sure the included file's directory is in your compiler's include path
 
// ************ subsystems ************               // <=== design summary comment
// subsystem           abbreviation
// ------------        ------------
// Power               PW                             // <=== example subsystem
 
 
class CM_Root : public TRootModule {
public:
// root-level module has no ports
 
// ***** member subsystems ***** //
 
  CM_Power            Power;                          // <=== example subsystem
 
  virtual void Register() {
    reg( Power );  Power.SetReferenceBase( "PW" );    // <=== example subsystem registration with optional setting of reference designator base
  }
 
  virtual void Connect() {
                                                      // <=== make root-level connections here, e.g., connections between interface bundles
    wireall( "VCC"  );                                // <=== example power connections
    wireall( "GND" );
  }
};
 
#endif

From skel_sub.h (my_sub.h):

/*                                                                               *\
    This file is part of the CBOLD(tm) framework for electronic design capture.
                         Copyright (C) 2007 Coolquest, Inc.

      This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation; either version 2 of the License, or
      (at your option) any later version.

      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.

      You should have received a copy of the GNU General Public License along
      with this program; if not, write to the Free Software Foundation, Inc.,
      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

    For more about the CBOLD framework and Coolquest, Inc., see www.cbold.com.
\*                                                                               */
 
// file skel_sub.h:  example skeleton subsystem file
 
#ifndef _skel_sub_h_                             // <=== change these lines to match your file name
#define _skel_sub_h_
 
// This is a skeleton subsystem header file.                                 <===
// To adapt this file to your design, see comments that contain this arrow:  <===
// See also skeleton.cpp and skeleton.h.                                     <===
 
// include header files used by this subsystem, e.g., part header files
#include "decoupling.h"                          // <=== example part header file -- be sure the included file's directory is in your compiler's include path
                                                 // <=== if your subsystem has member modules, either define them here or #include their header file(s) here
 
class CM_Power : public TModule {                // <=== change name (CM_Power) to match your subsystem name
public:
// ***** member bundles ***** //
                                                 // <=== declare member bundles here
// ***** member ports ***** //
                                                 // <=== declare member ports here
  port VCC;                                      // <=== example ports
  port GND;
 
// ***** member modules and parts ***** //
                                                 // <=== declare member parts here
  CP_CDC_POS  VCC_CDC[ 4 ];                      // <=== example parts
 
 
  virtual void Register() {
                                                 // <=== register all member bundles, ports, modules and parts here
    reg(  VCC         );    // auto_reg
    reg(  GND         );    // auto_reg
    rega( VCC_CDC, 4  );    // auto_reg
  }
 
  virtual void Connect() {
                                                 // <=== make all internal connections here
    wireall( GND );                              // <=== example connections
    for ( int i = 0; i < 4; ++ i ) {
      VCC  <<  VCC_CDC[ i ].POS;
    }
  }
};
 
#endif

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact