next up previous contents
Next: x86 Instructions and Micro-Ops Up: PTLsim User's Guide Previous: PTLsim Architecture   Contents

Subsections


PTLsim Code Base

Code Base Overview

PTLsim is written in C++ with extensive use of x86 and x86-64 inline assembly code. It must be compiled with gcc on a Linux 2.6 based x86 or x86-64 machine. The C++ variant used by PTLsim is known as Embedded C++. Essentially, we only use the features found in C, but add templates, classes and operator overloading. Other C++ features such as hidden side effects in constructors, exception handling, RTTI, multiple inheritance, virtual methods (in most cases), thread local storage and so on are forbidden since they cannot be adequately controlled in the embedded ``bare hardware'' environment in which PTLsim runs, and can result in poor performance. We have our own standard template library, SuperSTL, that must be used in place of the C++ STL.

Even though the PTLsim code base is very large, it is well organized and structured for extensibility. The following section is an overview of the source files and subsystems in PTLsim:

Common Libraries and Logic Design APIs

PTLsim includes a number of powerful C++ templates, macros and functions not found anywhere else. This section attempts to provide an overview of these structures so that users of PTLsim will use them instead of trying to duplicate work we've already done.

General Purpose Macros

The file globals.h contains a wide range of very useful definitions, functions and macros we have accumulated over the years, including:

Super Standard Template Library (SuperSTL)

The Super Standard Template Library (SuperSTL) is an internal C++ library we use internally in lieu of the normal C++ STL for various technical and preferential reasons. While the full documentation is in the comments of superstl.h and superstl.cpp, the following is a brief list of its features:

Logic Standard Template Library (LogicSTL)

The Logic Standard Template Library (LogicSTL) is an internally developed add-on to SuperSTL which supports a variety of structures useful for modeling sequential logic. Some of its primitives may look familiar to Verilog or VHDL programmers. While the full documentation is in the comments of logic.h, the following is a brief list of its features:

Miscellaneous Code

The out of order simulator, ooocore.h, contains several reusable classes, including:


next up previous contents
Next: x86 Instructions and Micro-Ops Up: PTLsim User's Guide Previous: PTLsim Architecture   Contents
Matt T Yourst 2007-09-26