origen 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa35579495bf10b17e26daa07762d997834931d0
4
- data.tar.gz: b31c04ce31fd8f75054da7696f9158bcbe93e225
3
+ metadata.gz: 355a5d755ad608e02b9d2676a281a938f3963223
4
+ data.tar.gz: e2632fa01a0af74099c01d2b972f4e77567dd139
5
5
  SHA512:
6
- metadata.gz: e2be498edb881b314e50db159168f3e11537a29defe4f1117a4d81a0084fa2594f1fc9e443158d22b777614d13c93b5ea0b6c244d0f022ba547167ff8f327184
7
- data.tar.gz: 142048906f8c6dcbd4a0ce163d6f8283c89e91e6e0be4fbd2962dfe06e6b2f610da8b856cfc17b360ca0b009411e4f575433343b5a6ff2e8fc2d566f8ab6dec9
6
+ metadata.gz: 7182ff153b5811d71e43b327db0b8b9bbebbbddf1ceed51ee337b2bc44ae02a9d592cc010f9c9000e44445b481412a9aed7b73f429009bfbb305aa384ff51ad0
7
+ data.tar.gz: fc9a2a22b42be0d5a31b29a0f22bbf3d933c0dea90cafa90c22398db90a58324063556bce9d6f5aae1e286c33b83a320bbc2397d4831bc3f56b618f7ad2fe862
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
3
  MINOR = 5
4
- BUGFIX = 0
4
+ BUGFIX = 1
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -552,6 +552,7 @@ module Origen
552
552
  # if tester && obj
553
553
  # raise "You can only instantiate 1 tester, you have already created an instance of #{tester.class}}"
554
554
  # end
555
+ $tester = obj
555
556
  set_dynamic_resource(:tester, [obj])
556
557
  end
557
558
 
data/lib/origen/model.rb CHANGED
@@ -269,6 +269,22 @@ module Origen
269
269
  result
270
270
  end
271
271
 
272
+ # Used to proxy all method and attribute requests not implemented on the model
273
+ # to the controller.
274
+ #
275
+ # On first call of a missing method a method is generated to avoid the missing lookup
276
+ # next time, this should be faster for repeated lookups of the same method, e.g. reg
277
+ def method_missing(method, *args, &block)
278
+ if controller.respond_to?(method)
279
+ define_singleton_method(method) do |*args, &block|
280
+ controller.send(method, *args, &block)
281
+ end
282
+ send(method, *args, &block)
283
+ else
284
+ super
285
+ end
286
+ end
287
+
272
288
  private
273
289
 
274
290
  def _modes
@@ -618,12 +618,13 @@ module Origen
618
618
  end
619
619
 
620
620
  def write_register_missing!(reg)
621
+ klass = (try(:controller) || self).class
621
622
  puts ''
622
623
  puts ''
623
624
  puts <<-EOT
624
- You have made a request to write register: #{reg.name}, however the #{self.class}
625
- class does not know how to do this yet. You must implement a write_register
626
- method in the #{self.class} like this:
625
+ You have made a request to write register: #{reg.name}, however the #{klass}
626
+ class does not know how to do this yet. You should implement a write_register
627
+ method in the #{klass} like this:
627
628
 
628
629
  def write_register(reg, options={})
629
630
  <logic to handle the writing of the reg object here>
@@ -634,12 +635,13 @@ method in the #{self.class} like this:
634
635
  end
635
636
 
636
637
  def read_register_missing!(reg)
638
+ klass = (try(:controller) || self).class
637
639
  puts ''
638
640
  puts ''
639
641
  puts <<-EOT
640
- You have made a request to read register: #{reg.name}, however the #{self.class}
641
- class does not know how to do this yet. You must implement a read_register
642
- method in the #{self.class} like this:
642
+ You have made a request to read register: #{reg.name}, however the #{klass}
643
+ class does not know how to do this yet. You should implement a read_register
644
+ method in the #{klass} like this:
643
645
 
644
646
  def read_register(reg, options={})
645
647
  <logic to handle reading the reg object here>
@@ -320,6 +320,7 @@ module Origen
320
320
  @read = true if @readable && @read_data_matches_write
321
321
  self
322
322
  end
323
+ alias_method :assert, :read
323
324
 
324
325
  # Sets the store flag attribute
325
326
  def store
@@ -255,6 +255,7 @@ module Origen
255
255
  end
256
256
  self
257
257
  end
258
+ alias_method :assert, :read
258
259
 
259
260
  # Returns a value representing the bit collection / register where a bit value of
260
261
  # 1 means the bit is enabled for the given operation.
@@ -387,6 +388,7 @@ module Origen
387
388
  @reg.request(:read_register, options)
388
389
  self
389
390
  end
391
+ alias_method :assert!, :read!
390
392
 
391
393
  # Normally whenever a register is processed by the $top.read_register method
392
394
  # it will call Reg#clear_flags to acknowledge that the read has been performed,
@@ -656,10 +656,10 @@ module Origen
656
656
  def request(operation, options = {}) # :nodoc:
657
657
  if operation == :read_register
658
658
  object = reader
659
- owner.read_register_missing!(self) unless object
659
+ (Origen.top_level || owner).read_register_missing!(self) unless object
660
660
  else
661
661
  object = writer
662
- owner.write_register_missing!(self) unless object
662
+ (Origen.top_level || owner).write_register_missing!(self) unless object
663
663
  end
664
664
  object.send(operation, self, options)
665
665
  self
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.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty