Sha256: e83398e34d5b2a9c72b8e52315f960ac8a738b5715c7fabd7414cd7490e3f1f6

Contents?: true

Size: 1.7 KB

Versions: 10

Compression:

Stored size: 1.7 KB

Contents

module Origen
  module Fuses
    # Currently just a simple data container most suited for import from Excel/CSV/XML
    # by stuffing all attributes into the options hash
    class FuseField
      attr_accessor :name, :size, :start_addr, :owner

      def initialize(name, start_addr, size, owner, options = {})
        options = {
          default_value: 0
        }.merge(options)
        @name, @start_addr, @size, @owner = name, start_addr, size, owner
        # Check if the start address is in Verilog format or includes the number base in it
        if @start_addr.is_a? String
          if @start_addr.is_verilog_number? || @start_addr.match(/^0[x,o,d,b]\S+/)
            @start_addr = @start_addr.to_dec
          end
        end
        unless @size.is_a?(Numeric) && @start_addr.size.is_a?(Numeric)
          Origen.log.error("Fuse fields must have numeric attributes for 'size' and 'start_addr'!")
          fail
        end
        # If the fuse field is owned by Top Level DUT then keep the start address as-is
        # If not, then add the fuse field start address to the base address of the IP
        unless owner.is_top_level?
          @start_addr += owner.base_address if owner.respond_to?(:base_address)
        end
        options.each do |o, val|
          instance_eval("def #{o};@#{o};end") # getter
          instance_eval("def #{o}=(val);@#{o}=val;end") # setter
          ivar_name = "@#{o}".to_sym
          instance_variable_set(ivar_name, options[o])
        end

        def reprogrammeable?
          respond_to?(:reprogrammeable) ? reprogrammeable : true
        end

        def customer_visible?
          respond_to?(:customer_visible) ? customer_visible : false
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
origen-0.60.18 lib/origen/fuses/fuse_field.rb
origen-0.60.17 lib/origen/fuses/fuse_field.rb
origen-0.60.16 lib/origen/fuses/fuse_field.rb
origen-0.60.14 lib/origen/fuses/fuse_field.rb
origen-0.60.13 lib/origen/fuses/fuse_field.rb
origen-0.60.12 lib/origen/fuses/fuse_field.rb
origen-0.60.11 lib/origen/fuses/fuse_field.rb
origen-0.60.10 lib/origen/fuses/fuse_field.rb
origen-0.60.9 lib/origen/fuses/fuse_field.rb
origen-0.60.8 lib/origen/fuses/fuse_field.rb