Class: OrigenTesters::LabVIEWBasedTester::Pxie6570
- Inherits:
-
Object
- Object
- OrigenTesters::LabVIEWBasedTester::Pxie6570
- Includes:
- VectorBasedTester
- Defined in:
- lib/origen_testers/labview_based_tester/pxie6570.rb
Instance Attribute Summary collapse
-
#default_capture_wave_name ⇒ Object
Returns the value of attribute default_capture_wave_name.
-
#default_source_wave_name ⇒ Object
Returns the value of attribute default_source_wave_name.
Instance Method Summary collapse
-
#add_capture_start(pins, options = {}) ⇒ Object
internal method to avoid needless code duplication.
- #add_microcode_to_first_vec(statement) ⇒ Object
-
#call_subroutine(name, options = {}) ⇒ Object
insert a subroutine call provide optional argument to implement as jump instead of call:.
- #cycle(options = {}) ⇒ Object
- #end_subroutine ⇒ Object
-
#format_pin_state(pin) ⇒ Object
change the capture state character.
-
#format_vector(vec) ⇒ Object
Internal method called by Origen.
-
#initialize ⇒ Pxie6570
constructor
A new instance of Pxie6570.
-
#label(name, global = false) ⇒ Object
add a label to the output pattern.
-
#method_missing(m, *args, &block) ⇒ Object
warn but don’t fail if an api for another platform is not yet implemented.
-
#pattern_footer(options = {}) ⇒ Object
Internal method called by Origen.
-
#pattern_header(options = {}) ⇒ Object
Internal method called by Origen.
- #start_subroutine(name, options = {}) ⇒ Object
-
#store(*pins) ⇒ Object
(also: #to_hram, #capture)
store/capture the state of the provided pins.
-
#store_next_cycle(*pins) ⇒ Object
(also: #store!)
store/capture the provided pins on the next cycle.
Methods included from VectorBasedTester
Constructor Details
#initialize ⇒ Pxie6570
Returns a new instance of Pxie6570.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 8 def initialize @name = 'pxie' @pat_extension = 'digipatsrc' @capture_history = {} @source_history = {} @global_label_export = [] @called_subroutines = [] @default_capture_wave_name = 'default_capture_waveform' @default_source_wave_name = 'default_source_waveform' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
warn but don’t fail if an api for another platform is not yet implemented
217 218 219 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 217 def method_missing(m, *args, &block) Origen.log.warn "#{m} is not yet implemented for LabVIEWBasedTester::Pxie6570" end |
Instance Attribute Details
#default_capture_wave_name ⇒ Object
Returns the value of attribute default_capture_wave_name.
6 7 8 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 6 def default_capture_wave_name @default_capture_wave_name end |
#default_source_wave_name ⇒ Object
Returns the value of attribute default_source_wave_name.
6 7 8 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 6 def default_source_wave_name @default_source_wave_name end |
Instance Method Details
#add_capture_start(pins, options = {}) ⇒ Object
internal method to avoid needless code duplication
176 177 178 179 180 181 182 183 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 176 def add_capture_start(pins, = {}) unless @capture_history[:started] # add the capture start opcode to the top of the pattern add_microcode_to_first_vec "capture_start(#{@default_capture_wave_name})" @capture_history[:started] = true @capture_history[:count] = 0 end end |
#add_microcode_to_first_vec(statement) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 119 def add_microcode_to_first_vec(statement) # find the first vector i = 0 i += 1 until stage.bank[i].is_a?(OrigenTesters::Vector) first_vector = stage.bank[i] if first_vector.has_microcode? || first_vector.repeat > 1 v = OrigenTesters::Vector.new v.pin_vals = first_vector.pin_vals v.timeset = first_vector.timeset v.inline_comment = 'added line for opcode insert' v.dont_compress = true v.microcode = statement stage.insert_from_start v, i # decrement repeat count of previous first vector if > 1 first_vector.repeat -= 1 if first_vector.repeat > 1 else first_vector.microcode = statement end end |
#call_subroutine(name, options = {}) ⇒ Object
insert a subroutine call provide optional argument to implement as jump instead of call:
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 76 def call_subroutine(name, = {}) = { jump: false }.merge() @called_subroutines << name.to_s.chomp unless @called_subroutines.include?(name.to_s.chomp) local_microcode = '' if [:jump] local_microcode = "jump #{name}" else local_microcode = "call #{name}" end update_vector microcode: local_microcode, offset: [:offset] end |
#cycle(options = {}) ⇒ Object
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 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 141 def cycle( = {}) # handle overlay if requested = .key?(:overlay) ? .delete(:overlay) : {} cur_pin_state = nil if .key?(:pins) = { change_data: true }.merge() unless @source_history[:started] add_microcode_to_first_vec "source_start(#{@default_source_wave_name})" @source_history[:started] = true @source_history[:count] = 0 end # ensure no unwanted repeats on the source line [:dont_compress] = true if [:change_data] @source_history[:count] += 1 if [:microcode].nil? [:microcode] = 'source' else [:microcode] = [:microcode] + ', source' end [:microcode] = [:microcode] + ", repeat (#{[:repeat]})" unless [:repeat].nil? .delete(:repeat) end # set pins to drive data cur_pin_state = [:pins].state.to_sym [:pins].drive_mem end super() [:pins].state = cur_pin_state if .key?(:pins) end |
#end_subroutine ⇒ Object
93 94 95 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 93 def end_subroutine update_vector microcode: 'return' end |
#format_pin_state(pin) ⇒ Object
change the capture state character
211 212 213 214 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 211 def format_pin_state(pin) response = super(pin) response.sub('C', 'V') end |
#format_vector(vec) ⇒ Object
Internal method called by Origen
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 53 def format_vector(vec) timeset = vec.timeset ? " #{vec.timeset.name}" : '' pin_vals = vec.pin_vals ? "#{vec.pin_vals} ;" : '' microcode = vec.microcode ? vec.microcode : '' if vec.repeat > 1 microcode = "repeat (#{vec.repeat})" else microcode = vec.microcode ? vec.microcode : '' end if vec.pin_vals && ($_testers_enable_vector_comments || vector_comments) comment = " // #{vec.number}:#{vec.cycle} #{vec.inline_comment}" else comment = vec.inline_comment.empty? ? '' : " // #{vec.inline_comment}" end "#{microcode.ljust(65)}#{timeset.ljust(31)}#{pin_vals}#{comment}" end |
#label(name, global = false) ⇒ Object
add a label to the output pattern
205 206 207 208 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 205 def label(name, global = false) microcode name + ':' @global_label_export << name if global end |
#pattern_footer(options = {}) ⇒ Object
Internal method called by Origen
45 46 47 48 49 50 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 45 def ( = {}) # add capture/source stop to the end of the pattern cycle microcode: 'capture_stop' if @capture_history[:started] cycle microcode: 'halt' microcode '}' end |
#pattern_header(options = {}) ⇒ Object
Internal method called by Origen
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/labview_based_tester/pxie6570.rb', line 20 def pattern_header( = {}) microcode "// source count: #{@source_history[:count]}" if @source_history[:started] microcode "// capture count: #{@capture_history[:count]}" if @capture_history[:started] microcode 'file_format_version 1.0;' start_label = "#{[:pattern]}_st" microcode "export #{start_label};" @global_label_export.each { |label| microcode "export #{label};" } @called_subroutines.each { |sub| microcode "import #{sub};" } called_timesets.each do |timeset| microcode "timeset #{timeset.name};" end pin_list = ordered_pins.map(&:name).join(',') microcode "pattern #{[:pattern]} (#{pin_list})" microcode '{' microcode "#{start_label}:" # Remove any leading comments before first vector data unless [:subroutine_pat] stage.with_bank(:body) do # find the first vector stage.bank.delete_at(0) until stage.bank[0].is_a?(OrigenTesters::Vector) || stage.bank.empty? end end end |
#start_subroutine(name, options = {}) ⇒ Object
88 89 90 91 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 88 def start_subroutine(name, = {}) = { global: false }.merge() label name, [:global] end |
#store(*pins) ⇒ Object Also known as: to_hram, capture
store/capture the state of the provided pins
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 98 def store(*pins) = pins.last.is_a?(Hash) ? pins.pop : {} = { offset: 0 }.merge() pins = pins.flatten.compact fail 'For the PXIE6570 you must supply the pins to store/capture' if pins.empty? add_capture_start pins, pins.each do |pin| pin.restore_state do pin.capture update_vector_pin_val pin, offset: [:offset] last_vector([:offset]).dont_compress = true end end update_vector microcode: 'capture', offset: [:offset] end |
#store_next_cycle(*pins) ⇒ Object Also known as: store!
store/capture the provided pins on the next cycle
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/origen_testers/labview_based_tester/pxie6570.rb', line 186 def store_next_cycle(*pins) = pins.last.is_a?(Hash) ? pins.pop : {} = { offset: 0 }.merge() pins = pins.flatten.compact repeat_count = [:repeat].nil? ? 1 : [:repeat] fail 'For the PXIE6570 you must supply the pins to store/capture' if pins.empty? add_capture_start pins, @capture_history[:count] += repeat_count pins.each { |pin| pin.save; pin.capture } preset_next_vector(microcode: 'capture') do pins.each(&:restore) end end |