Class: OrigenSim::Tester
- Inherits:
-
Object
- Object
- OrigenSim::Tester
- Includes:
- OrigenTesters::VectorBasedTester
- Defined in:
- lib/origen_sim/tester.rb
Overview
Responsible for interfacing the simulator with Origen
Constant Summary collapse
Instance Method Summary collapse
- #c1(msg, options = {}) ⇒ Object
- #capture ⇒ Object
- #handshake(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Tester
constructor
A new instance of Tester.
- #loop_vectors(name, number_of_loops, options = {}) ⇒ Object (also: #loop_vector)
-
#push_vector(options) ⇒ Object
This method intercepts vector data from Origen, removes white spaces and compresses repeats.
- #set_timeset(name, period_in_ns) ⇒ Object
- #simulator ⇒ Object
-
#start ⇒ Object
Start the simulator.
-
#store_next_cycle(*pins) ⇒ Object
Capture the next vector generated.
-
#sync_up ⇒ Object
Blocks the Origen process until the simulator indicates that it has processed all operations up to this point.
Constructor Details
#initialize(options = {}) ⇒ Tester
Returns a new instance of Tester.
8 9 10 11 |
# File 'lib/origen_sim/tester.rb', line 8 def initialize( = {}) simulator.configure() super() end |
Instance Method Details
#c1(msg, options = {}) ⇒ Object
65 66 67 |
# File 'lib/origen_sim/tester.rb', line 65 def c1(msg, = {}) simulator.write_comment(msg) if @step_comment_on end |
#capture ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/origen_sim/tester.rb', line 20 def capture simulator.sync do @sync_pins = [] @sync_cycles = 0 yield end @sync_pins.map { |pin| simulator.peek("origen.pins.#{pin.id}.sync_memory[#{@sync_cycles - 1}:0]") } end |
#handshake(options = {}) ⇒ Object
17 18 |
# File 'lib/origen_sim/tester.rb', line 17 def handshake( = {}) end |
#loop_vectors(name, number_of_loops, options = {}) ⇒ Object Also known as: loop_vector
69 70 71 72 73 |
# File 'lib/origen_sim/tester.rb', line 69 def loop_vectors(name, number_of_loops, = {}) number_of_loops.times do yield end end |
#push_vector(options) ⇒ Object
This method intercepts vector data from Origen, removes white spaces and compresses repeats
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/origen_sim/tester.rb', line 51 def push_vector() unless [:timeset] puts 'No timeset defined!' puts 'Add one to your top level startup method or target like this:' puts '$tester.set_timeset("nvmbist", 40) # Where 40 is the period in ns' exit 1 end simulator.cycle([:repeat] || 1) if @after_next_vector @after_next_vector.call(@after_next_vector_args) @after_next_vector = nil end end |
#set_timeset(name, period_in_ns) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/origen_sim/tester.rb', line 40 def set_timeset(name, period_in_ns) super # Need to remove this once OrigenTesters does it dut.timeset = name dut.current_timeset_period = period_in_ns # Now update the simulator with the new waves simulator.on_timeset_changed end |
#simulator ⇒ Object
13 14 15 |
# File 'lib/origen_sim/tester.rb', line 13 def simulator OrigenSim.simulator end |
#start ⇒ Object
Start the simulator
30 31 32 |
# File 'lib/origen_sim/tester.rb', line 30 def start simulator.start end |
#store_next_cycle(*pins) ⇒ Object
Capture the next vector generated
This method applies a store request to the next vector to be generated, note that is does not actually generate a new vector.
The captured data is added to the captured_data array.
This method is intended to be used by pin drivers, see the #capture method for the application level API.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/origen_sim/tester.rb', line 89 def store_next_cycle(*pins) = pins.last.is_a?(Hash) ? pins.pop : {} pins = dut.rtl_pins.values if pins.empty? if simulator.sync_active? pins.each do |pin| @sync_cycles += 1 @sync_pins << pin unless @sync_pins.include?(pin) end end pins.each(&:capture) # A store request is only valid for one cycle, this tells the simulator # to stop after the next vector is generated after_next_vector do pins.each { |pin| simulator.put("h^#{pin.simulation_index}") } end end |
#sync_up ⇒ Object
Blocks the Origen process until the simulator indicates that it has processed all operations up to this point
36 37 38 |
# File 'lib/origen_sim/tester.rb', line 36 def sync_up simulator.sync_up end |