Module: Adept::JTAG::TAPStates::TAPState
- Defined in:
- lib/adept/jtag/tap_state.rb
Overview
Base for all Test Access Port states.
Instance Method Summary collapse
-
#next_hop_towards(state) ⇒ Object
Determines the next value which should be present on the mode-set line to get to the given state.
-
#next_state(value) ⇒ Object
Returns the successor to the current state, given an input value.
Instance Method Details
#next_hop_towards(state) ⇒ Object
Determines the next value which should be present on the mode-set line to get to the given state.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/adept/jtag/tap_state.rb', line 28 def next_hop_towards(state) #Get a refrence to the state module indicated by the TowardsZeroIfStateIs metaconstant. towards_zero = TAPStates.const_get(self::NextState[0]) towards_one = TAPStates.const_get(self::NextState[1]) #Determine if a next-hop of one would cause us to get stuck in a loop. towards_one_would_cause_loop = (towards_one == self || self::NextState[1] == :Reset) #If the next state would be achievable by providing a hop of zero, #or a hop of one would cause a loop, then the next hop should be zero. # #Otherwise, the next hop should be '1'. ((state == towards_zero) || towards_one_would_cause_loop) ? [0, towards_zero] : [1, towards_one] end |
#next_state(value) ⇒ Object
Returns the successor to the current state, given an input value.
14 15 16 17 18 19 20 21 22 |
# File 'lib/adept/jtag/tap_state.rb', line 14 def next_state(value) #Get the name of the module which describes the successor state... state = self::NextState[value] #... and get a reference to the module itself. TAPStates.const_get(state) end |