OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [src/] [TapAction.cpp] - Blame information for rev 611

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 63 julius
// ----------------------------------------------------------------------------
2
 
3
// TAP action header: abstract class implementation
4
 
5
// Copyright (C) 2009  Embecosm Limited <info@embecosm.com>
6
 
7
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
8
 
9
// This file is part of the Embecosm cycle accurate SystemC JTAG library.
10
 
11
// This program is free software: you can redistribute it and/or modify it
12
// under the terms of the GNU Lesser General Public License as published by
13
// the Free Software Foundation, either version 3 of the License, or (at your
14
// option) any later version.
15
 
16
// This program is distributed in the hope that it will be useful, but WITHOUT
17
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
19
// License for more details.
20
 
21
// You should have received a copy of the GNU Lesser General Public License
22
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 
24
// The C/C++ parts of this program are commented throughout in a fashion
25
// suitable for processing with Doxygen.
26
 
27
// ----------------------------------------------------------------------------
28
 
29
// $Id$
30
 
31
#include <iostream>
32
 
33
#include "TapAction.h"
34
 
35 462 julius
class sc_event;
36 63 julius
 
37
//! Constructor
38
 
39
//! Records the SystemC event used to notify completion and sets the
40
//! resetCounter to zero.
41
 
42
//! @param _actionType  The action type
43
 
44 462 julius
TapAction::TapAction(sc_core::sc_event * _doneEvent):
45
doneEvent(_doneEvent), resetCounter(0)
46 63 julius
{
47
 
48 462 julius
}                               // TapAction ()
49 63 julius
 
50
//! Accessor to get the SystemC completion event
51
 
52
//! @return  The SystemC completion event
53
 
54 462 julius
sc_core::sc_event * TapAction::getDoneEvent()
55 63 julius
{
56 462 julius
        return doneEvent;
57 63 julius
 
58 462 julius
}                               // getDoneEvent ()
59 63 julius
 
60
//! Function to check the TAP is in a consistent state, optionally with a
61
//! warning.
62
 
63
//! This is a convenience for subclasses (hence protected), so they can ensure
64
//! the state machine is in a consistent state.
65
 
66
//! @note The method returns TRUE to indicate that the machine is in the
67
//!       consistent state. However the TapStateMachine resetDone flag is set
68
//!       when the final TMS is set - the state will only be reached IF that
69
//!       TMS is driven. This mechanism gives users flexibility. They can
70
//!       detect the final TMS being driven.
71
 
72
//! @param[in]  tapStateMachine  The TAP state machine with which we are
73
//!                              associated.
74
//! @param[out] tms              The value to drive on the JTAG TMS
75
//! @param[in]  warn             True to indicate a warning message should be
76
//!                              issued when starting a reset cycle.
77
 
78
//! @return  TRUE if the TAP state machine was already in a consistent state.
79
 
80 462 julius
bool TapAction::checkResetDone(TapStateMachine * tapStateMachine,
81
                               bool & tms, bool warn)
82 63 julius
{
83 462 julius
        // Nothing more to do if we are consistent
84
        if (tapStateMachine->getResetDone()) {
85
                return true;
86
        }
87
        // Need to reset. If requested and this is the first cycle of reset, give a
88
        // warning.
89
        if (warn && (0 == resetCounter)) {
90
                std::cerr << "JTAG TAP state inconsistent: resetting" <<
91
                    std::endl;
92
        }
93
        // Drive towards reset
94
        resetCounter++;
95
        tms = 1;
96 63 julius
 
97 462 julius
        // If we have got to the end of the reset sequence we can clear the
98
        // tapStateMachine and report we are consistent. However we will not return
99
        // true until the next call.
100
        if (tapStateMachine->TAP_RESET_CYCLES == resetCounter) {
101
                tapStateMachine->setResetDone(true);
102
                resetCounter = 0;        // Ready for next time
103
        } else {
104
                return false;
105
        }
106
}                               // checkResetDone ()

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.