Module: OrigenJTAG::TAPController
- Included in:
- Driver
- Defined in:
- lib/origen_jtag/tap_controller.rb
Overview
Provides methods specifically for controlling the state of the TAP Controller
Constant Summary collapse
- STATES =
Map of internal state symbols to human readable names
{ reset: 'Test-Logic-Reset', idle: 'Run-Test/Idle', select_dr: 'Select-DR', capture_dr: 'Capture-DR', shift_dr: 'Shift-DR', exit1_dr: 'Exit1-DR', pause_dr: 'Pause-DR', exit2_dr: 'Exit2-DR', update_dr: 'Update-DR', select_ir: 'Select-IR', capture_ir: 'Capture-IR', shift_ir: 'Shift-IR', exit1_ir: 'Exit1-IR', pause_ir: 'Pause-IR', exit2_ir: 'Exit2-IR', update_ir: 'Update-IR' }
Instance Attribute Summary collapse
-
#state ⇒ Object
(also: #current_state)
readonly
Returns the current state of the JTAG TAP Controller.
Instance Method Summary collapse
-
#idle ⇒ Object
Forces the state to Run-Test/Idle regardless of the current state.
-
#pause_dr ⇒ Object
Goto Pause-DR state then exit back to Run-Test/Idle.
-
#pause_ir ⇒ Object
Goto Pause-IR state then exit back to Run-Test/Idle.
-
#reset ⇒ Object
Force state to Test-Logic-Reset regardless of the current state.
-
#shift_dr(options = {}) ⇒ Object
Goto Shift-DR state then exit back to Run-Test/Idle.
-
#shift_ir(options = {}) ⇒ Object
Goto Shift-IR state then exit back to Run-Test/Idle.
-
#state_str ⇒ Object
(also: #current_state_str)
Returns the current state as a human readable string.
- #update_state(state) ⇒ Object
Instance Attribute Details
#state ⇒ Object (readonly) Also known as: current_state
Returns the current state of the JTAG TAP Controller
26 27 28 |
# File 'lib/origen_jtag/tap_controller.rb', line 26 def state @state end |
Instance Method Details
#idle ⇒ Object
Forces the state to Run-Test/Idle regardless of the current state.
291 292 293 294 295 296 297 298 299 300 |
# File 'lib/origen_jtag/tap_controller.rb', line 291 def idle log 'Force transition to Run-Test/Idle...' # From the JTAG2IPS block guide holding TMS high for 5 cycles # will force it to reset regardless of the state, let's give # it 6 for luck: 6.times { tms!(1) } # Now a couple of cycles low to get it into idle 2.times { tms!(0) } update_state :idle end |
#pause_dr ⇒ Object
Goto Pause-DR state then exit back to Run-Test/Idle
This method can be nested inside of a shift_dr block to transition into the Pause-DR state and then back to Shift-DR
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/origen_jtag/tap_controller.rb', line 120 def pause_dr validate_state(:idle, :shift_dr) log 'Transition to Pause-DR...' if state == :idle tms!(1) # => Select-DR-Scan update_state :select_dr_scan tms!(0) # => Capture-DR update_state :capture_dr tms!(1) # => Exit1-DR update_state :exit1_dr tms!(0) # => Pause-DR update_state :pause_dr yield log 'Transition to Run-Test/Idle...' tms!(1) # => Exit2-DR update_state :exit2_dr tms!(1) # => Update-DR update_state :update_dr tms!(0) # => Run-Test/Idle update_state :idle else # shift_dr tms!(1) # => Exit1-DR update_state :exit1_dr tms!(0) # => Pause-DR update_state :pause_dr yield log 'Transition to Shift-DR...' tms!(1) # => Exit2-DR update_state :exit2_dr tms!(0) # => Shift-DR update_state :shift_dr end end |
#pause_ir ⇒ Object
Goto Pause-IR state then exit back to Run-Test/Idle
This method can be nested inside of a shift_ir block to transition into the Pause-IR state and then back to Shift-IR
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/origen_jtag/tap_controller.rb', line 247 def pause_ir validate_state(:idle, :shift_ir) log 'Transition to Pause-IR...' if state == :idle tms!(1) # => Select-DR-Scan update_state :select_dr_scan tms!(1) # => Select-IR-Scan update_state :select_ir_scan tms!(0) # => Capture-IR update_state :capture_ir tms!(1) # => Exit1-IR update_state :exit1_ir tms!(0) # => Pause-IR update_state :pause_ir yield log 'Transition to Run-Test/Idle...' tms!(1) # => Exit2-IR update_state :exit2_ir tms!(1) # => Update-IR update_state :update_ir tms!(0) # => Run-Test/Idle update_state :idle else # :shift_ir tms!(1) # => Exit1-IR update_state :exit1_ir tms!(0) # => Pause-IR update_state :pause_ir yield log 'Transition to Shift-IR...' tms!(1) # => Exit2-IR update_state :exit2_ir tms!(0) # => Shift-IR update_state :shift_ir end end |
#reset ⇒ Object
Force state to Test-Logic-Reset regardless of the current state
304 305 306 307 308 |
# File 'lib/origen_jtag/tap_controller.rb', line 304 def reset log 'Force transition to Test-Logic-Reset...' # JTAG reset 6.times { tms!(1) } end |
#shift_dr(options = {}) ⇒ Object
Goto Shift-DR state then exit back to Run-Test/Idle
This method can be nested inside of a pause_dr block to transition into the Shift-DR state and then back to Pause-DR
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 |
# File 'lib/origen_jtag/tap_controller.rb', line 52 def shift_dr( = {}) validate_state(:idle, :pause_dr) log 'Transition to Shift-DR...' if state == :idle tms!(1) # => Select-DR-Scan update_state :select_dr_scan tms!(0) # => Capture-DR update_state :capture_dr tms!(0) # => Shift-DR update_state :shift_dr if [:write] msg = "Write DR: #{[:write]}" elsif [:read] msg = "Read DR: #{[:read]}" else msg = 'DR Data' end log msg, always: true do yield log 'Transition to Run-Test/Idle...' if @last_data_vector_shifted @last_data_vector_shifted = false else tms!(1) # => Exit1-DR update_state :exit1_dr end end tms!(1) # => Update-DR update_state :update_dr tms!(0) # => Run-Test/Idle update_state :idle else # :pause_dr tms!(1) # => Exit2-DR update_state :exit2_dr tms!(0) # => Shift-DR update_state :shift_dr yield log 'Transition to Pause-DR...' tms!(1) # => Exit1-DR update_state :exit1_dr tms!(0) # => Pause-DR update_state :pause_dr end end |
#shift_ir(options = {}) ⇒ Object
Goto Shift-IR state then exit back to Run-Test/Idle
This method can be nested inside of a pause_ir block to transition into the Shift-IR state and then back to Pause-IR
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/origen_jtag/tap_controller.rb', line 177 def shift_ir( = {}) validate_state(:idle, :pause_ir) log 'Transition to Shift-IR...' if state == :idle tms!(1) # => Select-DR-Scan update_state :select_dr_scan tms!(1) # => Select-IR-Scan update_state :select_ir_scan tms!(0) # => Capture-IR update_state :capture_ir tms!(0) # => Shift-IR update_state :shift_ir if [:write] msg = "Write IR: #{[:write]}" elsif [:read] msg = "Read IR: #{[:read]}" else msg = 'IR Data' end log msg, always: true do yield log 'Transition to Run-Test/Idle...' if @last_data_vector_shifted @last_data_vector_shifted = false else tms!(1) # => Exit1-IR update_state :exit1_ir end end tms!(1) # => Update-IR update_state :update_ir tms!(0) # => Run-Test/Idle update_state :idle else # :pause_ir tms!(1) # => Exit2-IR update_state :exit2_ir tms!(0) # => Shift-IR update_state :shift_ir yield log 'Transition to Pause-IR...' tms!(1) # => Exit1-IR update_state :exit1_ir tms!(0) # => Pause-IR update_state :pause_ir end end |
#state_str ⇒ Object Also known as: current_state_str
Returns the current state as a human readable string
284 285 286 |
# File 'lib/origen_jtag/tap_controller.rb', line 284 def state_str STATES[state] end |
#update_state(state) ⇒ Object
310 311 312 313 314 315 |
# File 'lib/origen_jtag/tap_controller.rb', line 310 def update_state(state) @state = state log "Current state: #{state_str}" if log_state_changes @listeners ||= Origen.listeners_for(:on_jtag_state_change) @listeners.each { |l| l.on_jtag_state_change(@state) } end |