Class: OrigenLink::Server::Jtag
- Inherits:
-
Object
- Object
- OrigenLink::Server::Jtag
- Defined in:
- lib/origen_link/server/jtag.rb
Instance Attribute Summary collapse
-
#anytdofail ⇒ Object
Returns the value of attribute anytdofail.
-
#tdoval ⇒ Object
readonly
Returns the value of attribute tdoval.
-
#verbose_enable ⇒ Object
Returns the value of attribute verbose_enable.
Instance Method Summary collapse
- #destroy ⇒ Object
- #do_cycle(tdival, tmsval, capturetdo = false) ⇒ Object
- #do_dr(numbits, value, options = {}) ⇒ Object
- #do_ir(numbits, value, options = {}) ⇒ Object
- #do_shift(numbits, value, capturetdo = false, suppresscomments = false, tdocompare = '') ⇒ Object
- #do_tlr ⇒ Object
-
#initialize(tdiio = 16, tdoio = 23, tmsio = 19, tckio = 26, tck_period = 0.000001) ⇒ Jtag
constructor
A new instance of Jtag.
- #pause_dr ⇒ Object
- #pause_ir ⇒ Object
- #tck_period=(value) ⇒ Object
Constructor Details
#initialize(tdiio = 16, tdoio = 23, tmsio = 19, tckio = 26, tck_period = 0.000001) ⇒ Jtag
Returns a new instance of Jtag.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/origen_link/server/jtag.rb', line 10 def initialize(tdiio = 16, tdoio = 23, tmsio = 19, tckio = 26, tck_period = 0.000001) @tdipin = Pin.new(tdiio, :out) @tdopin = Pin.new(tdoio, :in) @tmspin = Pin.new(tmsio, :out) @tckpin = Pin.new(tckio, :out) @tck_half_period = tck_period / 2 @tdoval = 0 @tdostr = '' @verbose_enable = true @anytdofail = false end |
Instance Attribute Details
#anytdofail ⇒ Object
Returns the value of attribute anytdofail.
8 9 10 |
# File 'lib/origen_link/server/jtag.rb', line 8 def anytdofail @anytdofail end |
#tdoval ⇒ Object (readonly)
Returns the value of attribute tdoval.
6 7 8 |
# File 'lib/origen_link/server/jtag.rb', line 6 def tdoval @tdoval end |
#verbose_enable ⇒ Object
Returns the value of attribute verbose_enable.
7 8 9 |
# File 'lib/origen_link/server/jtag.rb', line 7 def verbose_enable @verbose_enable end |
Instance Method Details
#destroy ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/origen_link/server/jtag.rb', line 26 def destroy @tdipin.destroy @tdopin.destroy @tmspin.destroy @tckpin.destroy @tdipin = nil @tdopin = nil @tmspin = nil @tckpin = nil end |
#do_cycle(tdival, tmsval, capturetdo = false) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/origen_link/server/jtag.rb', line 37 def do_cycle(tdival, tmsval, capturetdo = false) @tdipin.out(tdival) @tmspin.out(tmsval) sleep @tck_half_period @tckpin.out(1) sleep @tck_half_period if capturetdo @tdostr = @tdopin.in + @tdostr end @tckpin.out(0) end |
#do_dr(numbits, value, options = {}) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/origen_link/server/jtag.rb', line 133 def do_dr(numbits, value, = {}) defaults = { capturetdo: true, suppresscomments: false, tdocompare: '' } = defaults.merge() if !([:suppresscomments]) && @verbose_enable puts " shift DR, #{numbits} bits, value = 0x" + value.to_s(16) end if [:tdocompare] != '' capturetdo = true else capturetdo = [:tdocompare] end # Assume starting from run test idle # Advance to shift DR do_cycle(0, 1) do_cycle(0, 0) do_cycle(0, 0) do_shift(numbits, value, capturetdo, [:suppresscomments], [:tdocompare]) # Return to run test idle do_cycle(0, 1) do_cycle(0, 0) end |
#do_ir(numbits, value, options = {}) ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/origen_link/server/jtag.rb', line 101 def do_ir(numbits, value, = {}) defaults = { capturetdo: false, suppresscomments: false, tdocompare: '' } = defaults.merge() if !([:suppresscomments]) && @verbose_enable puts " shift IR, #{numbits} bits, value = 0x" + value.to_s(16) end if [:tdocompare] != '' capturetdo = true else capturetdo = [:capturetdo] end # Assume starting from run test idle # Advance to shift IR do_cycle(0, 1) do_cycle(0, 1) do_cycle(0, 0) do_cycle(0, 0) do_shift(numbits, value, capturetdo, [:suppresscomments], [:tdocompare]) # Return to run test idle do_cycle(0, 1) do_cycle(0, 0) end |
#do_shift(numbits, value, capturetdo = false, suppresscomments = false, tdocompare = '') ⇒ Object
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 96 97 98 99 |
# File 'lib/origen_link/server/jtag.rb', line 55 def do_shift(numbits, value, capturetdo = false, suppresscomments = false, tdocompare = '') @tdoval = 0 @tdostr = '' (numbits - 1).times do |bit| do_cycle(value[bit], 0, capturetdo) end do_cycle(value[numbits - 1], 1, capturetdo) @tdoval = @tdostr.to_i(2) if capturetdo if !(suppresscomments) && @verbose_enable && capturetdo puts 'TDO output = 0x' + @tdoval.to_s(16) end if capturetdo && tdocompare != '' thiscomparefail = false numbits.times do |bit| if tdocompare[numbits - 1 - bit] == 'H' compareval = 1 elsif tdocompare[numbits - 1 - bit] == 'L' compareval = 0 else compareval = @tdoval[bit] end if @tdoval[bit] != compareval @anytdofail = true thiscomparefail = true end end tdovalstr = @tdoval.to_s(2) tdovalstr = '0' * (numbits - tdovalstr.length) + tdovalstr if thiscomparefail puts '****************************>>>>>>>>>>>>>>>>> TDO failure <<<<<<<<<<<<<<<<<<****************************' puts 'expected: ' + tdocompare puts 'received: ' + tdovalstr else puts 'TDO compare pass' puts 'expected: ' + tdocompare puts 'received: ' + tdovalstr end end end |
#do_tlr ⇒ Object
50 51 52 53 |
# File 'lib/origen_link/server/jtag.rb', line 50 def do_tlr 8.times { do_cycle(0, 1) } do_cycle(0, 0) end |
#pause_dr ⇒ Object
163 164 165 166 167 168 169 170 171 172 |
# File 'lib/origen_link/server/jtag.rb', line 163 def pause_dr do_cycle(0, 1) do_cycle(0, 0) do_cycle(0, 0) do_cycle(0, 1) do_cycle(0, 0) do_cycle(0, 1) do_cycle(0, 1) do_cycle(0, 0) end |
#pause_ir ⇒ Object
174 175 176 177 |
# File 'lib/origen_link/server/jtag.rb', line 174 def pause_ir do_cycle(0, 1) pause_dr end |
#tck_period=(value) ⇒ Object
22 23 24 |
# File 'lib/origen_link/server/jtag.rb', line 22 def tck_period=(value) @tck_half_period = value / 2 end |