origen 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/version.rb +1 -1
- data/lib/origen/memory.rb +50 -0
- data/lib/origen/model.rb +13 -4
- data/lib/origen/model_initializer.rb +1 -1
- data/lib/origen/ports.rb +1 -1
- data/lib/origen/registers/bit_collection.rb +13 -2
- data/lib/origen/registers.rb +8 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a60b5bfd209deedf03b7570995fc99a7b3b7a8b
|
4
|
+
data.tar.gz: b5e59ccbdd265391a4f112e815a14611bde2a5b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b698ff5114c367f2ada6b9558e3f89a66fb2e52cc7ee8c1af5611861c77731c77283f364e0260f6f7a2b996f0636b3904190df072fe92cd41e582aa0f245665
|
7
|
+
data.tar.gz: 7b44b93ef1e695cb88b72d89fe2e2bd01722c97b69e8aa133b4434a565063722caa8603498800e2d95afe82f4a2556d8284f6d3870a96f9a9df086b202eb5d3b
|
data/config/version.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
module Origen
|
2
|
+
module Memory
|
3
|
+
def memory(address, options = {})
|
4
|
+
if is_top_level?
|
5
|
+
r = "mem_#{address.to_s(16)}".to_sym
|
6
|
+
unless has_reg?(r)
|
7
|
+
if memory_address_aligned?(address)
|
8
|
+
add_reg r, address, size: memory_width
|
9
|
+
end
|
10
|
+
end
|
11
|
+
send(r)
|
12
|
+
else
|
13
|
+
Origen.top_level.memory(address + base_address, options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
alias_method :mem, :memory
|
17
|
+
|
18
|
+
def memory_address_aligned?(address)
|
19
|
+
b = (memory_width / 8) - 1
|
20
|
+
unless address & b == 0
|
21
|
+
s = b - 1
|
22
|
+
aligned = (address >> s) << s
|
23
|
+
fail "Address #{address.to_hex} is not aligned to the memory width, it should be #{aligned.to_hex}"
|
24
|
+
end
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
def memory_width
|
29
|
+
if is_top_level?
|
30
|
+
@memory_width ||= 32
|
31
|
+
else
|
32
|
+
Origen.top_level.memory_width
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def memory_width=(size)
|
37
|
+
if is_top_level?
|
38
|
+
unless size % 8 == 0
|
39
|
+
fail 'Memory width must be a multiple of 8'
|
40
|
+
end
|
41
|
+
if @memory_width
|
42
|
+
fail 'The memory width cannot be changed after a memory location has been referenced'
|
43
|
+
end
|
44
|
+
@memory_width = size
|
45
|
+
else
|
46
|
+
Origen.top_level.memory_width = size
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/origen/model.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_support/concern'
|
2
|
+
require 'origen/memory'
|
2
3
|
module Origen
|
3
4
|
# Include this module to identify it as an SoC IP Block, this will automatically
|
4
5
|
# include common modules such as Pin and Register support
|
@@ -21,6 +22,7 @@ module Origen
|
|
21
22
|
include Origen::Specs
|
22
23
|
include Origen::Ports
|
23
24
|
include Origen::Netlist
|
25
|
+
include Origen::Memory
|
24
26
|
end
|
25
27
|
|
26
28
|
module ClassMethods
|
@@ -41,6 +43,12 @@ module Origen
|
|
41
43
|
true
|
42
44
|
end
|
43
45
|
|
46
|
+
# Returns true if the model is the current DUT/top-level model
|
47
|
+
def is_top_level?
|
48
|
+
Origen.top_level == self
|
49
|
+
end
|
50
|
+
alias_method :is_dut?, :is_top_level?
|
51
|
+
|
44
52
|
# Means that when dealing with a controller/model pair, you can
|
45
53
|
# always call obj.model and obj.controller to get the one you want,
|
46
54
|
# regardless of the one you currently have.
|
@@ -295,9 +303,10 @@ module Origen
|
|
295
303
|
end
|
296
304
|
end
|
297
305
|
|
306
|
+
# @api private
|
298
307
|
# Returns true after the model's initialize method has been run
|
299
|
-
def
|
300
|
-
!!@
|
308
|
+
def _initialized?
|
309
|
+
!!@_initialized
|
301
310
|
end
|
302
311
|
|
303
312
|
def clock!
|
@@ -319,8 +328,8 @@ module Origen
|
|
319
328
|
|
320
329
|
private
|
321
330
|
|
322
|
-
def
|
323
|
-
@
|
331
|
+
def _initialized
|
332
|
+
@_initialized = true
|
324
333
|
end
|
325
334
|
|
326
335
|
def _controller=(controller)
|
@@ -29,7 +29,7 @@ module Origen
|
|
29
29
|
else
|
30
30
|
x.send(:initialize, *args, &block)
|
31
31
|
end
|
32
|
-
x.send(:
|
32
|
+
x.send(:_initialized) if x.respond_to?(:is_an_origen_model?)
|
33
33
|
x.register_callback_listener if x.respond_to?(:register_callback_listener)
|
34
34
|
# Do this before wrapping, otherwise the respond to method in the controller will
|
35
35
|
# be looking for the model to be instantiated when it is not fully done yet
|
data/lib/origen/ports.rb
CHANGED
@@ -96,7 +96,8 @@ module Origen
|
|
96
96
|
#
|
97
97
|
# Normally this method should be called from a breakpoint during pattern debug, and it is
|
98
98
|
# not intended to be inserted into production pattern logic.
|
99
|
-
def sync
|
99
|
+
def sync(size = nil, options = {})
|
100
|
+
size, options = nil, size if size.is_a?(Hash)
|
100
101
|
if tester.try(:link?)
|
101
102
|
preserve_flags do
|
102
103
|
v = tester.capture do
|
@@ -106,11 +107,21 @@ module Origen
|
|
106
107
|
bit.write(v.first[i])
|
107
108
|
end
|
108
109
|
end
|
109
|
-
|
110
|
+
if size
|
111
|
+
puts "#{parent.address.to_s(16).upcase}: " + data.to_s(16).upcase.rjust(Origen.top_level.memory_width / 4, '0')
|
112
|
+
if size > 1
|
113
|
+
step = Origen.top_level.memory_width / 8
|
114
|
+
Origen.top_level.mem(parent.address + step).sync(size - 1)
|
115
|
+
end
|
116
|
+
nil
|
117
|
+
else
|
118
|
+
parent
|
119
|
+
end
|
110
120
|
else
|
111
121
|
Origen.log.warning 'Sync is not supported on the current tester driver, register not updated'
|
112
122
|
end
|
113
123
|
end
|
124
|
+
alias_method :sync!, :sync
|
114
125
|
|
115
126
|
# At the end of the given block, the status flags of all bits will be restored to the state that
|
116
127
|
# they were upon entry to the block
|
data/lib/origen/registers.rb
CHANGED
@@ -27,8 +27,14 @@ module Origen
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def method_missing(method, *args, &block) # :nodoc:
|
30
|
+
if method[-1] == '!'
|
31
|
+
bang = true
|
32
|
+
method = method.to_s.chop.to_sym
|
33
|
+
end
|
30
34
|
if _registers.key?(method)
|
31
|
-
reg(method)
|
35
|
+
r = reg(method)
|
36
|
+
r.sync if bang
|
37
|
+
r
|
32
38
|
else
|
33
39
|
super
|
34
40
|
end
|
@@ -478,7 +484,7 @@ module Origen
|
|
478
484
|
# Can also be used to define a new register if a block is supplied in which case
|
479
485
|
# it is equivalent to calling add_reg with a block.
|
480
486
|
def reg(*args, &block)
|
481
|
-
if block_given? || (args[1].is_a?(Fixnum) && !try(:
|
487
|
+
if block_given? || (args[1].is_a?(Fixnum) && !try(:_initialized?))
|
482
488
|
@reg_define_file = define_file(caller[0])
|
483
489
|
add_reg(*args, &block)
|
484
490
|
else
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
@@ -528,6 +528,7 @@ files:
|
|
528
528
|
- lib/origen/location/map.rb
|
529
529
|
- lib/origen/log.rb
|
530
530
|
- lib/origen/logger_methods.rb
|
531
|
+
- lib/origen/memory.rb
|
531
532
|
- lib/origen/mode.rb
|
532
533
|
- lib/origen/model.rb
|
533
534
|
- lib/origen/model_initializer.rb
|