origen_ahb 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: 06d5486adbf227d790c21a749776bb37f6b8fcb5
4
- data.tar.gz: 507d86514f3aefd1354aabfe50faba3279cd1a4b
3
+ metadata.gz: b2ed1c06cd02df81855eb2e585c01b199dae234a
4
+ data.tar.gz: 5d82e6df1f9ec407f2c4a958756db5b3cb2400eb
5
5
  SHA512:
6
- metadata.gz: 6fac1e5cd87620dc41baf47a6dde3a0109547e4f970ca3e9eacef5f7497884eb42444aa89e627c5f5e6ac2689b5c644b20449d572b7d2eea3eb0ef08872f0e36
7
- data.tar.gz: a88de68b04fd8aac082a1ed259a79d46cc9a09102ea0fd193fa12a447560be845e33ce7184486231353577ee6afff70b5037fca0a0294c1aba7b07ea75ddae4f
6
+ metadata.gz: baec50e73bc25a6937148f3d17d156010f1af98ee5cb29db5b3fdb436d718a585aa2c8b1f10452d696170cc9e4d77b05645ef364ccd0be4fbb39289010fbef6d
7
+ data.tar.gz: 96e2278fbb8904d5e221e1f71967be0b370a350302864a79b72bd81f649a9f0393e5d079f7325c89c1211d5c862f609f9135f0a3c6fef80a131a55d0505334bc
@@ -25,7 +25,7 @@ when 'specs'
25
25
  exit RSpec::Core::Runner.run(['spec'])
26
26
 
27
27
 
28
- when 'examples'
28
+ when 'examples', 'test'
29
29
  Origen.load_application
30
30
  status = 0
31
31
 
@@ -44,6 +44,12 @@ when 'examples'
44
44
  status = 1
45
45
  end
46
46
  puts
47
+ if @command == 'test'
48
+ Origen.app.unload_target!
49
+ require 'rspec'
50
+ result = RSpec::Core::Runner.run(['spec'])
51
+ status = status == 1 ? 1 : result
52
+ end
47
53
  exit status # Exit with a 1 on the event of a failure per std unix result codes
48
54
 
49
55
  # Always leave an else clause to allow control to fall back through to the
@@ -52,6 +58,7 @@ else
52
58
  @application_commands = <<-EOT
53
59
  specs Run the specs (tests), -c will enable coverage
54
60
  examples Run the examples (tests), -c will enable coverage
61
+ test Run both specs and examples, -c will enable coverage
55
62
  EOT
56
63
 
57
64
  end
@@ -1,7 +1,7 @@
1
1
  module OrigenAhb
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- BUGFIX = 2
4
+ BUGFIX = 3
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -2,10 +2,14 @@ module OrigenAhb
2
2
  class Driver
3
3
  attr_reader :owner
4
4
 
5
+ # Initialize owner
5
6
  def initialize(owner, options = {})
6
7
  @owner = owner
7
8
  end
8
9
 
10
+ # Read register. Handles register model as input or data/address pair.
11
+ # Sets up AHB parameters values and passes along to pin-layer ahb
12
+ # transaction method.
9
13
  def read_register(reg_or_val, options = {})
10
14
  options = {
11
15
  haddr: options[:address] || reg_or_val.address,
@@ -29,6 +33,9 @@ module OrigenAhb
29
33
  $dut.ahb_trans(options)
30
34
  end
31
35
 
36
+ # Read register. Handles register model as input or data/address pair.
37
+ # Sets up AHB parameters values and passes along to pin-layer ahb
38
+ # transaction method.
32
39
  def write_register(reg_or_val, options = {})
33
40
  options = {
34
41
  haddr: options[:address] || reg_or_val.address,
@@ -52,6 +59,7 @@ module OrigenAhb
52
59
  $dut.ahb_trans(options)
53
60
  end
54
61
 
62
+ # Convert bit width to HSIZE
55
63
  def get_hsize(size)
56
64
  if size <= 8
57
65
  hsize = 0
@@ -1,11 +1,14 @@
1
1
  module OrigenAhbDev
2
+ # Dummy sub-block for inclusion in top-level dut
2
3
  class BLOCK
3
4
  include Origen::Model
4
5
 
6
+ # Initialize block
5
7
  def initialize(options = {})
6
8
  instantiate_registers(options)
7
9
  end
8
10
 
11
+ # Create block-level registers
9
12
  def instantiate_registers(options = {})
10
13
  add_reg :control, 0x00, 32, data: { pos: 0, bits: 32 }
11
14
  add_reg :status, 0x04, 32, data: { pos: 0, bits: 32 }
@@ -1,14 +1,17 @@
1
1
  module OrigenAhbDev
2
+ # Top-level chip model for development and unit testing
2
3
  class DUT
3
4
  include Origen::TopLevel
4
5
  include OrigenAhb
5
6
 
7
+ # Initializer method to setup dut
6
8
  def initialize(options = {})
7
9
  instantiate_pins(options)
8
10
  instantiate_registers(options)
9
11
  instantiate_sub_blocks(options)
10
12
  end
11
13
 
14
+ # Add standard DUT pins and pins necessary for AHB protocol
12
15
  def instantiate_pins(options = {})
13
16
  # Standard DUT pins
14
17
  add_pin :tclk
@@ -33,10 +36,12 @@ module OrigenAhbDev
33
36
  add_pin :hrdata, size: 32
34
37
  end
35
38
 
39
+ # Create a top-level test register
36
40
  def instantiate_registers(options = {})
37
41
  add_reg :top_reg, 0x20000000, 32, data: { pos: 0, bits: 32 }
38
42
  end
39
43
 
44
+ # Create a sub-block for test dut
40
45
  def instantiate_sub_blocks(options = {})
41
46
  sub_block :block, class_name: 'OrigenAhbDev::BLOCK', base_address: 0x2200_0000
42
47
  end
@@ -2,6 +2,7 @@ module OrigenAhbDev
2
2
  class DUTController
3
3
  include Origen::Controller
4
4
 
5
+ # Method called on any pattern startup to init timeset and pin values
5
6
  def startup(options = {})
6
7
  tester.set_timeset('ahb', 40)
7
8
 
@@ -13,6 +14,7 @@ module OrigenAhbDev
13
14
  pin(:resetb).drive(1)
14
15
  end
15
16
 
17
+ # Method called on any pattern shutdown to leave pin values in known state
16
18
  def shutdown(options = {})
17
19
  # Shut everything down
18
20
  tester.wait time_in_ns: 250
@@ -21,6 +23,7 @@ module OrigenAhbDev
21
23
  cleanup_pins # Give patterns a known exit condition
22
24
  end
23
25
 
26
+ # Set pins to initial pin value
24
27
  def init_pins
25
28
  pin(:resetb).drive(0)
26
29
  pin(:tclk).drive(0)
@@ -29,6 +32,7 @@ module OrigenAhbDev
29
32
  pin(:tdo).dont_care
30
33
  end
31
34
 
35
+ # Set pins to safe state for pattern end
32
36
  def cleanup_pins
33
37
  pin(:resetb).drive(0)
34
38
  pin(:tclk).drive(0)
@@ -37,14 +41,17 @@ module OrigenAhbDev
37
41
  pin(:tdo).dont_care
38
42
  end
39
43
 
40
- def write_register(reg, options = {})
41
- ahb.write_register(reg, options)
44
+ # Dut-level register write using AHB driver
45
+ def write_register(reg_or_val, options = {})
46
+ ahb.write_register(reg_or_val, options)
42
47
  end
43
48
 
44
- def read_register(reg, options = {})
45
- ahb.read_register(reg, options)
49
+ # Dut-level register read using AHB driver
50
+ def read_register(reg_or_val, options = {})
51
+ ahb.read_register(reg_or_val, options)
46
52
  end
47
53
 
54
+ # Pin driver layer of AHB protocol, used by AHB
48
55
  def ahb_trans(options = {})
49
56
  pin(:hclk).drive(0)
50
57
  pins(:htrans).drive(0)
@@ -1,9 +1,15 @@
1
1
  Pattern.create do
2
2
 
3
- cc 'Write to top-level register'
3
+ cc 'Write to top-level register using reg model'
4
4
  $dut.reg(:top_reg).write!(0x5555_AAAA)
5
5
 
6
- cc 'Write to block-level register'
6
+ cc 'Write to top-level register using data/address'
7
+ $dut.write_register(0xAAAA_5555, address: 0x20000000)
8
+
9
+ cc 'Read from top-level register using data/address'
10
+ $dut.read_register(0xAAAA_5555, address: 0x20000000)
11
+
12
+ cc 'Write to block-level register'
7
13
  $dut.block.reg(:control).write!(0xBA5E_BA11)
8
14
 
9
15
  cc 'Read from block-level register'
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_ahb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris P Nappi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-21 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.7'
27
27
  - !ruby/object:Gem::Dependency