Class: OrigenLink::Listener

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/origen_link/listener.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.environmentObject



8
9
10
# File 'lib/origen_link/listener.rb', line 8

def self.environment
  @environment || :production
end

.portObject



4
5
6
# File 'lib/origen_link/listener.rb', line 4

def self.port
  @port || 20_020
end

.run!(options = {}) ⇒ Object



16
17
18
19
20
21
# File 'lib/origen_link/listener.rb', line 16

def self.run!(options = {})
  @port = options[:port]
  @environment = options[:environment]
  @target_object = options[:dut]
  super
end

.target_objectObject



12
13
14
# File 'lib/origen_link/listener.rb', line 12

def self.target_object
  @target_object || dut
end

Instance Method Details

#expand_path(path) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/origen_link/listener.rb', line 27

def expand_path(path)
  path.split('.').each do |p|
    if p =~ /(.*)\[(\d+)(:(\d+))?\]$/
      msb = Regexp.last_match(2).to_i
      lsb = Regexp.last_match(4).to_i if Regexp.last_match(4)
      yield Regexp.last_match(1)
      if lsb
        yield '[]', msb..lsb
      else
        yield '[]', msb
      end
    else
      yield p
    end
  end
end

#target_objectObject



23
24
25
# File 'lib/origen_link/listener.rb', line 23

def target_object
  self.class.target_object
end