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

<<< Previous CBOLD Reference Home Next >>>

 

11.1. pt_to_h

11.1.1. Overview

The pt_to_h Support Tool is not part of the CBOLD framework. It is an independent executable. Its use is optional. The pt_to_h executable can be downloaded without charge, subject to licensing terms.

The pt_to_h Support Tool generates a C++ header file (.h) from a part text file (.pt). The part file contains information, such as package type and pinout, for one or more electronic parts. The header file contains declarations for classes that represent the parts in a CBOLD design. The easiest way to create a new part file is to copy an existing part file and then modify the copy to suit the new part(s).

The part file format was designed to be concise and readable. For example, the following part file describes a 74F07 hex buffer:

$PART_NAME 74F07                // hex buffer driver
$FOOTPRINT SOIC14
$REF_PREFIX U
$PIN_COUNT 14
$PORTS
  VCC5 14;                      // 5V power supply
  GND 7;
  A[5:0]  13 11  9  5  3  1;    // inputs
  Y[5:0]  12 10  8  6  4  2;    // outputs
$ENDPORTS
$ENDPART

Given the above part file, pt_to_h would create a .h file containing a class declaration as shown below. For brevity, the details of the class's constructor and Register() are omitted.

class CP_74F07 : public TPart {     // hex buffer driver
public:
  port   VCC5;     // 5V power supply
  port   GND;     
  port   A;        // inputs
  port   Y;        // outputs
 
  CP_74F07() { ... }
 
  virtual void Register() { ... }
};

pt_to_h is invoked at the console as follows:

pt_to_h srce_file [dest_file] [-wpuvdNL] [-i incl_file]
    -w = suppress warnings
    -p = prompt user to press a key if any error or warnings
    -u = unconditional write of destination file, even if it is unchanged
    -v = verbose console output
    -d = delete any existing destination file if error
                force port range order to H:L  <-- default
    -N = do not force port range order to H:L  <-- overrides default
    -L =        force port range order to L:H  <-- overrides default and -N
    -i = include incl_file contents before srce_file contents

srce_file is the path to the source (part) file, including any extension (e.g., .pt).

dest_file is the path to the destination (C++ header) file. If dest_file does not have an extension, then pt_to_h appends .h to form the destination file name.

If dest_file is not specified, then dest_file is srce_file less extension (if any) plus .h with an error resulting if dest_file equals srce_file.

A usage note is output to the console if pt_to_h is invoked without any command-line arguments.

Flags:

Flag Function
-w Suppresses warning message output to the console.
-p If there was an error or any warnings, prompts the user to press a key before exiting.
-u Causes the destination file to be overwritten even if doing so does not change its contents. In other words, if -u is omitted, and the destination file already exists, its timestamp is changed only if its contents change.
-v Causes verbose console output, otherwise only errors are reported to the console.
-d Causes the destination file, if it existed prior to the execution of pt_to_h, to be deleted if there is an error processing the source file. Using the -d flag ensures that there will be no destination file if there is an error, regardless of whether the destination file existed prior to pt_to_h execution.
-N Inhibits the default handling of port ranges, so that port range order will be as it appears in each port range in the source file. Port range order will not be forced to the standard H:L. See note below.
-L Forces port range order to L:H regardless of the order appearing in port ranges in the source file. If -N is also specified, -N will be ignored. See note below.
-i Causes pt_to_h to first process incl_file and then process srce_file as though the two were a single file. This can be used, for example, to prepend lines to existing part files without editing the part files themselves. For example, consider an incl_file that contains only: $BASE_CLASS public TMyPartBase

-N -L Note: Three options exist for reordering port ranges. The default, forcing the order to H:L, is recommended, because it is the best way to avoid unintended connections in a CBOLD design.

For example, if the -N option were used (overriding the default), and a microprocessor's part file declares port D as D[0:31] ... ; and a ROM's part file declares port Q as Q[31:0] ... ; then this connection in a CBOLD design:

MyMicroprocessor.D << MyROM.Q;

will have the perhaps unintended consequence of connecting D(0) to Q(31), D(1) to Q(30), etc. Had the default range reordering been used, the microprocessor's D port would have been reordered as though the port were declared D[31:0].

The -L flag is provided if the preferred ordering scheme is L:H, but this ordering scheme does not conform to the CBOLD Style Guide.

 

<<< Previous CBOLD Reference Home Next >>>

Legal Copyright © 2007 by Coolquest, Inc. Contact