Class: LinkDemo::TopLevel

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

Instance Method Summary (collapse)

Constructor Details

- (TopLevel) initialize(options = {})

Returns a new instance of TopLevel



6
7
8
9
10
# File 'lib/link_demo/top_level.rb', line 6

def initialize(options = {})
  instantiate_pins(options)
  instantiate_sub_blocks(options)
  instantiate_registers(options)
end

Instance Method Details

- (Object) instantiate_pins(options = {})



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/link_demo/top_level.rb', line 12

def instantiate_pins(options = {})
  add_pin :tclk
  add_pin :tdi
  add_pin :tdo
  add_pin :tms
  add_pin :resetb
  pin_pattern_order :tclk, :tms, :tdi, :tdo, :resetb
  if tester.link?
    # TODO: pin_pattern_order should be enough
    tester.pinorder = 'tclk,tms,tdi,tdo,resetb'
  end
end

- (Object) instantiate_registers(options = {})



40
41
42
# File 'lib/link_demo/top_level.rb', line 40

def instantiate_registers(options = {})
  # Any top-level registers should be defined here
end

- (Object) instantiate_sub_blocks(options = {})



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/link_demo/top_level.rb', line 25

def instantiate_sub_blocks(options = {})
  sub_block :arm_debug, class_name: 'OrigenARMDebug::Driver', aps: { mem_ap: 0x00000000, mdmap: 0x01000000 }

  sub_block :flash, class_name: 'Flash', base_address: 0x4002_0000
  sub_block :adc, class_name: 'ADC', base_address: 0x4002_7000

  sub_block :portb, class_name: 'Port', base_address: 0x4004_A000
  sub_block :portc, class_name: 'Port', base_address: 0x4004_B000
  sub_block :portd, class_name: 'Port', base_address: 0x4004_C000

  sub_block :gpiob, class_name: 'GPIO', base_address: 0x400F_F040
  sub_block :gpioc, class_name: 'GPIO', base_address: 0x400F_F080
  sub_block :gpiod, class_name: 'GPIO', base_address: 0x400F_F0C0
end