OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

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

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 462 julius
        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
};                              // enum TapState
54 63 julius
 
55
//! Textual representation of all the TAP states.
56
 
57
//! Provided for debugging purposes
58
static const char *tapStateNames[TAP_SIZE] = {
59 462 julius
        "Test-Logic-Reset",
60
        "Run-Test/Idle",
61
        "Select-DR-Scan",
62
        "Capture-DR",
63
        "Shift-DR",
64
        "Exit1-DR",
65
        "Pause-DR",
66
        "Exit2-DR",
67
        "Update-DR",
68
        "Select-IR-Scan",
69
        "Capture-IR",
70
        "Shift-IR",
71
        "Exit1-IR",
72
        "Pause-IR",
73
        "Exit2-IR",
74
        "Update-IR"
75
};                              // tapStateNames
76 63 julius
 
77
//! TAP state machine
78
 
79
//! Tracks the state of the TAP. This should mirror the state of the TAP in
80
//! the connected HW.
81
 
82
//! The state machine is created in the reset condition, but in truth we
83
//! cannot know what the state is. It is essential the TAP is reset before
84
//! first being used.
85
 
86
//! We cannot know for certain when the TAP state machine has been reset. 5
87
//! consecutive TMS=1 transitions will take you there, but a reset of the
88
//! target could undo this. It is the responsibility of the user of the TAP
89
//! state machine.
90
 
91
//! For convenience of users, this class provides a flag (resetDone::),
92
//! with accessors by which reset state can be recorded.
93
 
94 462 julius
class TapStateMachine {
95 63 julius
public:
96
 
97 462 julius
        friend class JtagSC;
98
        friend class TapAction;
99
        friend class TapActionDRScan;
100
        friend class TapActionIRScan;
101
        friend class TapActionReset;
102 63 julius
 
103
protected:
104
 
105 462 julius
        //! The number of cycles of TMS=1 required to force reset
106
        static const int TAP_RESET_CYCLES = 5;
107 63 julius
 
108 462 julius
        // Constructor
109
         TapStateMachine();
110 63 julius
 
111 462 julius
        // Accessor for TAP state
112
        TapState getState();
113 63 julius
 
114 462 julius
        // Accessors for TAP reset state
115
        bool getResetDone();
116
        void setResetDone(bool _resetState);
117 63 julius
 
118 462 julius
        // Drive the TAP state machine
119
        void nextState(bool tms);
120 63 julius
 
121 462 julius
        // Determine if we are in a particular target state
122
        bool targetState(TapState target, bool & tms);
123 63 julius
 
124
private:
125
 
126 462 julius
        //! The current TAP state
127
         TapState state;
128 63 julius
 
129 462 julius
        //! True if the TAP state machine has been through a reset.
130 63 julius
 
131 462 julius
        //! The state can be sure to match that of the target. Responsibility of
132
        //! user classes to set this.
133
        bool resetDone;
134 63 julius
 
135 462 julius
};                              // class TapStateMachine
136 63 julius
 
137 462 julius
#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.