summaryrefslogtreecommitdiffstats
path: root/src/usr/pore/poreve/porevesrc/dbg.H
blob: 159a9d7fc8bd1a02724277d959e25ff1b00ab2df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/pore/poreve/porevesrc/dbg.H $                         */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef __VSBE_POREVEDBG_H
#define __VSBE_POREVEDBG_H

// $Id: dbg.H,v 1.2 2011/06/03 19:50:19 jeshua Exp $

/// \file dbg.H
/// \brief The PORE Virtual Environment - Debugged

#include "poreve.H"

namespace vsbe {
    class PoreVeDbg;
};


////////////////////////////////////////////////////////////////////////////
// PoreVeDbg
////////////////////////////////////////////////////////////////////////////

/// The PoreVe Debug configuration
///
/// This derivation from PoreVe supports the Tcl debug environment for
/// PoreVe. The constructor takes an extra argument which is a character
/// string containing the name of a script (file) to run when the debugger
/// starts. 

class
vsbe::PoreVeDbg : public vsbe::PoreVe {

public:

    ////////////////////////////// Creators //////////////////////////////

    /// Construct the PoreVeDbg
    ///
    /// \param[in] i_id The PORE IBUF_ID (engine type) of the Pore component.
    /// This will be PORE_SBE for host boot/SBE applications, and PORE_SLW for
    /// testing Sleep/Winkle applications. 
    ///
    /// \param[in] i_masterTarget  The fapi::Target associated with the master
    /// chip in an HBI master/slave configuration.  This target is also
    /// installed into \a iv_slaveTarget by the constructor.
    ///
    /// \param[in] i_arg A private argument for the created model.  In the
    /// case of this debugged model this is a character string naming a script
    /// to be run when the debugger starts.
    PoreVeDbg(const PoreIbufId i_id, 
              const fapi::Target i_masterTarget,
              const void* i_arg);

    virtual ~PoreVeDbg();


    ////////////////////  Simulation Interface    /////////////////////////

    /// See PoreModel::run()
    ///
    /// This API is provided as a convenience.  Currently the only model in
    /// the system that is 'clocked' is the PoreModel.
    virtual int
    run(const uint64_t i_instructions, uint64_t& o_ran);


    ////////////////////  Public Implementation ////////////////////////////

    /// PoreVeDbg is a singleton class, and this is the singleton instance.
    static PoreVeDbg* cv_instance;


    //////////////////// Protected Implementation //////////////////////////

protected:

    /// The argument passed at creation
    char* iv_arg;

    /// Used by the run() method.  
    ///
    /// The first time run() is called on the debug model the debugging
    /// environment is initialized and any script specified at creation is
    /// executed. 
    bool iv_initialized;

    
    ///////////////////////////// Safety //////////////////////////////////

private:
    PoreVeDbg(const PoreVeDbg& i_rhs);
    PoreVeDbg& operator=(const PoreVeDbg& i_rhs);
};

#endif  // __VSBE_POREVEDBG_H
OpenPOWER on IntegriCloud