Module: CrossOrigen

Extended by:
ActiveSupport::Concern
Included in:
Test::DUT, Test::DUT::ATX2, Test::DUT::D_IP_ANA_TEST_ANNEX_SYN
Defined in:
lib/cross_origen.rb,
lib/cross_origen/ralf.rb,
lib/cross_origen/headers.rb,
lib/cross_origen/ip_xact.rb,
lib/cross_origen/xml_doc.rb,
lib/cross_origen/test/dut.rb,
lib/cross_origen/cmsis_svd.rb,
lib/cross_origen/design_sync.rb,
lib/cross_origen/origen_format.rb

Defined Under Namespace

Modules: Test Classes: CMSISSVD, DesignSync, Headers, IpXact, OrigenFormat, Ralf, XMLDoc

Instance Method Summary collapse

Instance Method Details

#cr_design_syncObject

Returns an instance of the DesignSync interface



55
56
57
# File 'lib/cross_origen.rb', line 55

def cr_design_sync
  @cr_design_sync ||= DesignSync.new(self)
end

#cr_headersObject



59
60
61
# File 'lib/cross_origen.rb', line 59

def cr_headers
  @cr_headers ||= Headers.new(self)
end

#cr_import(options = {}) ⇒ Object



19
20
21
22
# File 'lib/cross_origen.rb', line 19

def cr_import(options = {})
  file = cr_file(options)
  cr_translator(file, options).import(file, options)
end

#cr_ip_xactObject



82
83
84
# File 'lib/cross_origen.rb', line 82

def cr_ip_xact
  @cr_ip_xact ||= IpXact.new(self)
end

#cr_ralfObject



78
79
80
# File 'lib/cross_origen.rb', line 78

def cr_ralf
  @cr_ralf ||= Ralf.new(self)
end

#cr_to_origen(options = {}) ⇒ Object

Creates Ruby files necessary to model all sub_blocks and registers found (recursively) owned by options The Ruby files are created at options (app output directory by default)



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cross_origen.rb', line 65

def cr_to_origen(options = {})
  options = {
    obj:               $dut,
    path:              Origen.app.config.output_directory,
    instantiate_level: :top
  }.update(options)
  # This method assumes and checks for $self to contain Origen::Model
  error "ERROR: #{options[:obj].class} does not contain Origen::Model as required" unless options[:obj].class < Origen::Model
  # Check to make sure there are sub_blocks or regs directly under $dut
  error "ERROR: options[:obj]ect #{options[:obj].object_id} of class #{options[:obj].class} does not contain registers or sub_blocks" unless options[:obj].owns_registers? || options[:obj].instance_respond_to?(:sub_blocks)
  OrigenFormat.new(options).export
end

#cr_try(*methods) ⇒ Object

Tries the given methods and returns the first one to return a value, ultimately returns nil if no value is found.



44
45
46
47
48
49
50
51
52
# File 'lib/cross_origen.rb', line 44

def cr_try(*methods)
  methods.each do |method|
    if self.respond_to?(method)
      val = send(method)
      return val if val
    end
  end
  nil
end

#instance_respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/cross_origen.rb', line 15

def instance_respond_to?(method_name)
  public_methods.include?(method_name)
end

#to_header(options = {}) ⇒ Object



38
39
40
# File 'lib/cross_origen.rb', line 38

def to_header(options = {})
  cr_headers.owner_to_header(options)
end

#to_ip_xact(options = {}) ⇒ Object Also known as: to_ipxact



28
29
30
# File 'lib/cross_origen.rb', line 28

def to_ip_xact(options = {})
  cr_ip_xact.owner_to_xml(options)
end

#to_origen(options = {}) ⇒ Object



33
34
35
36
# File 'lib/cross_origen.rb', line 33

def to_origen(options = {})
  options[:obj] = self
  cr_to_origen(options)
end

#to_ralf(options = {}) ⇒ Object



24
25
26
# File 'lib/cross_origen.rb', line 24

def to_ralf(options = {})
  cr_ralf.owner_to_ralf(options)
end