Class: Origen::Fuses::FuseField

Inherits:
Object
  • Object
show all
Defined in:
lib/origen/fuses/fuse_field.rb

Overview

Currently just a simple data container most suited for import from Excel/CSV/XML by stuffing all attributes into the options hash

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, start_addr, size, owner, options = {}) ⇒ FuseField

Returns a new instance of FuseField.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/origen/fuses/fuse_field.rb', line 8

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

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/origen/fuses/fuse_field.rb', line 6

def name
  @name
end

#ownerObject

Returns the value of attribute owner.



6
7
8
# File 'lib/origen/fuses/fuse_field.rb', line 6

def owner
  @owner
end

#sizeObject

Returns the value of attribute size.



6
7
8
# File 'lib/origen/fuses/fuse_field.rb', line 6

def size
  @size
end

#start_addrObject

Returns the value of attribute start_addr.



6
7
8
# File 'lib/origen/fuses/fuse_field.rb', line 6

def start_addr
  @start_addr
end

Instance Method Details

#customer_visible?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/origen/fuses/fuse_field.rb', line 39

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

#reprogrammeable?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/origen/fuses/fuse_field.rb', line 35

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