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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [sysc/] [include/] [TapStateMachine.h] - Blame information for rev 74

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

Line No. Rev Author Line
1 63 julius
// ----------------------------------------------------------------------------
2
 
3
// The TAP state machine: definition
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
// ----------------------------------------------------------------------------
25
 
26
// $Id$
27
 
28
#ifndef TAP_STATE_MACHINE__H
29
#define TAP_STATE_MACHINE__H
30
 
31
//! Enumeration of all the states in the TAP state machine.
32
 
33
//! Last entry is not a state, but a marker of the number of states. Useful
34
//! for state transition matrices.
35
enum TapState {
36
  TAP_TEST_LOGIC_RESET =  0,
37
  TAP_RUN_TEST_IDLE    =  1,
38
  TAP_SELECT_DR_SCAN   =  2,
39
  TAP_CAPTURE_DR       =  3,
40
  TAP_SHIFT_DR         =  4,
41
  TAP_EXIT1_DR         =  5,
42
  TAP_PAUSE_DR         =  6,
43
  TAP_EXIT2_DR         =  7,
44
  TAP_UPDATE_DR        =  8,
45
  TAP_SELECT_IR_SCAN   =  9,
46
  TAP_CAPTURE_IR       = 10,
47
  TAP_SHIFT_IR         = 11,
48
  TAP_EXIT1_IR         = 12,
49
  TAP_PAUSE_IR         = 13,
50
  TAP_EXIT2_IR         = 14,
51
  TAP_UPDATE_IR        = 15,
52
  TAP_SIZE             = 16
53
 
54
};      // enum TapState
55
 
56
 
57
//! Textual representation of all the TAP states.
58
 
59
//! Provided for debugging purposes
60
static const char *tapStateNames[TAP_SIZE] = {
61
  "Test-Logic-Reset",
62
  "Run-Test/Idle",
63
  "Select-DR-Scan",
64
  "Capture-DR",
65
  "Shift-DR",
66
  "Exit1-DR",
67
  "Pause-DR",
68
  "Exit2-DR",
69
  "Update-DR",
70
  "Select-IR-Scan",
71
  "Capture-IR",
72
  "Shift-IR",
73
  "Exit1-IR",
74
  "Pause-IR",
75
  "Exit2-IR",
76
  "Update-IR"
77
 
78
};      // tapStateNames
79
 
80
 
81
//! TAP state machine
82
 
83
//! Tracks the state of the TAP. This should mirror the state of the TAP in
84
//! the connected HW.
85
 
86
//! The state machine is created in the reset condition, but in truth we
87
//! cannot know what the state is. It is essential the TAP is reset before
88
//! first being used.
89
 
90
//! We cannot know for certain when the TAP state machine has been reset. 5
91
//! consecutive TMS=1 transitions will take you there, but a reset of the
92
//! target could undo this. It is the responsibility of the user of the TAP
93
//! state machine.
94
 
95
//! For convenience of users, this class provides a flag (resetDone::),
96
//! with accessors by which reset state can be recorded.
97
 
98
 
99
class TapStateMachine
100
{
101
public:
102
 
103
  friend class  JtagSC;
104
  friend class  TapAction;
105
  friend class  TapActionDRScan;
106
  friend class  TapActionIRScan;
107
  friend class  TapActionReset;
108
 
109
 
110
protected:
111
 
112
  //! The number of cycles of TMS=1 required to force reset
113
  static const int TAP_RESET_CYCLES = 5;
114
 
115
  // Constructor
116
  TapStateMachine();
117
 
118
  // Accessor for TAP state
119
  TapState  getState ();
120
 
121
  // Accessors for TAP reset state
122
  bool  getResetDone ();
123
  void  setResetDone (bool  _resetState);
124
 
125
  // Drive the TAP state machine
126
  void  nextState (bool tms);
127
 
128
  // Determine if we are in a particular target state
129
  bool  targetState (TapState  target,
130
                     bool     &tms);
131
 
132
private:
133
 
134
  //! The current TAP state
135
  TapState  state;
136
 
137
  //! True if the TAP state machine has been through a reset.
138
 
139
  //! The state can be sure to match that of the target. Responsibility of
140
  //! user classes to set this.
141
  bool  resetDone;
142
 
143
};      // class TapStateMachine
144
 
145
 
146
#endif  // TAP_STATE_MACHINE__H

powered by: WebSVN 2.1.0

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