Class: OrigenTesters::Test::DUT

Inherits:
Object
  • Object
show all
Includes:
Origen::TopLevel, OrigenARMDebug, OrigenJTAG
Defined in:
lib/origen_testers/test/dut.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DUT

Returns a new instance of DUT.


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
# File 'lib/origen_testers/test/dut.rb', line 19

def initialize(options = {})
  options = {
    test_generic_overlay_capture: false
  }.merge(options)

  @test_options = {
    test_generic_overlay_capture: options[:test_generic_overlay_capture]
  }

  @target_load_count = 0

  add_pin :tclk
  add_pin :tdi
  add_pin :tdo
  add_pin :tms
  if @test_options[:test_generic_overlay_capture]
    # approved patts for this test type do not use these
    add_pin :pa0
    add_pin :pa1
    add_pin :pa2
    add_pin_group :pa, :pa2, :pa1, :pa0
    add_pin_alias :tdi_a, :tdi
  end

  if options[:extra_pins]
    options[:extra_pins].times do |i|
      add_pin "PIN_#{i}".to_sym
    end
  end
  # Add capitalized equivalent pins
  add_pin_alias :TCLK, :tclk
  add_pin_alias :TDI, :tdi
  add_pin_alias :TDO, :tdo
  add_pin_alias :TMS, :tms

  # add_pin_group :jtag, :tdi, :tdo, :tms
  add_power_pin_group :vdd1
  add_power_pin_group :vdd2
  add_virtual_pin :virtual1, type: :virtual_pin
  add_virtual_pin :virtual2, type: :ate_ch

  reg :testme32, 0x007a do |reg|
    reg.bits 31..16, :portB
    reg.bits 15..8,  :portA
    reg.bits 1,      :done
    reg.bits 0,      :enable
  end
  unless @test_options[:test_generic_overlay_capture]
    # approved patts for this test type do not use these
    @hv_supply_pin = 'VDDHV'
    @lv_supply_pin = 'VDDLV'
    @digsrc_pins = [:tdi, :tms]
    @digsrc_settings = { digsrc_mode: :parallel, digsrc_bit_order: :msb }
    @digcap_pins = :tdo
    @digcap_settings = { digcap_format: :twos_complement }
  end
  @blocks = [Block.new(0, self), Block.new(1, self), Block.new(2, self)]

  add_timeset 'tp0'
end

Instance Attribute Details

#blocksObject

Simple DUT using Nexus interface


6
7
8
# File 'lib/origen_testers/test/dut.rb', line 6

def blocks
  @blocks
end

#digcap_pinsObject

Returns the value of attribute digcap_pins.


10
11
12
# File 'lib/origen_testers/test/dut.rb', line 10

def digcap_pins
  @digcap_pins
end

#digcap_settingsObject

Returns the value of attribute digcap_settings.


12
13
14
# File 'lib/origen_testers/test/dut.rb', line 12

def digcap_settings
  @digcap_settings
end

#digsrc_pinsObject

Returns the value of attribute digsrc_pins.


9
10
11
# File 'lib/origen_testers/test/dut.rb', line 9

def digsrc_pins
  @digsrc_pins
end

#digsrc_settingsObject

Returns the value of attribute digsrc_settings.


11
12
13
# File 'lib/origen_testers/test/dut.rb', line 11

def digsrc_settings
  @digsrc_settings
end

#hv_supply_pinObject

Returns the value of attribute hv_supply_pin.


7
8
9
# File 'lib/origen_testers/test/dut.rb', line 7

def hv_supply_pin
  @hv_supply_pin
end

#lv_supply_pinObject

Returns the value of attribute lv_supply_pin.


8
9
10
# File 'lib/origen_testers/test/dut.rb', line 8

def lv_supply_pin
  @lv_supply_pin
end

#target_load_countObject

Returns the value of attribute target_load_count.


13
14
15
# File 'lib/origen_testers/test/dut.rb', line 13

def target_load_count
  @target_load_count
end

Instance Method Details

#digsrc_overlay(options = {}) ⇒ Object


263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/origen_testers/test/dut.rb', line 263

def digsrc_overlay(options = {})
  options = { define:            false,       # whether to define subr or call it
              subr_name:         false,       # default use match type as subr name
              digsrc_pins:       @digsrc_pins, # defaults to what's defined in $dut
              overlay_reg:       nil, # defaults to testme32 register
              overlay_cycle_num: 32, # Only needed if overlay_reg is NOT nil, this specificies how many clk cycles to overlay.
          }.merge(options)
  if options[:define]
    $tester.start_subroutine(options[:subr_name]) # Start subroutine
    digsrc_pins = $tester.assign_digsrc_pins(options[:digsrc_pins])
    $tester.digsrc_start(digsrc_pins, dssc_mode: :single)
    original_pin_states = {}
    digsrc_pins.each do |pin|
      original_pin_states.merge!(pin => pin(pin).data)
      pin(pin).drive_mem
    end
    if options[:overlay_reg].nil?
      options[:overlay_cycle_num].times do
        $tester.digsrc_send(digsrc_pins)
        $tester.cycle
      end
    else
      $tester.dont_compress = true
      options[:overlay_reg].size.times do
        $tester.digsrc_send(digsrc_pins)
        $tester.cycle
      end
    end
    original_pin_states.each do |pin, state|
      pin(pin).drive(state)
    end
    $tester.digsrc_stop(digsrc_pins)
    $tester.cycle
    $tester.end_subroutine # end subroutine
  else
    $tester.cycle
    $tester.call_subroutine(options[:subr_name])
  end
end

#execute(options = {}) ⇒ Object


109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/origen_testers/test/dut.rb', line 109

def execute(options = {})
  options = { define:    false,          # whether to define subr or call it
              name:      'executefunc1',
              onemodsub: false        # whether to expects subr to be in single module
          }.merge(options)

  if options[:define]
    # define subroutine
    $tester.start_subroutine(options[:name], onemodsub: options[:onemodsub])
    $tester.cycle
    $tester.end_subroutine(onemodsub: options[:onemodsub])
    $tester.cycle unless options[:onemodsub]
  else
    # call subroutine
    $tester.cycle
    $tester.call_subroutine(options[:name])
    $tester.cycle
  end
end

#find_block_by_id(id) ⇒ Object


332
333
334
# File 'lib/origen_testers/test/dut.rb', line 332

def find_block_by_id(id)
  @blocks.find { |block| block.id == id }
end

#freq_count(options = {}) ⇒ Object


320
321
322
323
324
325
# File 'lib/origen_testers/test/dut.rb', line 320

def freq_count(options = {})
  options = {
  }.merge(options)

  $tester.freq_count($dut.pin(:tdo), readcode: 73)
end

#handshake(options = {}) ⇒ Object


227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/origen_testers/test/dut.rb', line 227

def handshake(options = {})
  options = {
    define: false,          # whether to define subr or call it
  }.merge(options)

  if options[:define]
    $tester.start_subroutine('handshake')
    $tester.handshake(readcode: 100)
    $tester.cycle
    $tester.cycle
    $tester.cycle
    $tester.end_subroutine
  else
    $tester.cycle
    $tester.call_subroutine('handshake')
  end
end

#has_margin0_bug?Boolean

dummy flag to check for a particular design bug for this DUT

Returns:

  • (Boolean)

328
329
330
# File 'lib/origen_testers/test/dut.rb', line 328

def has_margin0_bug?
  false
end

#keepalive(options = {}) ⇒ Object Also known as: keep_alive


245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/origen_testers/test/dut.rb', line 245

def keepalive(options = {})
  options = {
    define:           false,          # whether to define subr or call it
    allow_subroutine: false,
    subroutine_pat:   true
  }.merge(options)

  if options[:define]
    $tester.start_subroutine('keep_alive')
    $tester.keep_alive(options)
    $tester.end_subroutine
  else
    $tester.cycle
    $tester.call_subroutine('keep_alive')
  end
end

#match(options = {}) ⇒ Object

Match loop functionality


130
131
132
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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
223
224
225
# File 'lib/origen_testers/test/dut.rb', line 130

def match(options = {})
  options = { type:        :match_pin,    # whether to match DONE bit in register or match pin
              # :match_done
              # :match_2pins
              delay_in_us: 5,           # match loop delay
              define:      false,       # whether to define subr or call it
              subr_name:   false,       # default use match type as subr name
          }.merge(options)

  subr_name = options[:subr_name] ? options[:subr_name] : options[:type].to_s

  if options[:define]
    $tester.start_subroutine(subr_name)
    $tester.cycle
    if options[:type] == :match_done

      # Match DONE bit in register
      $tester.wait(match:                 true,
                   time_in_us:            options[:delay_in_us],
                   global_loops:          true,
                   check_for_fails:       true,
                   force_fail_on_timeout: true,
                   clr_fail_post_match:   true,
                   manual_stop:           true) do
        # Match on reading done bit
        reg(:testme32).bits(:done).write(1)
        reg(:testme32).bits(:done).read!
      end
    elsif options[:type] == :match_pin
      # Match on TDO pin state
      $tester.wait(match:                 true,
                   pin:                   pin(:tdo),
                   state:                 :high,
                   time_in_us:            options[:delay_in_us],
                   global_loops:          true,
                   check_for_fails:       true,
                   force_fail_on_timeout: true,
                   clr_fail_post_match:   true,
                   manual_stop:           true)
    elsif options[:type] == :match_2pins
      # Match on TDO pin state
      $tester.wait(match:                 true,
                   pin:                   pin(:tdo),
                   state:                 :high,
                   pin2:                  pin(:tms),
                   state2:                :high,
                   time_in_us:            options[:delay_in_us],
                   global_loops:          true,
                   check_for_fails:       true,
                   force_fail_on_timeout: true,
                   clr_fail_post_match:   true,
                   manual_stop:           true)
    elsif options[:type] == :match_2pins_custom_jump
      # Match on TDO pin state
      $tester.wait(match:                 true,
                   pin:                   pin(:tdo),
                   state:                 :high,
                   pin2:                  pin(:tms),
                   state2:                :high,
                   time_in_us:            options[:delay_in_us],
                   on_pin_match_goto:     { 0 => 'no_fails_found' },
                   on_timeout_goto:       'no_fails_found',
                   global_loops:          true,
                   check_for_fails:       true,
                   force_fail_on_timeout: true,
                   clr_fail_post_match:   true,
                   manual_stop:           true)
      $tester.cycle
      $tester.set_code(200)
      $tester.branch('match_done')
      $tester.label('no_fails_found')
      $tester.set_code(201)
      $tester.label('match_done')
    elsif options[:type] == :multiple_entries
      # Match on TDO pin state, with multiple subr entry points
      $tester.wait(match:                 true,
                   pin:                   pin(:tdo),
                   state:                 :high,
                   time_in_us:            options[:delay_in_us],
                   global_loops:          true,
                   multiple_entries:      true,
                   check_for_fails:       true,
                   force_fail_on_timeout: true,
                   clr_fail_post_match:   true,
                   manual_stop:           true)
    end
    $tester.cycle
    $tester.end_subroutine
    $tester.cycle
  else
    # call subroutine
    $tester.cycle
    $tester.call_subroutine(subr_name)
    $tester.cycle
  end
end

#memory_test(options = {}) ⇒ Object


303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/origen_testers/test/dut.rb', line 303

def memory_test(options = {})
  options = {
  }.merge(options)

  $tester.memory_test(inc_counter_x: true, gen_vector: true)

  $tester.memory_test(inc_counter_y: true, gen_vector: true)

  $tester.memory_test(init_counter_x: true)

  $tester.memory_test(inc_counter_x: true, init_counter_y: true)

  $tester.memory_test(inc_counter_y: true, capture_vector: true)

  $tester.memory_test(pin: pin(:tdo), pin_data: :expect)
end

#on_createObject


80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/origen_testers/test/dut.rb', line 80

def on_create
  unless @test_options[:test_generic_overlay_capture]
    if tester && tester.uflex?
      tester.assign_dc_instr_pins([hv_supply_pin, lv_supply_pin])
      tester.assign_digsrc_pins(digsrc_pins)
      tester.apply_digsrc_settings(digsrc_settings)
      tester.assign_digcap_pins(digcap_pins)
      tester.apply_digcap_settings(digcap_settings)
      tester.memory_test_en = true
    end
  end
end

#on_load_targetObject


93
94
95
# File 'lib/origen_testers/test/dut.rb', line 93

def on_load_target
  @target_load_count += 1
end

#read_register(reg, options = {}) ⇒ Object


105
106
107
# File 'lib/origen_testers/test/dut.rb', line 105

def read_register(reg, options = {})
  arm_debug.write_register(reg, options)
end

#startup(options) ⇒ Object


97
98
99
# File 'lib/origen_testers/test/dut.rb', line 97

def startup(options)
  $tester.set_timeset('tp0', 60)
end

#write_register(reg, options = {}) ⇒ Object


101
102
103
# File 'lib/origen_testers/test/dut.rb', line 101

def write_register(reg, options = {})
  arm_debug.write_register(reg, options)
end