origen 0.26.0 → 0.27.0

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: acdfacb78dd1389f6c42d6e77b8b311f44a424c0
4
- data.tar.gz: 91c007f2243274a27202049375088256448d9b53
3
+ metadata.gz: 1bd96773b56519ca3c588ba06ddd2db770a6a3b8
4
+ data.tar.gz: 68f3a9c05792dde205b99001d9cece88c0d1d98b
5
5
  SHA512:
6
- metadata.gz: 29c5b7ca4267fe59b675b2250805dfeaa361601ca64f34b36ac3c68244cff7600b9e37477dd645c02f53930672ad2daf78ef648021bcb8759a1ec2a6f0e68835
7
- data.tar.gz: 77a5dc8760bcad34b0b356796ad722269dbe4396c3e888d8f3330ef768dcf168d7fde8ccfac28fb644f896f20e977527f05dc786adbfd80d791fd727f3c2a386
6
+ metadata.gz: 87cb67532f2c74ec3e83ba6502d527517d95a1fd96a6066a9ef11f9675cb0221c951beec990cced059914bd27a7c3e14a90c66fbc0e910b96aed77c5fb8150b5
7
+ data.tar.gz: 8a1adf271a8d4f3d2f2d0f66be8e92a957ca00278ce4a9557a8b4fec015b106221469754d8dafbc2f782cd4a4728facd533985d3f5e182016b4c38f30564334f
data/config/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 26
3
+ MINOR = 27
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
6
 
data/lib/origen.rb CHANGED
@@ -29,41 +29,42 @@ unless defined? RGen::ORIGENTRANSITION
29
29
  require 'origen/undefined'
30
30
 
31
31
  module Origen
32
- autoload :Features, 'origen/features'
33
- autoload :Bugs, 'origen/bugs'
34
- autoload :Generator, 'origen/generator'
35
- autoload :Pins, 'origen/pins'
36
- autoload :Registers, 'origen/registers'
37
- autoload :Ports, 'origen/ports'
38
- autoload :Users, 'origen/users'
39
- autoload :FileHandler, 'origen/file_handler'
32
+ autoload :Features, 'origen/features'
33
+ autoload :Bugs, 'origen/bugs'
34
+ autoload :Generator, 'origen/generator'
35
+ autoload :Pins, 'origen/pins'
36
+ autoload :Registers, 'origen/registers'
37
+ autoload :Ports, 'origen/ports'
38
+ autoload :Users, 'origen/users'
39
+ autoload :FileHandler, 'origen/file_handler'
40
40
  autoload :RegressionManager, 'origen/regression_manager'
41
- autoload :Location, 'origen/location'
42
- autoload :VersionString, 'origen/version_string'
43
- autoload :Mode, 'origen/mode'
44
- autoload :ChipMode, 'origen/chip_mode'
45
- autoload :ChipPackage, 'origen/chip_package'
46
- autoload :Client, 'origen/client'
47
- autoload :SubBlocks, 'origen/sub_blocks'
48
- autoload :SubBlock, 'origen/sub_blocks'
41
+ autoload :Location, 'origen/location'
42
+ autoload :VersionString, 'origen/version_string'
43
+ autoload :Mode, 'origen/mode'
44
+ autoload :ChipMode, 'origen/chip_mode'
45
+ autoload :ChipPackage, 'origen/chip_package'
46
+ autoload :Client, 'origen/client'
47
+ autoload :SubBlocks, 'origen/sub_blocks'
48
+ autoload :SubBlock, 'origen/sub_blocks'
49
49
  autoload :ModelInitializer, 'origen/model_initializer'
50
- autoload :Controller, 'origen/controller'
51
- autoload :Database, 'origen/database'
52
- autoload :Parameters, 'origen/parameters'
53
- autoload :RevisionControl, 'origen/revision_control'
54
- autoload :Specs, 'origen/specs'
55
- autoload :CodeGenerators, 'origen/code_generators'
56
- autoload :Encodings, 'origen/encodings'
57
- autoload :Log, 'origen/log'
58
- autoload :Chips, 'origen/chips'
59
- autoload :Netlist, 'origen/netlist'
60
- autoload :Models, 'origen/models'
61
- autoload :Errata, 'origen/errata'
62
- autoload :LSF, 'origen/application/lsf'
63
- autoload :LSFManager, 'origen/application/lsf_manager'
64
- autoload :Fuses, 'origen/fuses'
65
- autoload :Tests, 'origen/tests'
66
- autoload :PowerDomains, 'origen/power_domains'
50
+ autoload :Controller, 'origen/controller'
51
+ autoload :Database, 'origen/database'
52
+ autoload :Parameters, 'origen/parameters'
53
+ autoload :RevisionControl, 'origen/revision_control'
54
+ autoload :Specs, 'origen/specs'
55
+ autoload :CodeGenerators, 'origen/code_generators'
56
+ autoload :Encodings, 'origen/encodings'
57
+ autoload :Log, 'origen/log'
58
+ autoload :Chips, 'origen/chips'
59
+ autoload :Netlist, 'origen/netlist'
60
+ autoload :Models, 'origen/models'
61
+ autoload :Errata, 'origen/errata'
62
+ autoload :LSF, 'origen/application/lsf'
63
+ autoload :LSFManager, 'origen/application/lsf_manager'
64
+ autoload :Fuses, 'origen/fuses'
65
+ autoload :Tests, 'origen/tests'
66
+ autoload :PowerDomains, 'origen/power_domains'
67
+ autoload :Clocks, 'origen/clocks'
67
68
 
68
69
  attr_reader :switch_user
69
70
 
@@ -0,0 +1,23 @@
1
+ require_relative './clocks/clock'
2
+ require_relative './clocks/clocks_collection'
3
+ module Origen
4
+ module Clocks
5
+ def clocks(expr = nil)
6
+ @_clocks ||= ClocksCollection.new
7
+ if expr.nil?
8
+ @_clocks
9
+ else
10
+ @_clocks.recursive_find_by_key(expr)
11
+ end
12
+ end
13
+
14
+ def add_clock(id, options = {}, &block)
15
+ if clocks.include?(id)
16
+ Origen.log.error("Cannot create clock '#{id}', it already exists!")
17
+ fail
18
+ end
19
+ clocks[id] = Clock.new(id, self, options, &block)
20
+ end
21
+ alias_method :clock, :add_clock
22
+ end
23
+ end
@@ -0,0 +1,184 @@
1
+ module Origen
2
+ module Clocks
3
+ class Clock
4
+ attr_accessor :id, :owner, :users, :startup_freq, :nominal_freq, :frequency_range, :setpoint
5
+
6
+ def initialize(id, owner, options = {}, &block)
7
+ @id = id
8
+ @owner = owner
9
+ @id = @id.symbolize unless id.is_a? Symbol
10
+ options.each { |k, v| instance_variable_set("@#{k}", v) }
11
+ (block.arity < 1 ? (instance_eval(&block)) : block.call(self)) if block_given?
12
+ @users = [@users] unless @users.is_a? Array
13
+ instantiate_users
14
+ end
15
+
16
+ def name
17
+ @id
18
+ end
19
+
20
+ # Returns an Array of IPs that use a clock
21
+ def users
22
+ @users
23
+ end
24
+ alias_method :ips, :users
25
+ alias_method :sub_blocks, :users
26
+
27
+ def setpoint=(val)
28
+ setpoint_ok?
29
+ @setpoint = val
30
+ end
31
+
32
+ def setpoint_ok?(val = nil)
33
+ return nil if val.nil? && setpoint.nil?
34
+ if freq_range == :fixed
35
+ if val.nil? || val == nominal_frequency
36
+ return true
37
+ else
38
+ Origen.log.warn("Clock '#{id}' is a fixed clock with a nominal frequency of #{nominal_frequency.as_Hz}, setting it to #{val.as_Hz}")
39
+ return false
40
+ end
41
+ else
42
+ val = setpoint if val.nil?
43
+ if freq_range.include?(val)
44
+ return true
45
+ else
46
+ Origen.log.warn("Setpoint (#{setpoint_string(val)}) for clock '#{id}' is not within the frequency range (#{freq_range_string}), setting it to #{val.as_Hz}")
47
+ return false
48
+ end
49
+ end
50
+ end
51
+ alias_method :value_ok?, :setpoint_ok?
52
+ alias_method :val_ok?, :setpoint_ok?
53
+
54
+ # Set the clock to the nominal frequency
55
+ def setpoint_to_nominal
56
+ @setpoint = nominal_frequency
57
+ end
58
+
59
+ # Nominal frequency
60
+ def nominal_frequency
61
+ @nominal_frequency
62
+ end
63
+ alias_method :nominal, :nominal_frequency
64
+ alias_method :nom, :nominal_frequency
65
+
66
+ # Current setpoint, defaults top nil on init
67
+ def setpoint
68
+ @setpoint
69
+ end
70
+ alias_method :curr_value, :setpoint
71
+ alias_method :value, :setpoint
72
+
73
+ # Acceptable frequency range
74
+ def frequency_range
75
+ @frequency_range
76
+ end
77
+ alias_method :freq_range, :frequency_range
78
+ alias_method :range, :frequency_range
79
+
80
+ # Check if the clock users are defined anywhere in the DUT
81
+ def users_defined?
82
+ undefined_ips = ips - Origen.all_sub_blocks
83
+ if undefined_ips.empty?
84
+ return true
85
+ else
86
+ Origen.log.warn("Clock '#{id}' has the following IP undefined: #{undefined_ips}")
87
+ return false
88
+ end
89
+ end
90
+
91
+ def method_missing(m, *args, &block)
92
+ ivar = "@#{m.to_s.gsub('=', '')}"
93
+ ivar_sym = ":#{ivar}"
94
+ if m.to_s =~ /=$/
95
+ define_singleton_method(m) do |val|
96
+ instance_variable_set(ivar, val)
97
+ end
98
+ elsif instance_variables.include? ivar_sym
99
+ instance_variable_get(ivar)
100
+ else
101
+ define_singleton_method(m) do
102
+ instance_variable_get(ivar)
103
+ end
104
+ end
105
+ send(m, *args, &block)
106
+ end
107
+
108
+ private
109
+
110
+ # Instantiate and IP/users that use/access the clock
111
+ def instantiate_users
112
+ users.each do |ip|
113
+ if owner.respond_to? ip
114
+ next
115
+ else
116
+ owner.sub_block ip
117
+ end
118
+ end
119
+ end
120
+
121
+ # Ensure attributes are the correct type
122
+ def attrs_ok?
123
+ return_value = true
124
+ unless description.is_a? String
125
+ Origen.log.error("Clock attribute 'description' must be a String!")
126
+ return_value = false
127
+ end
128
+ return_value = false unless frequencies_ok?
129
+ return_value
130
+ end
131
+
132
+ def frequencies_ok?
133
+ if nominal_frequency.nil?
134
+ false
135
+ elsif frequency_range.nil?
136
+ Origen.log.error("Missing frequency range for clock '#{name}'!")
137
+ false
138
+ elsif frequency_range.is_a? Range
139
+ if frequency_range.include?(nominal_frequency)
140
+ true
141
+ else
142
+ Origen.log.error("PPEKit: Nominal frequency #{nominal_frequency} is not inbetween the frequency range #{frequency_range} for clock '#{name}'!")
143
+ false
144
+ end
145
+ else
146
+ Origen.log.error("Clock attribute 'frequency_range' must be a Range!")
147
+ return_value = false
148
+ end
149
+ end
150
+
151
+ def setpoint_string(val = nil)
152
+ if val.nil?
153
+ @setpoint.as_Hz unless @setpoint.nil?
154
+ else
155
+ val.as_Hz
156
+ end
157
+ end
158
+
159
+ def freq_range_string
160
+ start_freq = freq_range.first
161
+ end_freq = freq_range.last
162
+ "#{start_freq.as_Hz}\.\.#{end_freq.as_Hz}"
163
+ end
164
+
165
+ def clock_freqs_ok?
166
+ if nominal_freq.nil?
167
+ false
168
+ elsif freq_range == :fixed
169
+ true
170
+ else
171
+ if freq_range.nil?
172
+ Origen.log.error("PPEKit: Missing frequency target or range for clock '#{id}'!")
173
+ false
174
+ elsif freq_range.include?(nominal_freq)
175
+ true
176
+ else
177
+ Origen.log.error("PPEKit: Frequency target #{nominal_freq} is not inbetween the freq range #{freq_range} for clock '#{id}'!")
178
+ false
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end
@@ -0,0 +1,74 @@
1
+ require 'colorize'
2
+ module Origen
3
+ module Clocks
4
+ class ClocksCollection < Hash
5
+ ConsoleValue = Struct.new(:value, :color)
6
+
7
+ def inspect(options = {})
8
+ options = {
9
+ fancy_output: true
10
+ }.update(options)
11
+ headers = []
12
+ output_clock_list = []
13
+ column_widths = {}.tap do |colhash|
14
+ each do |clk_name, clk|
15
+ output_attr_list = {}
16
+ clk.instance_variables.each do |attr|
17
+ value_color = :default
18
+ attr_getter = attr.to_s[/\@(\S+)/, 1].to_sym
19
+ attr_val = clk.send attr_getter
20
+ next unless [String, Numeric, Float, Integer, Symbol, Range].include? attr_val.class
21
+ headers << attr_getter unless headers.include?(attr_getter)
22
+ str = case attr_val
23
+ when Numeric
24
+ value_color = :red unless clk.setpoint_ok?(attr_val)
25
+ attr_val.as_Hz
26
+ when Range
27
+ start_frequency = attr_val.first
28
+ end_frequency = attr_val.last
29
+ "#{start_frequency.as_Hz}\.\.#{end_frequency.as_Hz}"
30
+ else
31
+ attr_val.to_s
32
+ end
33
+ curr_longest = [attr_getter, str].max_by(&:length).size + 2 # Add 2 for the whitespace
34
+ if colhash[attr].nil? || (colhash[attr] < curr_longest)
35
+ colhash[attr] = curr_longest
36
+ end
37
+ output_attr_list[attr_getter] = ConsoleValue.new(str, value_color)
38
+ end
39
+ output_clock_list << output_attr_list
40
+ end
41
+ end
42
+ # Need to loop through the clock table values and find nils
43
+ # and create ConsoleValue instances for them
44
+ updated_clock_list = [].tap do |clk_ary|
45
+ output_clock_list.each do |attrs|
46
+ temp_hash = {}.tap do |tmphash|
47
+ headers.each do |h|
48
+ if attrs[h].nil?
49
+ tmphash[h] = ConsoleValue.new('', :default)
50
+ else
51
+ tmphash[h] = ConsoleValue.new(attrs[h].value, attrs[h].color)
52
+ end
53
+ end
54
+ end
55
+ clk_ary << temp_hash
56
+ end
57
+ end
58
+ if options[:fancy_output]
59
+ puts '╔' + column_widths.values.each.map { |i| '═' * i }.join('╤') + '╗'
60
+ puts '║' + headers.each_with_index.map { |col_val, i| " #{col_val} ".ljust(column_widths.values[i]) }.join('│') + '║'
61
+ puts '╟' + column_widths.values.each.map { |i| '─' * i }.join('┼') + '╢'
62
+ puts updated_clock_list.each.map { |attributes| '║' + headers.each_with_index.map { |value, attr_idx| attributes[value].color == :default ? " #{attributes[value].value} ".ljust(column_widths.values[attr_idx]) : " #{attributes[value].value} ".ljust(column_widths.values[attr_idx]).colorize(:red) }.join('│') + '║' }
63
+ puts '╚' + column_widths.values.each.map { |i| '═' * i }.join('╧') + '╝'
64
+ else
65
+ puts '.' + column_widths.values.each.map { |i| '-' * i }.join('-') + '.'
66
+ puts '|' + headers.each_with_index.map { |col_val, i| " #{col_val} ".ljust(column_widths.values[i]) }.join('|') + '|'
67
+ puts '|' + column_widths.values.each.map { |i| '-' * i }.join('+') + '|'
68
+ puts updated_clock_list.each.map { |attributes| '|' + headers.each_with_index.map { |value, attr_idx| attributes[value].color == :default ? " #{attributes[value]} ".ljust(column_widths.values[attr_idx]) : " #{attributes[value]} ".ljust(column_widths.values[attr_idx]).colorize(:red) }.join('|') + '|' }
69
+ puts '`' + column_widths.values.each.map { |i| '-' * i }.join('-') + '\''
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -55,8 +55,17 @@ class String
55
55
  # Sanitizes the string for conversion to a symbol and returns a lower
56
56
  # cased symbol version of the string
57
57
  def symbolize
58
+ orig_had_leading_underscore = match(/^\_/) ? true : false
59
+ orig_had_trailing_underscore = match(/\_$/) ? true : false
60
+ new_str = gsub(/(\?|\!|\-|\/|\\|\n|\s|\(|\)|\.|\[|\]|-|{|})/, '_').downcase
61
+ # Get rid of adjacent underscores
62
+ new_str.match(/\_\_/) ? new_str = new_str.squeeze('_') : new_str
63
+ new_str.chomp!('_') unless orig_had_trailing_underscore
64
+ unless orig_had_leading_underscore
65
+ new_str = new_str[1..-1] if new_str.match(/^\_/)
66
+ end
58
67
  @@symbolize ||= {}
59
- @@symbolize[self] ||= gsub(/(\?|\!|\-|\/|\\|\n|\s|\(|\)|\.|\[|\]|-|{|})/, '_').downcase.to_sym
68
+ @@symbolize[self] ||= new_str.to_sym
60
69
  end
61
70
 
62
71
  # acronyms
data/lib/origen/model.rb CHANGED
@@ -28,6 +28,7 @@ module Origen
28
28
  include Origen::Fuses
29
29
  include Origen::Tests
30
30
  include Origen::PowerDomains
31
+ include Origen::Clocks
31
32
  end
32
33
 
33
34
  module ClassMethods
@@ -174,6 +175,14 @@ module Origen
174
175
  if @current_mode
175
176
  return _modes[@current_mode] if _modes[@current_mode]
176
177
  fail "The mode #{@current_mode} of #{self.class} has not been defined!"
178
+ else
179
+ unless top_level?
180
+ # Need to do this in case a class besides SubBlock includes Origen::Model
181
+ obj_above_self = parent.nil? ? Origen.top_level : parent
182
+ if obj_above_self.current_mode
183
+ _modes[obj_above_self.current_mode.id] if _modes.include? obj_above_self.current_mode.id
184
+ end
185
+ end
177
186
  end
178
187
  end
179
188
  alias_method :mode, :current_mode
@@ -65,6 +65,10 @@ module Origen
65
65
  end
66
66
  alias_method :parameters=, :params=
67
67
 
68
+ def has_params?
69
+ _parameter_sets.empty? ? false : true
70
+ end
71
+
68
72
  # @api private
69
73
  def _parameter_current
70
74
  if path = self.class.parameters_context
@@ -1,4 +1,3 @@
1
- require 'colorize'
2
1
  require_relative './power_domains/power_domain'
3
2
  require_relative './power_domains/power_domains_collection'
4
3
  module Origen
@@ -19,5 +18,6 @@ module Origen
19
18
  end
20
19
  power_domains[id] = PowerDomain.new(id, options, &block)
21
20
  end
21
+ alias_method :power_domain, :add_power_domain
22
22
  end
23
23
  end
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  module PowerDomains
3
3
  class PowerDomain
4
- attr_accessor :id, :description, :voltage_range, :nominal_voltage, :setpoint
4
+ attr_accessor :id, :description, :unit_voltage_range, :nominal_voltage, :setpoint
5
5
 
6
6
  # Generic Power Domain Name
7
7
  # This is the power supply that can be blocked off to multiple power supplies
@@ -34,6 +34,7 @@ module Origen
34
34
  @id = @id.symbolize unless @id.is_a? Symbol
35
35
  options.each { |k, v| instance_variable_set("@#{k}", v) }
36
36
  (block.arity < 1 ? (instance_eval(&block)) : block.call(self)) if block_given?
37
+ @unit_voltage_range = :fixed if @unit_voltage_range.nil?
37
38
  fail unless attrs_ok?
38
39
  end
39
40
 
@@ -112,25 +113,27 @@ module Origen
112
113
  alias_method :value, :setpoint
113
114
 
114
115
  # Acceptable voltage range
115
- def voltage_range
116
- @voltage_range
116
+ def unit_voltage_range
117
+ @unit_voltage_range
117
118
  end
118
- alias_method :range, :voltage_range
119
+ alias_method :unit_range, :unit_voltage_range
119
120
 
120
121
  # Setter for setpoint
121
122
  def setpoint=(val)
122
123
  unless setpoint_ok?(val)
123
- Origen.log.warn("Setpoint (#{setpoint_string(val)}) for power domain '#{name}' is not within the voltage range (#{voltage_range_string})!")
124
+ Origen.log.warn("Setpoint (#{setpoint_string(val)}) for power domain '#{name}' is not within the voltage range (#{unit_voltage_range_string})!")
124
125
  end
125
126
  @setpoint = val
126
127
  end
127
128
 
128
129
  # Checks if the setpoint is valid
130
+ # This will need rework once the class has spec limits added
129
131
  def setpoint_ok?(val = nil)
132
+ return true if unit_voltage_range == :fixed
130
133
  if val.nil?
131
- voltage_range.include?(setpoint) ? true : false
134
+ unit_voltage_range.include?(setpoint) ? true : false
132
135
  else
133
- voltage_range.include?(val) ? true : false
136
+ unit_voltage_range.include?(val) ? true : false
134
137
  end
135
138
  end
136
139
  alias_method :value_ok?, :setpoint_ok?
@@ -182,18 +185,20 @@ module Origen
182
185
  def voltages_ok?
183
186
  if nominal_voltage.nil?
184
187
  false
185
- elsif voltage_range.nil?
188
+ elsif unit_voltage_range == :fixed
189
+ true
190
+ elsif unit_voltage_range.nil?
186
191
  Origen.log.error("PPEKit: Missing voltage range for power domain '#{name}'!")
187
192
  false
188
- elsif voltage_range.is_a? Range
189
- if voltage_range.include?(nominal_voltage)
193
+ elsif unit_voltage_range.is_a? Range
194
+ if unit_voltage_range.include?(nominal_voltage)
190
195
  true
191
196
  else
192
- Origen.log.error("PPEKit: Nominal voltage #{nominal_voltage} is not inbetween the voltage range #{voltage_range} for power domain '#{name}'!")
197
+ Origen.log.error("PPEKit: Nominal voltage #{nominal_voltage} is not inbetween the voltage range #{unit_voltage_range} for power domain '#{name}'!")
193
198
  false
194
199
  end
195
200
  else
196
- Origen.log.error("Power domain attribute 'voltage_range' must be a Range!")
201
+ Origen.log.error("Power domain attribute 'unit_voltage_range' must be a Range or set to the value of :fixed!")
197
202
  return_value = false
198
203
  end
199
204
  end
@@ -25,7 +25,7 @@ module Origen
25
25
  else
26
26
  attr_val.to_s
27
27
  end
28
- curr_longest = [attr_getter, str].max_by(&:length).size + 2 # Add 3 for the whitespace
28
+ curr_longest = [attr_getter, str].max_by(&:length).size + 2 # Add 2 for the whitespace
29
29
  if colhash[attr].nil? || (colhash[attr] < curr_longest)
30
30
  colhash[attr] = curr_longest
31
31
  end
@@ -73,14 +73,25 @@ module Origen
73
73
  system 'bundle install --gemfile Gemfile --binstubs lbin --path ~/.origen/gems/' # this needs to be executed as 'origen -v' does not seem to handle it on its own.
74
74
  system 'origen -v' # Let origen handle the gems installation and bundler setup.
75
75
  else
76
- system 'bundle exec origen -v'
77
- system 'bundle install' # Make sure bundle updates the necessary config/gems required for Origen.
76
+ if Origen.site_config.gem_manage_bundler
77
+ system 'origen -v'
78
+ system 'bundle install' # Make sure bundle updates the necessary config/gems required for Origen.
79
+ system 'origen m debug'
80
+ else
81
+ system 'bundle install' # Make sure bundle updates the necessary config/gems required for Origen.
82
+ system 'bundle exec origen -v'
83
+ system 'origen m debug'
84
+ end
78
85
  end
79
86
  Origen.log.info '######################################################'
80
87
  Origen.log.info 'running regression command in reference workspace...'
81
88
  Origen.log.info '######################################################'
82
89
  Origen.log.info
83
- system 'bundle exec origen regression'
90
+ if Origen.site_config.gem_manage_bundler
91
+ system 'origen regression'
92
+ else
93
+ system 'bundle exec origen regression'
94
+ end
84
95
  end
85
96
  end
86
97
  end
@@ -72,13 +72,50 @@ module Origen
72
72
  end
73
73
 
74
74
  def evaluate_limit(limit)
75
- return limit if [Fixnum, Float, Numeric, Symbol].include? limit.class
75
+ return limit if [Fixnum, Float, Numeric].include? limit.class
76
76
  return nil if limit.nil?
77
77
  limit = limit.to_s if [Nokogiri::XML::NodeSet, Nokogiri::XML::Text, Nokogiri::XML::Element].include? limit.class
78
- limit.gsub!("\n", ' ')
79
- limit.scrub!
78
+ if limit.is_a? Symbol
79
+ limit = ':' + limit.to_s
80
+ else
81
+ limit.gsub!("\n", ' ')
82
+ limit.scrub!
83
+ end
80
84
  result = false
81
- if !!(limit.match(/^\d+\.\d+$/)) || !!(limit.match(/^-\d+\.\d+$/))
85
+ if limit.match(/\:\S+/)
86
+ limit_items = limit.split(/\:|\s+/).reject(&:empty?)
87
+ references = limit.split(/\:|\s+/).select { |var| var.match(/^[a-zA-Z]\S+$/) }
88
+ new_limit_items = [].tap do |limit_ary|
89
+ limit_items.each do |item|
90
+ if references.include? item
91
+ # See if the limit is referencing a power domain, this should be extended to clocks
92
+ # TODO: Expand limit references to check Origen::Clocks
93
+ if Origen.top_level.respond_to? :power_domains
94
+ if Origen.top_level.power_domains.include? item.to_sym
95
+ limit_ary << Origen.top_level.power_domains(item.to_sym).nominal_voltage
96
+ next
97
+ end
98
+ end
99
+ if Origen.top_level.respond_to? :clocks
100
+ if Origen.top_level.clocks.include? item.to_sym
101
+ limit_ary << Origen.top_level.clocks(item.to_sym).freq_target
102
+ next
103
+ end
104
+ end
105
+ limit_ary << item
106
+ else
107
+ limit_ary << item
108
+ end
109
+ end
110
+ end
111
+ new_limit = new_limit_items.join(' ')
112
+ new_limit_references = new_limit.split(/\:|\s+/).select { |var| var.match(/^[a-zA-Z]\S+$/) }
113
+ if new_limit_references.empty?
114
+ result = eval(new_limit).round(4)
115
+ else
116
+ return limit
117
+ end
118
+ elsif !!(limit.match(/^\d+\.\d+$/)) || !!(limit.match(/^-\d+\.\d+$/))
82
119
  result = Float(limit).round(4) rescue false # Use the same four digits of accuracy as the Spec model
83
120
  elsif !!(limit.match(/\d+\.\d+\s+\d+\.\d+/)) # workaround for multiple specs authoring bug
84
121
  Origen.log.debug "Found two numbers without an operator in the limit string '#{limit}', choosing the first..."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-16 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -421,6 +421,9 @@ files:
421
421
  - lib/origen/chips/doc_entry.rb
422
422
  - lib/origen/chips/note.rb
423
423
  - lib/origen/client.rb
424
+ - lib/origen/clocks.rb
425
+ - lib/origen/clocks/clock.rb
426
+ - lib/origen/clocks/clocks_collection.rb
424
427
  - lib/origen/code_generators.rb
425
428
  - lib/origen/code_generators/actions.rb
426
429
  - lib/origen/code_generators/base.rb
@@ -623,7 +626,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
623
626
  version: 1.8.11
624
627
  requirements: []
625
628
  rubyforge_project:
626
- rubygems_version: 2.6.7
629
+ rubygems_version: 2.5.2
627
630
  signing_key:
628
631
  specification_version: 4
629
632
  summary: The Semiconductor Developer's Kit