Module: OrigenTesters::API
- Defined in:
- lib/origen_sim/origen_testers/api.rb
Instance Method Summary collapse
- #_origen_testers_cycle ⇒ Object
- #apply_captured_data ⇒ Object
- #cycle(options = {}) ⇒ Object
-
#sim? ⇒ Boolean
(also: #simulator?)
Returns true if the tester is an instance of OrigenSim::Tester, otherwise returns false.
- #sim_capture(id, *pins) ⇒ Object
- #update_capture? ⇒ Boolean
Instance Method Details
#_origen_testers_cycle ⇒ Object
30 |
# File 'lib/origen_sim/origen_testers/api.rb', line 30 alias_method :_origen_testers_cycle, :cycle |
#apply_captured_data ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/origen_sim/origen_testers/api.rb', line 59 def apply_captured_data if @apply_captured_data_cycles && @apply_captured_data_cycles > 1 @apply_captured_data_cycles -= 1 else @org_file.read_line do |operations, cycles| @apply_captured_data_cycles = cycles operations.each do |object, operation, *args| object.send(operation, *args) end end end end |
#cycle(options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/origen_sim/origen_testers/api.rb', line 31 def cycle( = {}) if @sim_capture # Need to un-roll all repeats to be sure we observe the true data, can't # really assume that it will be constant for all cycles covered by the repeat cycles = .delete(:repeat) || 1 cycles.times do if update_capture? _origen_testers_cycle() @sim_capture.each do |pin, net| pin.assert(simulator.peek(net)) # Remove the assertion since it is for the previous cycle in terms of the current simulation, # this won't be captured to the org file pin.dont_care end Origen::OrgFile.cycle else unless @org_file.exist? fail "The simulation capture \"#{id}\" has not been made yet, re-run this pattern with a simulation target first!" end apply_captured_data _origen_testers_cycle() end end else _origen_testers_cycle() end end |
#sim? ⇒ Boolean Also known as: simulator?
Returns true if the tester is an instance of OrigenSim::Tester, otherwise returns false
6 7 8 |
# File 'lib/origen_sim/origen_testers/api.rb', line 6 def sim? is_a?(OrigenSim::Tester) end |
#sim_capture(id, *pins) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/origen_sim/origen_testers/api.rb', line 11 def sim_capture(id, *pins) if @sim_capture fail 'Nesting of sim_capture blocks is not yet supported!' end = pins.last.is_a?(Hash) ? pins.pop : {} pins = pins.map { |p| p.is_a?(String) || p.is_a?(Symbol) ? dut.pin(p) : p } pins.each(&:save) @sim_capture = pins.map { |p| [p, "origen.dut.#{p.rtl_name}"] } Origen::OrgFile.open(id) do |org_file| @org_file = org_file if update_capture? @sim_capture.each { |pin, net| pin.record_to_org_file(only: :assert) } end yield end pins.each(&:restore) @sim_capture = nil end |
#update_capture? ⇒ Boolean
72 73 74 75 |
# File 'lib/origen_sim/origen_testers/api.rb', line 72 def update_capture? return @update_capture if defined? @update_capture @update_capture = sim? && (!@org_file.exist? || Origen.app!.update_sim_captures) end |