Class: OrigenSVF::Tester

Inherits:
Object
  • Object
show all
Includes:
OrigenTesters::VectorBasedTester
Defined in:
lib/origen_svf/tester.rb

Instance Method Summary collapse

Constructor Details

#initializeTester

Returns a new instance of Tester.



5
6
7
8
9
# File 'lib/origen_svf/tester.rb', line 5

def initialize
  @pat_extension = 'svf'
  @compress = false
  @comment_char = '//'
end

Instance Method Details

#cycle(options = {}) ⇒ Object



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
# File 'lib/origen_svf/tester.rb', line 71

def cycle(options = {})
  v = ''
  ordered_pins.each do |pin|
    if pin.state == :dont_care
      if pin.direction == :output
        v += 'X'
      else
        v += 'Z'
      end
    elsif pin.state == :drive
      if pin.data == 0
        v += 'L'
      else
        v += 'H'
      end
    elsif pin.state == :compare
      if pin.data == 0
        v += 'D'
      else
        v += 'U'
      end
    else
      fail "Unknown pin state: #{pin.state}"
    end
  end
  microcode "PIO (#{v})"
  delay(options[:repeat]) if options[:repeat] && options[:repeat] > 1
end

#delay(cycles, options = {}) ⇒ Object



40
41
42
# File 'lib/origen_svf/tester.rb', line 40

def delay(cycles, options = {})
  microcode "RUNTEST #{cycles} TCK;"
end

#end_subroutine(_cond = false) ⇒ Object

Ends the current subroutine that was started with a previous call to start_subroutine



121
122
123
# File 'lib/origen_svf/tester.rb', line 121

def end_subroutine(_cond = false)
  ::Pattern.close call_shutdown_callbacks: false, subroutine: true
end

#handshake(options = {}) ⇒ Object



110
111
112
# File 'lib/origen_svf/tester.rb', line 110

def handshake(options = {})
  ss 'Tester handshake is not support.  Add comment here to highlight'
end

#local_subroutinesObject

Returns an array of subroutines created by the current pattern



125
126
127
# File 'lib/origen_svf/tester.rb', line 125

def local_subroutines # :nodoc:
  @local_subroutines ||= []
end

#loop_vectors(name = nil, number_of_loops = 1, _global = false) ⇒ Object Also known as: loop_vector



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/origen_svf/tester.rb', line 129

def loop_vectors(name = nil, number_of_loops = 1, _global = false)
  # The name argument is present to maych J750 API, sort out the
  unless name.is_a?(String)
    name, number_of_loops, global = nil, name, number_of_loops
  end
  if number_of_loops > 1
    cc 'Looping is not support by SVF.  Add comment here to highligh.'
    cc "LOOPING #{name} #{number_of_loops} times"
    yield
    cc "END LOOPING #{name}"
  else
    yield
  end
end

#match(pin, state, timeout_in_cycles, options = {}) ⇒ Object



150
151
152
153
154
# File 'lib/origen_svf/tester.rb', line 150

def match(pin, state, timeout_in_cycles, options = {})
  cc 'Matchloop is not support by SVF.  Add comment here to highligh.'
  cc "Matchloop is waiting on pin #{pin} to go #{state}"
  cc "Matchloop is waiting for #{timeout_in_cycles} cycles "
end

#match_block(timeout_in_cycles, options = {}, &block) ⇒ Object



145
146
147
148
# File 'lib/origen_svf/tester.rb', line 145

def match_block(timeout_in_cycles, options = {}, &block)
  cc 'Matchloop is not support by SVF.  Add comment here to highligh.'
  cc "Matchloop is waiting for #{timeout_in_cycles} cycles "
end

#microcode(str) ⇒ Object



100
101
102
103
104
105
106
107
108
# File 'lib/origen_svf/tester.rb', line 100

def microcode(str)
  if str.length > 80
    str.scan(/.{1,80}/).each do |line|
      super(line)
    end
  else
    super
  end
end


68
69
# File 'lib/origen_svf/tester.rb', line 68

def pattern_footer(options = {})
end

#pattern_header(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/origen_svf/tester.rb', line 15

def pattern_header(options = {})
  microcode 'PIOMAP ('
  ordered_pins.each do |pin|
    if pin.direction == :input
      l = 'IN'
    elsif pin.direction == :output
      l = 'OUT'
    else
      l = 'INOUT'
    end
    microcode "  #{l} #{pin.name.upcase}"
  end
  microcode ');'
  microcode ''
  microcode 'TRST ABSENT;'
  microcode 'ENDIR IDLE;'
  microcode 'ENDDR IDLE;'
end

#read_dr(reg_or_val, options = {}) ⇒ Object



59
60
61
62
63
64
65
66
# File 'lib/origen_svf/tester.rb', line 59

def read_dr(reg_or_val, options = {})
  if reg_or_val.has_overlay?
    cc "Overlay on ATE: #{reg_or_val.overlay_str}"
  end
  microcode "SDR #{size(reg_or_val, options)} TDO(#{data(reg_or_val)}) MASK(#{mask(reg_or_val, options)});"
  # Clear read and similar flags to reflect that the request has just been fulfilled
  reg_or_val.clear_flags if reg_or_val.respond_to?(:clear_flags)
end

#read_ir(reg_or_val, options = {}) ⇒ Object



55
56
57
# File 'lib/origen_svf/tester.rb', line 55

def read_ir(reg_or_val, options = {})
  microcode "SIR #{size(reg_or_val, options)} TDO(#{data(reg_or_val)}) MASK(#{mask(reg_or_val, options)});"
end

#set_timeset(name, period_in_ns) ⇒ Object



34
35
36
37
38
# File 'lib/origen_svf/tester.rb', line 34

def set_timeset(name, period_in_ns)
  super
  f = (1 / (period_in_ns / 1_000_000_000.0)).ceil
  microcode "FREQUENCY #{f} HZ;"
end

#start_subroutine(name) ⇒ Object



114
115
116
117
118
# File 'lib/origen_svf/tester.rb', line 114

def start_subroutine(name)
  local_subroutines << name.to_s.chomp unless local_subroutines.include?(name.to_s.chomp) || @inhibit_vectors
  # name += "_subr" unless name =~ /sub/
  ::Pattern.open name: name, call_startup_callbacks: false, subroutine: true
end

#subdirectoryObject



11
12
13
# File 'lib/origen_svf/tester.rb', line 11

def subdirectory
  'svf'
end

#write_dr(reg_or_val, options = {}) ⇒ Object



48
49
50
51
52
53
# File 'lib/origen_svf/tester.rb', line 48

def write_dr(reg_or_val, options = {})
  if reg_or_val.has_overlay?
    cc "Overlay on ATE: #{reg_or_val.overlay_str}"
  end
  microcode "SDR #{size(reg_or_val, options)} TDI(#{data(reg_or_val)});"
end

#write_ir(reg_or_val, options = {}) ⇒ Object



44
45
46
# File 'lib/origen_svf/tester.rb', line 44

def write_ir(reg_or_val, options = {})
  microcode "SIR #{size(reg_or_val, options)} TDI(#{data(reg_or_val)});"
end