Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / devices / common / regdef / include / Trace.h
CommitLineData
920dae64
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: Trace.h
5* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
7*
8* The above named program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public
10* License version 2 as published by the Free Software Foundation.
11*
12* The above named program is distributed in the hope that it will be
13* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this work; if not, write to the Free Software
19* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20*
21* ========== Copyright Header End ============================================
22*/
23#ifndef __Trace_h
24#define __Trace_h
25
26#include "Datatype.h"
27
28/** @file Trace.h
29 * Trace.h provides classes to assist tracing of model state.
30 *
31 * @sa Trace_Module
32 */
33
34/** @defgroup Trace_Module The Trace Module
35 *
36 * Trace.h provides two classes to assist tracing of model state.
37 * Trace defines constants to identify the different kinds of trace
38 * that are supported. Traceable is the base class for every class
39 * that can be traced
40 *
41 * @{
42 */
43
44/** Trace defines constants to identify the different kinds of trace
45 * that are supported. These constants are used to filter the trace.
46 * Note that small register arrays can be traced if selected, but large
47 * register arrays are never traced. The break-point between whether a
48 * register array is considered small or large is specified in Register.h.
49 * This distinction is necessary because some simulation models use
50 * very large register arrays, and these are very inconvenient for the
51 * trace file format and trace file viewer.
52 */
53
54class Trace
55{
56public:
57 static const unsigned PORTS = 0x1; /**< Trace Ports. */
58 static const unsigned SIGNALS = 0x2; /**< Trace Signals. */
59 static const unsigned REGISTERS = 0x4; /**< Trace scalar Registers. */
60 static const unsigned REGISTER_ARRAYS = 0x8; /**< Trace arrays of
61 Registers. */
62 static const unsigned DEFAULT = 0xF; /**< Trace the default set. */
63 static const unsigned EVERYTHING = 0xF; /**< Trace everything. */
64};
65
66/** Traceable is the base class for every class that can be traced. This
67 * class allocates unique Trace identifiers to each instance of a
68 * traceable class. These identifiers are used in the output trace file.
69 */
70
71class Traceable
72{
73public:
74 /** Constructor for Traceable. It allocates the traceId for this object. */
75 Traceable();
76
77 /** Get the traceId for this object. */
78 Identifier getTraceId() { return traceId; }
79
80private:
81 Identifier traceId;
82 static Identifier nextTraceId;
83};
84
85/** @} */
86
87#endif