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



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

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

#microcode(str) ⇒ Object



92
93
94
95
96
97
98
99
100
# File 'lib/origen_svf/tester.rb', line 92

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


60
61
# File 'lib/origen_svf/tester.rb', line 60

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



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

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

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



52
53
54
# File 'lib/origen_svf/tester.rb', line 52

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

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

def write_dr(reg_or_val, options = {})
  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