Class: LinkDemo::TopLevelController
- Inherits:
-
Object
- Object
- LinkDemo::TopLevelController
- Includes:
- Origen::Controller, OrigenARMDebug, OrigenJTAG
- Defined in:
- lib/link_demo/top_level_controller.rb
Constant Summary
- MDMAP_STAT =
0x01000000
- MDMAP_CTRL =
0x01000004
Instance Method Summary (collapse)
-
- (Object) interactive_shutdown
This is called automatically at the end of an interactive session (origen i).
-
- (Object) interactive_startup
This is called automatically at the start of an interactive session (origen i).
- - (Object) read_portb_3_0(value)
- - (Object) read_register(reg, options = {})
-
- (Object) shutdown(options = {})
This is called automatically at the end of generating a pattern.
-
- (Object) startup(options = {})
This is called automatically at the start of generating a pattern.
- - (Object) write_register(reg, options = {})
Instance Method Details
- (Object) interactive_shutdown
This is called automatically at the end of an interactive session (origen i)
43 44 45 46 47 48 49 |
# File 'lib/link_demo/top_level_controller.rb', line 43 def interactive_shutdown if tester.link? shutdown # TODO: This should be automated tester.synchronize end end |
- (Object) interactive_startup
This is called automatically at the start of an interactive session (origen i)
38 39 40 |
# File 'lib/link_demo/top_level_controller.rb', line 38 def interactive_startup startup if tester.link? end |
- (Object) read_portb_3_0(value)
59 60 61 62 63 64 65 |
# File 'lib/link_demo/top_level_controller.rb', line 59 def read_portb_3_0(value) ss 'Enable PortB[3:0] as inputs' portb.enable_gpio(0, 1, 2, 3) gpiob.pddr[3..0].write!(0x0) ss 'Read value from PortB[3:0]' gpiob.pdir[3..0].read!(value) end |
- (Object) read_register(reg, options = {})
55 56 57 |
# File 'lib/link_demo/top_level_controller.rb', line 55 def read_register(reg, = {}) arm_debug.read_register(reg, ) end |
- (Object) shutdown(options = {})
This is called automatically at the end of generating a pattern
32 33 34 35 |
# File 'lib/link_demo/top_level_controller.rb', line 32 def shutdown( = {}) ss 'Put the device into reset' pin(:resetb).drive!(0) end |
- (Object) startup(options = {})
This is called automatically at the start of generating a pattern
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/link_demo/top_level_controller.rb', line 16 def startup( = {}) ss 'Reset the device and hold off core execution' tester.set_timeset('func_25mhz', 40) # Where 40 is the period in ns pin(:resetb).drive!(0) arm_debug.abs_if.read_dp(:idcode, 0x4ba00477) # Dummy read arm_debug.abs_if.write_dp(:ctrl_stat, 0x50000000) # Power-up Debugger & System arm_debug.abs_if.read_dp(:ctrl_stat, 0xf0000000) # Power-up Debugger & System (verify) arm_debug.abs_if.read_ap(MDMAP_STAT, 0x00000032) # Wait for flash, system, and security to stabilize arm_debug.abs_if.write_ap(MDMAP_CTRL, 0x00000010) # Assert debugger reset to CPU arm_debug.abs_if.read_ap(MDMAP_CTRL, 0x00000010) # Assert debugger reset to CPU pin(:resetb).dont_care! arm_debug.abs_if.read_ap(MDMAP_STAT, 0x0000003a) # Wait for flash, system, and security to stabilize dut.mem(0x4004_8038).write!(0xFFFF_FFFF) # Turn off all clock gating end |
- (Object) write_register(reg, options = {})
51 52 53 |
# File 'lib/link_demo/top_level_controller.rb', line 51 def write_register(reg, = {}) arm_debug.write_register(reg, ) end |