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.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/origen_testers/test/dut.rb', line 14

def initialize(options = {})
  add_pin :tclk
  add_pin :tdi
  add_pin :tdo
  add_pin :tms

  add_reg32 :testme32, 0x007a do
    bits 31..16, :portB
    bits 15..8,  :portA
    bits 1,      :done
    bits 0,      :enable
  end
  @hv_supply_pin = 'VDDHV'
  @lv_supply_pin = 'VDDLV'
  @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

#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

#execute(options = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/origen_testers/test/dut.rb', line 43

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



179
180
181
# File 'lib/origen_testers/test/dut.rb', line 179

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

#handshake(options = {}) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/origen_testers/test/dut.rb', line 139

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)


175
176
177
# File 'lib/origen_testers/test/dut.rb', line 175

def has_margin0_bug?
  false
end

#match(options = {}) ⇒ Object

Match loop functionality



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

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



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/origen_testers/test/dut.rb', line 157

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



39
40
41
# File 'lib/origen_testers/test/dut.rb', line 39

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

#startup(options) ⇒ Object



31
32
33
# File 'lib/origen_testers/test/dut.rb', line 31

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

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



35
36
37
# File 'lib/origen_testers/test/dut.rb', line 35

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