Class: Origen::Pins::PinClock
Instance Attribute Summary collapse
-
#cycles_per_half_period ⇒ Object
Returns the value of attribute cycles_per_half_period.
-
#last_edge ⇒ Object
Returns the value of attribute last_edge.
-
#next_edge ⇒ Object
Returns the value of attribute next_edge.
-
#running ⇒ Object
Returns the value of attribute running.
Instance Method Summary collapse
-
#initialize(owner, options = {}) ⇒ PinClock
constructor
A new instance of PinClock.
- #restart_clock(_options = {}) ⇒ Object
- #running? ⇒ Boolean
- #start_clock(options = {}) ⇒ Object
- #stop_clock(_options = {}) ⇒ Object
- #toggle ⇒ Object
- #update_clock ⇒ Object
Constructor Details
#initialize(owner, options = {}) ⇒ PinClock
Returns a new instance of PinClock.
9 10 11 12 13 14 15 |
# File 'lib/origen/pins/pin_clock.rb', line 9 def initialize(owner, = {}) @owner = owner @running = false @cycles_per_half_period = 0 @ns_per_half_period = 0 update_half_period() end |
Instance Attribute Details
#cycles_per_half_period ⇒ Object
Returns the value of attribute cycles_per_half_period.
5 6 7 |
# File 'lib/origen/pins/pin_clock.rb', line 5 def cycles_per_half_period @cycles_per_half_period end |
#last_edge ⇒ Object
Returns the value of attribute last_edge.
6 7 8 |
# File 'lib/origen/pins/pin_clock.rb', line 6 def last_edge @last_edge end |
#next_edge ⇒ Object
Returns the value of attribute next_edge.
7 8 9 |
# File 'lib/origen/pins/pin_clock.rb', line 7 def next_edge @next_edge end |
#running ⇒ Object
Returns the value of attribute running.
4 5 6 |
# File 'lib/origen/pins/pin_clock.rb', line 4 def running @running end |
Instance Method Details
#restart_clock(_options = {}) ⇒ Object
35 36 37 38 39 |
# File 'lib/origen/pins/pin_clock.rb', line 35 def restart_clock( = {}) stop_clock update_clock start_clock end |
#running? ⇒ Boolean
17 18 19 |
# File 'lib/origen/pins/pin_clock.rb', line 17 def running? @running end |
#start_clock(options = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/origen/pins/pin_clock.rb', line 21 def start_clock( = {}) fail "ERROR: Clock on #{@owner.name} already running." if running? if update_required?() update_half_period() end @last_edge = Origen.tester.cycle_count @next_edge = Origen.tester.cycle_count + @cycles_per_half_period cc "Start clock on #{@owner.name}: cycles_per_half_period=#{@cycles_per_half_period}, start cycle=#{@last_edge}" Origen.tester.push_running_clock(@owner) unless running? @running = true end |
#stop_clock(_options = {}) ⇒ Object
41 42 43 44 45 |
# File 'lib/origen/pins/pin_clock.rb', line 41 def stop_clock( = {}) cc "Stop clock on #{@owner.name}: stop cycle=#{Origen.tester.cycle_count}" if running? Origen.tester.pop_running_clock(@owner) if running? @running = false end |