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.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/origen_testers/test/dut.rb', line 18

def initialize(options = {})
  add_pin :tclk
  add_pin :tdi
  add_pin :tdo
  add_pin :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
  @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 }
  @blocks = [Block.new(0, self), Block.new(1, self), Block.new(2, self)]
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

Instance Method Details

#digsrc_overlay(options = {}) ⇒ Object



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
# File 'lib/origen_testers/test/dut.rb', line 170

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/origen_testers/test/dut.rb', line 56

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

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

#find_block_by_id(id) ⇒ Object



239
240
241
# File 'lib/origen_testers/test/dut.rb', line 239

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

#freq_count(options = {}) ⇒ Object



227
228
229
230
231
232
# File 'lib/origen_testers/test/dut.rb', line 227

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

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

#handshake(options = {}) ⇒ Object



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/origen_testers/test/dut.rb', line 152

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)


235
236
237
# File 'lib/origen_testers/test/dut.rb', line 235

def has_margin0_bug?
  false
end

#match(options = {}) ⇒ Object

Match loop functionality



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/origen_testers/test/dut.rb', line 76

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] == :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



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/origen_testers/test/dut.rb', line 210

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

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



52
53
54
# File 'lib/origen_testers/test/dut.rb', line 52

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

#startup(options) ⇒ Object



44
45
46
# File 'lib/origen_testers/test/dut.rb', line 44

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

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



48
49
50
# File 'lib/origen_testers/test/dut.rb', line 48

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