origen_arm 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e94c021eca23399846f9247e568c125e30ec67bb7c08b710111a34f6cf78eeec
4
- data.tar.gz: eebec830498c20852c7a7a8582d89caebfde420d18b599b2300ddf93736eff49
3
+ metadata.gz: e02b7063e59e3d22c23a64cbf1f2e2b025ea210b2b93791adc2a3c4fb7f5a2e7
4
+ data.tar.gz: 44be8fba43e62006369332839ed1080c49bcdc0860adc9ec77389fb392b1087d
5
5
  SHA512:
6
- metadata.gz: 88e77a2be08addf1f9473821c9a937f7a888c048f13a9c1498cf7acb70fb738668aa528efee852ea739536134fbd2065955d4af8f445734afb8901a22c35ff2e
7
- data.tar.gz: 0d1b6a98450c087fd9bee342a5bb2899ba1e91e0ebacf1d2ebf4d659982c2210fb4dfbfcb2ebf14ed86a1ec774a3ef243f91bb41e9d8fadc7a116e7e63e48e8e
6
+ metadata.gz: 88f734f3318c999a3515ccca81a04218a048f348d144dcfd7f7ec490bf6a3317430212553a585d101a7555fa46efa9d7042ac2f7490b52d72d5f0eec482fc124
7
+ data.tar.gz: b115dfa55c6640c4454316a5a7d986228c805f337074cc07e82973045451337bb7d8b75f3aeb6c53f7a5a129353f49327cadc1a04d683c4262f9c6067ba4834e
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenARM
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- BUGFIX = 1
4
+ BUGFIX = 2
5
5
  DEV = nil
6
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
7
7
  end
@@ -2,8 +2,10 @@ module OrigenARM
2
2
  module Cores
3
3
  class Base
4
4
  include Origen::Model
5
+ attr_reader :cpu_wait_release
5
6
 
6
7
  def initialize(options = {})
8
+ @cpu_wait_release = options[:cpu_wait_release]
7
9
  end
8
10
 
9
11
  #
@@ -16,25 +16,32 @@ module OrigenARM
16
16
  CTI_BASE = 0x0042_0000
17
17
  DBG_BASE = 0x0041_0000
18
18
 
19
+ attr_reader :core_num, :reg_base_core_num_offset
20
+ attr_reader :halt_channel, :release_channel
21
+
19
22
  def initialize(options = {})
23
+ @core_num = options[:core_num] || 0
24
+ @reg_base_core_num_offset = options[:reg_base_core_num_offset] || (0x10_0000 * core_num)
25
+ @halt_channel = options[:halt_channel] || (1 << core_num)
26
+ @release_channel = options[:release_channel] || (4 << core_num)
20
27
  super
21
28
  instantiate_registers(options)
22
29
  end
23
30
 
24
31
  def instantiate_registers(options)
25
- add_reg(:trace_dbg_edprsr, DBG_BASE + TRACE_DBG_EDPRSR_OFFSET, size: 32)
26
- add_reg(:trace_dbg_editr, DBG_BASE + TRACE_DBG_EDITR_OFFSET, size: 32)
27
- add_reg(:trace_dbg_edscr, DBG_BASE + TRACE_DBG_EDSCR_OFFSET, size: 32)
28
- add_reg(:trace_dbg_dtrtx, DBG_BASE + TRACE_DBG_DTRTX_OFFSET, size: 32)
29
- add_reg(:trace_dbg_dtrrx, DBG_BASE + TRACE_DBG_DTRRX_OFFSET, size: 32)
30
- add_reg(:trace_dbg_lar, DBG_BASE + TRACE_LAR_OFFSET, size: 32)
31
- add_reg(:trace_dbg_oslar, DBG_BASE + TRACE_OSLAR_OFFSET, size: 32)
32
- add_reg(:trace_cti_ctrl, CTI_BASE + TRACE_CTI_CTRL_OFFSET, size: 32)
33
- add_reg(:trace_cti_outen0, CTI_BASE + TRACE_CTI_OUTEN0_OFFSET, size: 32)
34
- add_reg(:trace_cti_outen1, CTI_BASE + TRACE_CTI_OUTEN0_OFFSET + 0x4, size: 32)
35
- add_reg(:trace_cti_apppulse, CTI_BASE + TRACE_CTI_APPPULSE_OFFSET, size: 32)
36
- add_reg(:trace_cti_intack, CTI_BASE + TRACE_CTI_INTACK_OFFSET, size: 32)
37
- add_reg(:trace_cti_lar, CTI_BASE + TRACE_LAR_OFFSET, size: 32)
32
+ add_reg(:trace_dbg_edprsr, DBG_BASE + reg_base_core_num_offset + TRACE_DBG_EDPRSR_OFFSET, size: 32)
33
+ add_reg(:trace_dbg_editr, DBG_BASE + reg_base_core_num_offset + TRACE_DBG_EDITR_OFFSET, size: 32)
34
+ add_reg(:trace_dbg_edscr, DBG_BASE + reg_base_core_num_offset + TRACE_DBG_EDSCR_OFFSET, size: 32)
35
+ add_reg(:trace_dbg_dtrtx, DBG_BASE + reg_base_core_num_offset + TRACE_DBG_DTRTX_OFFSET, size: 32)
36
+ add_reg(:trace_dbg_dtrrx, DBG_BASE + reg_base_core_num_offset + TRACE_DBG_DTRRX_OFFSET, size: 32)
37
+ add_reg(:trace_dbg_lar, DBG_BASE + reg_base_core_num_offset + TRACE_LAR_OFFSET, size: 32)
38
+ add_reg(:trace_dbg_oslar, DBG_BASE + reg_base_core_num_offset + TRACE_OSLAR_OFFSET, size: 32)
39
+ add_reg(:trace_cti_ctrl, CTI_BASE + reg_base_core_num_offset + TRACE_CTI_CTRL_OFFSET, size: 32)
40
+ add_reg(:trace_cti_outen0, CTI_BASE + reg_base_core_num_offset + TRACE_CTI_OUTEN0_OFFSET, size: 32)
41
+ add_reg(:trace_cti_outen1, CTI_BASE + reg_base_core_num_offset + TRACE_CTI_OUTEN0_OFFSET + 0x4, size: 32)
42
+ add_reg(:trace_cti_apppulse, CTI_BASE + reg_base_core_num_offset + TRACE_CTI_APPPULSE_OFFSET, size: 32)
43
+ add_reg(:trace_cti_intack, CTI_BASE + reg_base_core_num_offset + TRACE_CTI_INTACK_OFFSET, size: 32)
44
+ add_reg(:trace_cti_lar, CTI_BASE + reg_base_core_num_offset + TRACE_LAR_OFFSET, size: 32)
38
45
  end
39
46
  end
40
47
  end
@@ -2,7 +2,7 @@ module OrigenARM
2
2
  module Cores
3
3
  module CortexA
4
4
  class CA35Controller < OrigenARM::Cores::BaseController
5
- def initialize_core(pc:, release_core: false, **options)
5
+ def initialize_core(pc:, sp: nil, release_core: false, **options)
6
6
  halt_core!
7
7
  set_pc!(pc)
8
8
 
@@ -15,8 +15,8 @@ module OrigenARM
15
15
  ss 'Halt core - channel 0'
16
16
  reg(:trace_cti_lar).write!(0xC5AC_CE55)
17
17
  reg(:trace_cti_ctrl).write!(0x1)
18
- reg(:trace_cti_outen0).write!(0x1)
19
- reg(:trace_cti_apppulse).write!(0x1)
18
+ reg(:trace_cti_outen0).write!(halt_channel)
19
+ reg(:trace_cti_apppulse).write!(halt_channel)
20
20
  tester.cycle(repeat: 10_000)
21
21
 
22
22
  ss 'Check that the core is halted'
@@ -27,7 +27,7 @@ module OrigenARM
27
27
  tester.cycle(repeat: 100)
28
28
 
29
29
  reg(:trace_dbg_lar).write!(0xC5AC_CE55)
30
- reg(:trace_dbg_oslar).write!(0xABCD_1234)
30
+ reg(:trace_dbg_oslar).write!(0)
31
31
  tester.cycle(repeat: 100)
32
32
  end
33
33
 
@@ -35,8 +35,8 @@ module OrigenARM
35
35
  ss 'Release core - channel 2'
36
36
  reg(:trace_cti_lar).write!(0xC5AC_CE55)
37
37
  reg(:trace_cti_ctrl).write!(0x1)
38
- reg(:trace_cti_outen1).write!(0x4)
39
- reg(:trace_cti_apppulse).write!(0x4)
38
+ reg(:trace_cti_outen1).write!(release_channel) # 0x4)
39
+ reg(:trace_cti_apppulse).write!(release_channel) # (0x4)
40
40
  tester.cycle(repeat: 100)
41
41
  ss 'Check that the core has been released'
42
42
  reg(:trace_dbg_edprsr).read!(0x0, mask: 0x0000_0010)
@@ -74,7 +74,7 @@ module OrigenARM
74
74
  # XPSR
75
75
  # Note: This register also seems mostly stable across the entire
76
76
  # CortexM family, but may need to be revisited as more cores are added.
77
- dut.add_reg(:xpsr, 0x0, size: 32, description: 'Combined Program Status Register. Combination of APSR, EPSR, and IPSR Registers on Other ARM Cores.') do |r|
77
+ dut.add_reg(:xpsr, 0x10, size: 32, description: 'Combined Program Status Register. Combination of APSR, EPSR, and IPSR Registers on Other ARM Cores.') do |r|
78
78
  r.bits 31, :n, description: 'Negative flag. Reads or writes the current value of APSR.N.'
79
79
  r.bits 30, :z, description: 'Zero flag. Reads or writes the current value of APSR.Z.'
80
80
  r.bits 29, :c, description: 'Carry flag. Reads or writes the current value of APSR.C.'
@@ -14,8 +14,9 @@ module OrigenARM
14
14
  # @param sp_lower_limit [Fixnum] Sets stack pointer's lower limit.
15
15
  # @param sp_upper_limit [Fixnum] Sets stack pointer's upper limit.
16
16
  # @todo Implement lower and upper stack pointer limit setting.
17
- def initialize_core(pc:, sp:, release_core: false, sp_lower_limit: nil, sp_upper_limit: nil)
18
- enter_debug_mode
17
+ # rubocop:disable Metrics/ParameterLists
18
+ def initialize_core(pc:, sp:, release_core: false, sp_lower_limit: nil, sp_upper_limit: nil, release_cpu_wait: true)
19
+ enter_debug_mode(release_cpu_wait: release_cpu_wait)
19
20
 
20
21
  # clear_state
21
22
  # clear_state
@@ -38,13 +39,14 @@ module OrigenARM
38
39
  # reg(:aircr).bits(:sysresetreq).write(1)
39
40
  # reg(:aircr).write!
40
41
  end
42
+ # rubocop:enable Metrics/ParameterLists
41
43
  alias_method :initialize_for_lre, :initialize_core
42
44
 
43
45
  # Enters the core's debug mode.
44
46
  # @param halt_core [true, false] Indicates whether the core should be held when entering debug mode.
45
47
  # Some functionality may not work correctly if the core is not halted,
46
48
  # but a halted core is not a requirement for debug mode.
47
- def enter_debug_mode(halt_core: true)
49
+ def enter_debug_mode(halt_core: true, release_cpu_wait: true)
48
50
  pp('Entering Debug Mode...') do
49
51
  reg(:dhcsr).bits(:dbgkey).write(OrigenARM::Cores::CortexM::CM33::Registers::DHCSR_DBGKEY)
50
52
  reg(:dhcsr).bits(:c_debugen).write(1)
@@ -59,6 +61,12 @@ module OrigenARM
59
61
  reg(:dhcsr).write!
60
62
  enter_debug_mode_delay!
61
63
  end
64
+
65
+ if release_cpu_wait
66
+ if cpu_wait_release
67
+ cpu_wait_release.call(self)
68
+ end
69
+ end
62
70
  end
63
71
  end
64
72
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_arm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Engelken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-08 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -86,8 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: 1.8.11
88
88
  requirements: []
89
- rubyforge_project:
90
- rubygems_version: 2.7.6
89
+ rubygems_version: 3.1.4
91
90
  signing_key:
92
91
  specification_version: 4
93
92
  summary: Origen subblocks modeling ARM cores.