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

Subversion Repositories openrisc_me

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

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
class  sc_event;
36
 
37
 
38
//! Constructor
39
 
40
//! Records the SystemC event used to notify completion and sets the
41
//! resetCounter to zero.
42
 
43
//! @param _actionType  The action type
44
 
45
TapAction::TapAction (sc_core::sc_event *_doneEvent) :
46
  doneEvent (_doneEvent),
47
  resetCounter (0)
48
{
49
 
50
}       // TapAction ()
51
 
52
 
53
//! Accessor to get the SystemC completion event
54
 
55
//! @return  The SystemC completion event
56
 
57
sc_core::sc_event *
58
TapAction::getDoneEvent ()
59
{
60
  return  doneEvent;
61
 
62
}       // getDoneEvent ()
63
 
64
 
65
//! Function to check the TAP is in a consistent state, optionally with a
66
//! warning.
67
 
68
//! This is a convenience for subclasses (hence protected), so they can ensure
69
//! the state machine is in a consistent state.
70
 
71
//! @note The method returns TRUE to indicate that the machine is in the
72
//!       consistent state. However the TapStateMachine resetDone flag is set
73
//!       when the final TMS is set - the state will only be reached IF that
74
//!       TMS is driven. This mechanism gives users flexibility. They can
75
//!       detect the final TMS being driven.
76
 
77
//! @param[in]  tapStateMachine  The TAP state machine with which we are
78
//!                              associated.
79
//! @param[out] tms              The value to drive on the JTAG TMS
80
//! @param[in]  warn             True to indicate a warning message should be
81
//!                              issued when starting a reset cycle.
82
 
83
//! @return  TRUE if the TAP state machine was already in a consistent state.
84
 
85
bool
86
TapAction::checkResetDone (TapStateMachine *tapStateMachine,
87
                           bool            &tms,
88
                           bool             warn)
89
{
90
  // Nothing more to do if we are consistent
91
  if (tapStateMachine->getResetDone ())
92
    {
93
      return  true;
94
    }
95
 
96
  // Need to reset. If requested and this is the first cycle of reset, give a
97
  // warning.
98
  if (warn && (0 == resetCounter))
99
    {
100
      std::cerr << "JTAG TAP state inconsistent: resetting" << std::endl;
101
    }
102
 
103
  // Drive towards reset
104
  resetCounter++;
105
  tms = 1;
106
 
107
  // If we have got to the end of the reset sequence we can clear the
108
  // tapStateMachine and report we are consistent. However we will not return
109
  // true until the next call.
110
  if (tapStateMachine->TAP_RESET_CYCLES == resetCounter)
111
    {
112
      tapStateMachine->setResetDone (true);
113
      resetCounter = 0;                          // Ready for next time
114
    }
115
  else
116
    {
117
      return false;
118
    }
119
}       // checkResetDone ()

powered by: WebSVN 2.1.0

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