Module: Origen::Clocks

Defined in:
lib/origen/clocks.rb,
lib/origen/clocks/clock.rb,
lib/origen/clocks/clocks_collection.rb

Defined Under Namespace

Classes: Clock, ClocksCollection

Instance Method Summary collapse

Instance Method Details

#add_clock(id, options = {}, &block) ⇒ Object Also known as: clock



14
15
16
17
18
19
20
# File 'lib/origen/clocks.rb', line 14

def add_clock(id, options = {}, &block)
  if clocks.include?(id)
    Origen.log.error("Cannot create clock '#{id}', it already exists!")
    fail
  end
  clocks[id] = Clock.new(id, self, options, &block)
end

#clocks(expr = nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/origen/clocks.rb', line 5

def clocks(expr = nil)
  @_clocks ||= ClocksCollection.new
  if expr.nil?
    @_clocks
  else
    @_clocks.recursive_find_by_key(expr)
  end
end