origen 0.4.3 → 0.5.0
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 +2 -2
- data/lib/origen/commands/interactive.rb +7 -8
- data/lib/origen/global_methods.rb +8 -148
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa35579495bf10b17e26daa07762d997834931d0
|
4
|
+
data.tar.gz: b31c04ce31fd8f75054da7696f9158bcbe93e225
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2be498edb881b314e50db159168f3e11537a29defe4f1117a4d81a0084fa2594f1fc9e443158d22b777614d13c93b5ea0b6c244d0f022ba547167ff8f327184
|
7
|
+
data.tar.gz: 142048906f8c6dcbd4a0ce163d6f8283c89e91e6e0be4fbd2962dfe06e6b2f610da8b856cfc17b360ca0b009411e4f575433343b5a6ff2e8fc2d566f8ab6dec9
|
data/config/version.rb
CHANGED
@@ -55,12 +55,7 @@ Usage: origen i [options]
|
|
55
55
|
|
56
56
|
if defined?(Pry) && options[:pry]
|
57
57
|
include ConsoleMethods
|
58
|
-
|
59
|
-
IRB::ExtendCommandBundle.send :include, Origen::ConsoleMethods
|
60
|
-
IRB.start
|
61
|
-
exit 0
|
62
|
-
end
|
63
|
-
# rubocop:disable Debugger, EmptyLines
|
58
|
+
# rubocop:disable Debugger, EmptyLines
|
64
59
|
|
65
60
|
|
66
61
|
|
@@ -68,7 +63,7 @@ Usage: origen i [options]
|
|
68
63
|
|
69
64
|
|
70
65
|
|
71
|
-
|
66
|
+
binding.pry
|
72
67
|
|
73
68
|
|
74
69
|
|
@@ -76,5 +71,9 @@ Usage: origen i [options]
|
|
76
71
|
|
77
72
|
|
78
73
|
|
79
|
-
|
74
|
+
# rubocop:enable Debugger, EmptyLines
|
75
|
+
else
|
76
|
+
IRB::ExtendCommandBundle.send :include, Origen::ConsoleMethods
|
77
|
+
IRB.start
|
78
|
+
end
|
80
79
|
end
|
@@ -1,74 +1,6 @@
|
|
1
1
|
module Origen
|
2
2
|
module GlobalMethods
|
3
3
|
require_relative 'encodings'
|
4
|
-
# If a new gem (i.e. not part of the existing Ruby installation) is required by Origen or an
|
5
|
-
# application then it should be required via this method.
|
6
|
-
# On Windows this can be installed automatically and this method will take care of doing
|
7
|
-
# that.
|
8
|
-
#
|
9
|
-
# However due to the restricted user permissions available on Linux this cannot be done
|
10
|
-
# automatically and you must ensure that you arrange to have the required gem installed
|
11
|
-
# on Linux - contact Stephen McGinty to get this done.
|
12
|
-
#
|
13
|
-
# A given user will then have to update their local toolset to pick this up and this method
|
14
|
-
# will give them the necessary instructions.
|
15
|
-
#
|
16
|
-
# @example
|
17
|
-
#
|
18
|
-
# require_gem "rest-client"
|
19
|
-
# require_gem "net/ldap", :name => "net-ldap"
|
20
|
-
def require_gem(name, options = {})
|
21
|
-
Origen.deprecate <<-END
|
22
|
-
require_gem will be removed in Origen V3, Bundler should be used to manage gem dependencies
|
23
|
-
END
|
24
|
-
options = {
|
25
|
-
name: name
|
26
|
-
}.merge(options)
|
27
|
-
name = name.to_s
|
28
|
-
options[:name] = options[:name].to_s
|
29
|
-
if options[:version] && options[:version] =~ /^v(.*)/
|
30
|
-
options[:version] = Regexp.last_match[1]
|
31
|
-
end
|
32
|
-
# This gem was not included in the initial Origen v2.x.x gemset, so need to handle instalations
|
33
|
-
# without it
|
34
|
-
begin
|
35
|
-
if options[:version]
|
36
|
-
gem options[:name], options[:version]
|
37
|
-
end
|
38
|
-
require name
|
39
|
-
rescue LoadError
|
40
|
-
if Origen.running_on_windows?
|
41
|
-
puts "Installing #{options[:name]}"
|
42
|
-
command = "gem install #{options[:name]} --no-rdoc --no-ri"
|
43
|
-
command += " --version #{options[:version]}" if options[:version]
|
44
|
-
if !system(command)
|
45
|
-
puts 'It looks like a problem occurred, ensure you have installed Ruby exactly per the Origen guide'
|
46
|
-
else
|
47
|
-
puts 'A missing gem has just been installed to your system, please re-run the previous command'
|
48
|
-
end
|
49
|
-
else
|
50
|
-
puts "Installing #{options[:name]}"
|
51
|
-
command = "gem install --user-install #{options[:name]} --no-rdoc --no-ri"
|
52
|
-
command += " --version #{options[:version]}" if options[:version]
|
53
|
-
if !system(command)
|
54
|
-
puts 'It looks like there was a problem installing that gem, run the following commands to ensure you have an up to date'
|
55
|
-
puts 'environment, then try again:'
|
56
|
-
puts ''
|
57
|
-
puts " cd #{Origen.top}"
|
58
|
-
puts ' source source_setup update'
|
59
|
-
puts " cd #{FileUtils.pwd}"
|
60
|
-
else
|
61
|
-
puts 'A missing gem has just been installed to your system, please re-run the previous command'
|
62
|
-
end
|
63
|
-
# puts "The current application has required a gem called #{options[:name]}, however that is not available in your current toolset."
|
64
|
-
# puts 'This may be solved by following the instructions below, otherwise contact the application owner.'
|
65
|
-
# puts ''
|
66
|
-
# puts_require_latest_ruby
|
67
|
-
end
|
68
|
-
exit 1
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
4
|
def annotate(msg, options = {})
|
73
5
|
Origen.app.tester.annotate(msg, options)
|
74
6
|
end
|
@@ -102,6 +34,14 @@ END
|
|
102
34
|
Origen.generator.compiler.render(*args, &block)
|
103
35
|
end
|
104
36
|
|
37
|
+
def dut
|
38
|
+
Origen.top_level
|
39
|
+
end
|
40
|
+
|
41
|
+
def tester
|
42
|
+
Origen.tester
|
43
|
+
end
|
44
|
+
|
105
45
|
# The options passed to an ERB template. Having it
|
106
46
|
# global like this is ugly, but it does allow a hash of options
|
107
47
|
# to always be available in templates even if the template
|
@@ -117,89 +57,9 @@ END
|
|
117
57
|
binding
|
118
58
|
end
|
119
59
|
|
120
|
-
def debug(*lines)
|
121
|
-
Origen.deprecate 'debug method is deprecated, use Origen.log.debug instead'
|
122
|
-
if Origen.debug?
|
123
|
-
Origen.log.info ''
|
124
|
-
c = caller[0]
|
125
|
-
c =~ /(.*):(\d+):.*/
|
126
|
-
$_last_log_time ||= Time.now
|
127
|
-
delta = Time.now - $_last_log_time
|
128
|
-
$_last_log_time = Time.now
|
129
|
-
begin
|
130
|
-
Origen.log.info "*** Debug *** %.6f #{Regexp.last_match[1]}:#{Regexp.last_match[2]}" % delta
|
131
|
-
rescue
|
132
|
-
# For this to fail it means the deprecated method was called by IRB or similar
|
133
|
-
# and in that case there is no point advising who called anyway
|
134
|
-
end
|
135
|
-
options = lines.last.is_a?(Hash) ? lines.pop : {}
|
136
|
-
lines.flatten.each do |line|
|
137
|
-
line.split(/\n/).each do |line|
|
138
|
-
Origen.log.info line, options
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
60
|
Pattern = Origen.pattern unless defined?(Pattern)
|
145
61
|
Flow = Origen.flow unless defined?(Flow)
|
146
62
|
Resources = Origen.resources unless defined?(Resources)
|
147
63
|
User = Origen::Users::User unless defined?(User)
|
148
|
-
|
149
|
-
# Returns an Excel column based on an Integer argument
|
150
|
-
def get_excel_column(n)
|
151
|
-
excel_columns = {}
|
152
|
-
@column = 'A'
|
153
|
-
(1..75).to_a.each do |i|
|
154
|
-
excel_columns[i] = @column
|
155
|
-
@column = @column.succ
|
156
|
-
end
|
157
|
-
excel_columns[n]
|
158
|
-
end
|
159
|
-
|
160
|
-
# Returns the full class hierarchy of an object
|
161
|
-
def get_full_class(obj)
|
162
|
-
klass_str = ''
|
163
|
-
until obj.nil?
|
164
|
-
if obj == Origen.top_level
|
165
|
-
klass_str.prepend obj.class.to_s
|
166
|
-
else
|
167
|
-
# If the class method produces "SubBlock" then use the object name instead
|
168
|
-
if obj.class.to_s.split('::').last == 'SubBlock'
|
169
|
-
klass_str.prepend "::#{obj.name.upcase}"
|
170
|
-
else
|
171
|
-
klass_str.prepend "::#{obj.class.to_s.split('::').last}"
|
172
|
-
end
|
173
|
-
end
|
174
|
-
obj = obj.parent
|
175
|
-
end
|
176
|
-
klass_str
|
177
|
-
end
|
178
|
-
|
179
|
-
# Returns Rgen supported encoding formats
|
180
|
-
def encodings(format = nil)
|
181
|
-
if format.nil?
|
182
|
-
Origen::ENCODINGS.keys
|
183
|
-
else
|
184
|
-
Origen::ENCODINGS[format].keys
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
# Returns the encoded symbol as a String if one match is found.
|
189
|
-
# Returns a hash for multiple results and nil for no match
|
190
|
-
def encoding_search(symbol, options = {})
|
191
|
-
options = {
|
192
|
-
format: :utf8
|
193
|
-
}.update(options)
|
194
|
-
fail "The encoding format '#{options[:format]}' is not supported, please choose from #{encodings}" unless encodings.include? options[:format]
|
195
|
-
results = Origen::ENCODINGS[options[:format]].filter(symbol)
|
196
|
-
if results.size == 1
|
197
|
-
results.values.first
|
198
|
-
elsif results.size > 1
|
199
|
-
results
|
200
|
-
else
|
201
|
-
return nil
|
202
|
-
end
|
203
|
-
end
|
204
64
|
end
|
205
65
|
end
|
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.
|
4
|
+
version: 0.5.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: 2015-09-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|