Sha256: 107e06c308cde6efe2b2617fb5cb953ec6d098b138a293e117192acf778a875c

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

module OrigenVerilog
  class TopLevel
    include Origen::TopLevel

    attr_reader :name

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

      options[:ast].pins.each do |node|
        node = node.evaluate  # Resolve any functions in the ranges
        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
        n = node.to_a.dup
        while n.last.is_a?(String)
          add_pin n.pop, direction: direction, size: size
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
origen_verilog-0.5.1 lib/origen_verilog/top_level.rb
origen_verilog-0.5.0 lib/origen_verilog/top_level.rb