Class: OrigenVerilog::TopLevel

Inherits:
Object
  • Object
show all
Includes:
Origen::TopLevel
Defined in:
lib/origen_verilog/top_level.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ TopLevel

Returns a new instance of TopLevel.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/origen_verilog/top_level.rb', line 7

def initialize(options = {})
  @name = options[:ast].to_a[0]

  options[:ast].pins.each do |node|
    name = node.to_a.last
    if node.type == :input_declaration
      direction = :input
    elsif node.type == :ouput_declaration
      direction = :output
    else
      direction = :io
    end
    if r = node.find(:range)
      size = r.to_a[0] - r.to_a[1] + 1
    else
      size = 1
    end
    add_pin name, direction: direction, size: size
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/origen_verilog/top_level.rb', line 5

def name
  @name
end