origen 0.7.5 → 0.7.6

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: 1276d6eeb4622b1418a9d51ae8d8a0f219bdf280
4
- data.tar.gz: e97b54e3ccc539c3c86186ebc22a07117a1aca51
3
+ metadata.gz: 273cd4ec500be111fe541e1bd647d1d4a5d33116
4
+ data.tar.gz: 8aa30d894b3822c2b7475bdb6c87c94a75107e4e
5
5
  SHA512:
6
- metadata.gz: 5260a90e5e42360a77301d73293cf5eeafa3baa657a826be98b243ec27b599e737c731b0ddbcc5131efcfbe297f3c4328f2aee342a7592caa80968d67ac7e9e3
7
- data.tar.gz: b27abbbbf59392c3b119db63d2b480a11a517b961109633df713bd976bc4b8f7478182e0d243cdd1360b2479588e173e6d44e126dfe254c5850a1b0b2380c97f
6
+ metadata.gz: 9ff01e3074e12fb22bfe92f41fd9f740436978708c583c6a05d3cbdd7004e80d82ff1ad73e6157ef7f996df25a07799798f98fb8b855f53b8676184178b6c39e
7
+ data.tar.gz: bff1eb0b296d486b59232cf5d3a3ae6cefaf537ffcacfa903bd6a945a5f3b6c2e0d6206b648c4c8acebdaf86e4e5c05114450cfba78ccdd93b442d41416bd004
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
3
  MINOR = 7
4
- BUGFIX = 5
4
+ BUGFIX = 6
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
data/lib/c99/nvm.rb CHANGED
@@ -40,6 +40,11 @@ module C99
40
40
  reg.bits 7..0, :fprot4, reset: 0x11
41
41
  end
42
42
  end
43
+
44
+ def add_non_byte_aligned_regs
45
+ add_reg :non_aligned_small, 0x1000, size: 4
46
+ add_reg :non_aligned_big, 0x1010, size: 10
47
+ end
43
48
  end
44
49
 
45
50
  class NVMSub < NVM
data/lib/origen.rb CHANGED
@@ -456,7 +456,16 @@ unless defined? RGen::ORIGENTRANSITION
456
456
 
457
457
  # Compile the given file and return the result as a string
458
458
  def compile(file, options = {})
459
- Origen::Generator::Compiler.new.compile_inline(file, options)
459
+ # This has to operate on a new instance so that helper methods can use the inline
460
+ # compiler within an isolated context
461
+ c = Origen::Generator::Compiler.new
462
+ # It needs to be placed on the stack so that the global render method references
463
+ # the correct compiler instance
464
+ $_compiler_stack ||= []
465
+ $_compiler_stack << c
466
+ r = c.compile_inline(file, options)
467
+ $_compiler_stack.pop
468
+ r
460
469
  end
461
470
 
462
471
  def interfaces
@@ -12,6 +12,9 @@ module Origen
12
12
  attr_accessor :current_command
13
13
 
14
14
  def initialize
15
+ unless File.exist?(log_file_directory)
16
+ FileUtils.mkdir_p(log_file_directory)
17
+ end
15
18
  end
16
19
 
17
20
  def remote_jobs_file
@@ -140,6 +140,7 @@ The following options are available:
140
140
  else
141
141
  Origen.set_development_mode
142
142
  end
143
+ options[:files] = ARGV.dup
143
144
  if ARGV.empty?
144
145
  _build_web_dir
145
146
  Dir.chdir Origen.root do
@@ -152,6 +153,9 @@ The following options are available:
152
153
  Origen.app.listeners_for(:after_web_compile).each do |listener|
153
154
  listener.after_web_compile(options)
154
155
  end
156
+ Origen.app.listeners_for(:after_web_site_compile).each do |listener|
157
+ listener.after_web_site_compile(options)
158
+ end
155
159
  end
156
160
 
157
161
  else
@@ -20,6 +20,8 @@ module Origen
20
20
  # it as a string to the caller (i.e. without creating an output file)
21
21
  #
22
22
  # It expects an absolute path to a single template file as the file argument.
23
+ #
24
+ # @api private
23
25
  def compile_inline(file, options = {})
24
26
  initial_options = options.merge({})
25
27
  options = {
@@ -28,7 +30,9 @@ module Origen
28
30
  collect_stats: false,
29
31
  initial_options: initial_options
30
32
  }.merge(options)
31
- run_erb(Pathname.new(file), options).strip
33
+ @scope = options[:scope]
34
+ file = Pathname.new(file) unless options[:string]
35
+ run_erb(file, options).strip
32
36
  end
33
37
 
34
38
  # Compile all files found under the source directory, non-erb files will be copied
@@ -39,6 +43,7 @@ module Origen
39
43
  sub_template: false,
40
44
  collect_stats: true
41
45
  }.merge(options)
46
+ @scope = options[:scope]
42
47
  # Doing here so the output_directory (requiring target load) doesn't get hit if
43
48
  # it is already defined
44
49
  options[:output_directory] ||= output_directory
@@ -140,10 +145,18 @@ module Origen
140
145
  options[:file] = file
141
146
  options[:top_level_file] = current_file
142
147
  b = _get_binding(opts, &block)
148
+ if opts[:string]
149
+ content = file
150
+ @current_buffer = '@_string_template'
151
+ buffer = @current_buffer
152
+ else
153
+ content = File.read(file.to_s)
154
+ buffer = buffer_name_for(file)
155
+ end
143
156
  if block_given?
144
- content = ERB.new(File.read(file.to_s), 0, '%<>', buffer_name_for(file)).result(b)
157
+ content = ERB.new(content, 0, '%<>', buffer).result(b)
145
158
  else
146
- content = ERB.new(File.read(file.to_s), 0, Origen.config.erb_trim_mode, buffer_name_for(file)).result(b)
159
+ content = ERB.new(content, 0, Origen.config.erb_trim_mode, buffer).result(b)
147
160
  end
148
161
  insert(content)
149
162
  end
@@ -172,11 +185,11 @@ module Origen
172
185
  end
173
186
 
174
187
  def current_buffer
175
- instance_variable_get(@current_buffer || '@_anonymous')
188
+ (@scope || self).instance_variable_get(@current_buffer || '@_anonymous')
176
189
  end
177
190
 
178
191
  def current_buffer=(text)
179
- instance_variable_set(@current_buffer || '@_anonymous', text)
192
+ (@scope || self).instance_variable_set(@current_buffer || '@_anonymous', text)
180
193
  end
181
194
 
182
195
  # Returns the ERB buffer name for the given file, something like "@my_file_name"
@@ -4,6 +4,7 @@ module Origen
4
4
  # and source files
5
5
  module Renderer
6
6
  def render(file, options = {}, &block)
7
+ fail 'File argument is nil' unless file
7
8
  file = Origen.file_handler.clean_path_to_sub_template(file)
8
9
  current_pipeline << { file: file, options: options,
9
10
  placeholder: placeholder, block: block,
@@ -45,7 +46,8 @@ module Origen
45
46
  self.current_buffer = ''
46
47
  output = compile(current[:file],
47
48
  sub_template: true,
48
- block: current[:block]
49
+ block: current[:block],
50
+ scope: @scope
49
51
  )
50
52
  if current[:indent] && current[:indent] > 0
51
53
  indent = ' ' * current[:indent]
@@ -31,7 +31,11 @@ module Origen
31
31
 
32
32
  # Render an ERB template
33
33
  def render(*args, &block)
34
- Origen.generator.compiler.render(*args, &block)
34
+ if $_compiler_stack && $_compiler_stack.last
35
+ $_compiler_stack.last.render(*args, &block)
36
+ else
37
+ Origen.generator.compiler.render(*args, &block)
38
+ end
35
39
  end
36
40
 
37
41
  def dut
@@ -296,6 +296,9 @@ module Origen
296
296
  #
297
297
  # Can be called on any object to add a register to it
298
298
  def add_reg(id, address, size = nil, bit_info = {}, &_block)
299
+ if address.is_a?(Hash)
300
+ fail 'add_reg requires the address to be supplied as the 2nd argument, e.g. add_reg :my_reg, 0x1000'
301
+ end
299
302
  size, bit_info = nil, size if size.is_a?(Hash)
300
303
  size ||= bit_info.delete(:size) || 32
301
304
  description = bit_info.delete(:description)
@@ -311,7 +311,7 @@ module Origen
311
311
  end
312
312
  if value
313
313
  value = Reg.clean_value(value)
314
- write(value)
314
+ write(value, force: true)
315
315
  end
316
316
  if options[:mask]
317
317
  each_with_index { |bit, i| bit.read if options[:mask][i] == 1 }
@@ -120,19 +120,30 @@ module Origen
120
120
  def inspect
121
121
  bit_width = 13
122
122
  desc = ["\n0x%X - :#{name}" % address]
123
- desc << ' ' + ('=' * (bit_width + 1) * 8)
123
+ r = size % 8
124
+ if r == 0
125
+ desc << (' ' + ('=' * (bit_width + 1) * 8)).chop
126
+ else
127
+ desc << (' ' + (' ' * (bit_width + 1) * (8 - r)) + ('=' * (bit_width + 1) * r)).chop
128
+ end
124
129
 
125
130
  # "<#{self.class}: #{self.name}>"
126
- (size / 8).times do |byte_index|
131
+ num_bytes = (size / 8.0).ceil
132
+ num_bytes.times do |byte_index|
127
133
  # Need to add support for little endian regs here?
128
- byte_number = (size / 8) - byte_index
129
- max_bit = size - (byte_index * 8) - 1
134
+ byte_number = num_bytes - byte_index
135
+ max_bit = (byte_number * 8) - 1
130
136
  min_bit = max_bit - 8 + 1
131
137
 
132
- line = ' '
133
138
  # BIT INDEX ROW
139
+ line = ' '
134
140
  8.times do |i|
135
- line << '|' + "#{size - i - 1 - (byte_index * 8)}".center(bit_width)
141
+ bit_num = (byte_number * 8) - i - 1
142
+ if bit_num > size - 1
143
+ line << ' ' + ''.center(bit_width)
144
+ else
145
+ line << '|' + "#{bit_num}".center(bit_width)
146
+ end
136
147
  end
137
148
  line += '|'
138
149
  desc << line
@@ -141,6 +152,12 @@ module Origen
141
152
  line = ' '
142
153
  named_bits include_spacers: true do |name, bit, bitcounter|
143
154
  if _bit_in_range?(bit, max_bit, min_bit)
155
+ if max_bit > (size - 1)
156
+ (max_bit - (size - 1)).times do
157
+ line << ' ' * (bit_width + 1)
158
+ end
159
+ end
160
+
144
161
  if bit.size > 1
145
162
 
146
163
  if name
@@ -179,61 +196,16 @@ module Origen
179
196
  line += '|'
180
197
  desc << line
181
198
 
182
- ## BIT ACCESS ROW
183
- # line = "Access "
184
- # self.named_bits :include_spacers => true do |name, bit|
185
- # if _bit_in_range?(bit, max_bit, min_bit)
186
- # if bit.size > 1
187
- # if name
188
- # access = _bit_rw(bit)
189
- # bit_span = _num_bits_in_range(bit, max_bit, min_bit)
190
- # width = bit_width * bit_span
191
- # line << "|" + access.center(width + bit_span - 1)
192
- # else
193
- # bit.shift_out_left do |bit|
194
- # if _index_in_range?(bit.position, max_bit, min_bit)
195
- # line << "|" + "".center(bit_width)
196
- # end
197
- # end
198
- # end
199
- # else
200
- # access = _bit_rw(bit)
201
- # line << "|" + access.center(bit_width)
202
- # end
203
- # end
204
- # end
205
- # line += "|"
206
- # desc << line
207
-
208
- ## BIT RESET ROW
209
- # line = "Reset "
210
- # self.named_bits :include_spacers => true do |name, bit|
211
- # if _bit_in_range?(bit, max_bit, min_bit)
212
- # if bit.size > 1
213
- # if name
214
- # value = "0x%X" % bit.reset_val[_max_bit_in_range(bit, max_bit, min_bit).._min_bit_in_range(bit, max_bit, min_bit)]
215
- # bit_span = _num_bits_in_range(bit, max_bit, min_bit)
216
- # width = bit_width * bit_span
217
- # line << "|" + value.center(width + bit_span - 1)
218
- # else
219
- # bit.shift_out_left do |bit|
220
- # if _index_in_range?(bit.position, max_bit, min_bit)
221
- # line << "|" + "".center(bit_width)
222
- # end
223
- # end
224
- # end
225
- # else
226
- # line << "|" + "#{bit.reset_val}".center(bit_width)
227
- # end
228
- # end
229
- # end
230
- # line += "|"
231
- # desc << line
232
-
233
199
  # BIT STATE ROW
234
200
  line = ' '
235
201
  named_bits include_spacers: true do |name, bit, _bitcounter|
236
202
  if _bit_in_range?(bit, max_bit, min_bit)
203
+ if max_bit > (size - 1)
204
+ (max_bit - (size - 1)).times do
205
+ line << ' ' * (bit_width + 1)
206
+ end
207
+ end
208
+
237
209
  if bit.size > 1
238
210
  if name
239
211
  if bit.has_known_value?
@@ -278,7 +250,16 @@ module Origen
278
250
  line += '|'
279
251
  desc << line
280
252
 
281
- desc << ' ' + ('-' * (bit_width + 1) * 8)
253
+ if size >= 8
254
+ r = size % 8
255
+ if byte_index == 0 && r != 0
256
+ desc << (' ' + ('=' * (bit_width + 1) * (8 - r)).chop + ' ' + ('-' * (bit_width + 1) * r)).chop
257
+ else
258
+ desc << (' ' + ('-' * (bit_width + 1) * 8)).chop
259
+ end
260
+ else
261
+ desc << (' ' + (' ' * (bit_width + 1) * (8 - size)) + ('-' * (bit_width + 1) * size)).chop
262
+ end
282
263
  end
283
264
  desc.join("\n")
284
265
  end
@@ -394,8 +375,9 @@ module Origen
394
375
  File.readlines(define_file).each do |line|
395
376
  if line =~ /^\s*#(.*)/
396
377
  desc << Regexp.last_match[1].strip
397
- elsif line =~ /^\s*(add_reg|reg)\(?\s*:(\w+)\s*,.*do/
398
- @current_reg_name = Regexp.last_match[2].to_sym
378
+ # http://rubular.com/r/D8lg2P5kK1 http://rubular.com/r/XP4ydPV8Fd
379
+ elsif line =~ /^\s*reg\(?\s*[:"'](\w+)["']?\s*,.*\sdo/ || line =~ /^\s*add_reg\(?\s*[:"'](\w+)["']?\s*,.*/
380
+ @current_reg_name = Regexp.last_match[1].to_sym
399
381
  description_lookup[define_file] ||= {}
400
382
  description_lookup[define_file][@current_reg_name] ||= {}
401
383
  description_lookup[define_file][@current_reg_name][:_reg] = desc.dup
@@ -484,6 +466,7 @@ module Origen
484
466
  options = {
485
467
  include_spacers: false
486
468
  }.merge(options)
469
+ result = []
487
470
 
488
471
  # test if @lookup has any values stored as an array
489
472
  # if so it means there is a split group of bits
@@ -500,20 +483,38 @@ module Origen
500
483
  pos = details[:bits] + details[:pos]
501
484
  if options[:include_spacers] && (pos != current_pos)
502
485
  collection = BitCollection.dummy(self, nil, size: current_pos - pos, pos: pos)
503
- yield nil, collection
486
+ unless collection.size == 0
487
+ if block_given?
488
+ yield nil, collection
489
+ else
490
+ result << [nil, collection]
491
+ end
492
+ end
504
493
  end
505
494
  collection = BitCollection.new(self, name)
506
495
  details[:bits].times do |i|
507
496
  collection << @bits[details[:pos] + i]
508
497
  end
509
- yield name, collection
498
+ unless collection.size == 0
499
+ if block_given?
500
+ yield name, collection
501
+ else
502
+ result << [name, collection]
503
+ end
504
+ end
510
505
  current_pos = details[:pos]
511
506
  end
512
507
  if options[:include_spacers] && current_pos != 0
513
508
  collection = BitCollection.dummy(self, nil, size: current_pos, pos: 0)
514
- yield nil, collection
509
+ unless collection.size == 0
510
+ if block_given?
511
+ yield nil, collection
512
+ else
513
+ result << [nil, collection]
514
+ end
515
+ end
515
516
  end
516
- elsif split_bits == true # if there are split bits, need to convert all regsiter bit values to array elements to allow sorting
517
+ elsif split_bits == true # if there are split bits, need to convert all register bit values to array elements to allow sorting
517
518
 
518
519
  # if the register has bits split up across it, then store the bits in order of decreasing reg position
519
520
  # but first, stuff all the bits in a simple array, as single bits, or ranges of bits
@@ -569,20 +570,41 @@ module Origen
569
570
  pos = details[:bits] + details[:pos]
570
571
  if options[:include_spacers] && (pos != current_pos)
571
572
  collection = BitCollection.dummy(self, nil, size: current_pos - pos, pos: pos)
572
- yield nil, collection, bitcounter
573
+ unless collection.size == 0
574
+ if block_given?
575
+ yield nil, collection, bitcounter
576
+ else
577
+ result << [nil, collection, bitcounter]
578
+ end
579
+ end
573
580
  end
574
581
  collection = BitCollection.new(self, name)
575
582
  details[:bits].times do |i|
576
583
  collection << @bits[details[:pos] + i]
577
584
  end
578
- yield name, collection, bitcounter
585
+ unless collection.size == 0
586
+ if block_given?
587
+ yield name, collection, bitcounter
588
+ else
589
+ result << [name, collection, bitcounter]
590
+ end
591
+ end
579
592
  current_pos = details[:pos]
580
593
  end
581
594
  if options[:include_spacers] && current_pos != 0
582
595
  collection = BitCollection.dummy(self, nil, size: current_pos, pos: 0)
583
- yield nil, collection, bitcounter
596
+ unless collection.size == 0
597
+ if block_given?
598
+ yield nil, collection, bitcounter
599
+ else
600
+ result << [nil, collection, bitcounter]
601
+ end
602
+ end
584
603
  end
585
604
  end
605
+ unless block_given?
606
+ result
607
+ end
586
608
  end
587
609
 
588
610
  # Returns each named bit collection contained in self
data/lib/origen/specs.rb CHANGED
@@ -48,6 +48,7 @@ module Origen
48
48
  sub_type: nil,
49
49
  mode: current_mode.nil? ? nil : current_mode.name,
50
50
  spec: nil,
51
+ symbol: false,
51
52
  creating_spec: false
52
53
  }.update(options || {})
53
54
  _specs
@@ -102,6 +103,7 @@ module Origen
102
103
  sub_type: nil,
103
104
  mode: current_mode.nil? ? nil : current_mode.name,
104
105
  spec: nil,
106
+ symbol: false,
105
107
  creating_spec: false
106
108
  }.update(options)
107
109
  if @_specs.nil? || @_specs == {}
@@ -124,6 +126,7 @@ module Origen
124
126
  sub_type: nil,
125
127
  mode: current_mode.nil? ? nil : current_mode.name,
126
128
  spec: nil,
129
+ symbol: false,
127
130
  creating_spec: false
128
131
  }.update(options)
129
132
  options[:spec] = s
@@ -639,14 +642,22 @@ module Origen
639
642
  sub_type: nil,
640
643
  specs_to_be_shown: SpecArray.new,
641
644
  owner: nil,
645
+ symbol: false,
642
646
  creating_spec: false
643
647
  }.update(options)
648
+ options[:symbol] ? symbol = options.delete(:spec) : symbol = nil
644
649
  specs_to_be_shown = options[:specs_to_be_shown]
645
650
  filter_hash(_specs, options[:spec]).each do |_spec, hash|
646
651
  filter_hash(hash, options[:mode]).each do |_mode, hash_|
647
652
  filter_hash(hash_, options[:type]).each do |_type, hash__|
648
653
  filter_hash(hash__, options[:sub_type]).each do |_sub_type, spec|
649
- specs_to_be_shown << spec
654
+ if symbol
655
+ if spec.symbol && (spec.symbol.gsub(/<.*?>/, '').downcase.to_sym == symbol)
656
+ specs_to_be_shown << spec
657
+ end
658
+ else
659
+ specs_to_be_shown << spec
660
+ end
650
661
  end
651
662
  end
652
663
  end
@@ -33,8 +33,11 @@ class SearchFilter < Nanoc::Filter
33
33
  end
34
34
 
35
35
  def search_file
36
- @search_file ||= File.join(@site.config[:output_dir],
37
- @site.config[:search_file] || 'search.json')
36
+ if item[:search_id]
37
+ File.join(@site.config[:output_dir], "search_#{item[:search_id]}.json")
38
+ else
39
+ File.join(@site.config[:output_dir], 'search.json')
40
+ end
38
41
  end
39
42
 
40
43
  def extract_first(doc, path)
@@ -1,4 +1,12 @@
1
- $.getJSON("<%= path 'search.json' %>", function(json) {
1
+ var search_json;
2
+
3
+ if (window.origen_search_id) {
4
+ search_json = "search_" + window.origen_search_id + ".json";
5
+ } else {
6
+ search_json = "search.json";
7
+ }
8
+
9
+ $.getJSON("<%= path '' %>" + "/" + search_json, function(json) {
2
10
  window.index = lunr(function() {
3
11
  this.field("title", {boost: 10});
4
12
  this.field("subtitle", {boost: 5});
@@ -87,6 +95,12 @@ $(document).ready(function() {
87
95
 
88
96
  if (params.highlight) {
89
97
  var term = unescape(params.highlight);
90
- $('article').highlight(term);
98
+ var articles = $('article');
99
+ articles.highlight(term);
100
+ if (articles[0]) {
101
+ var top = $($("span.highlight:contains(" + params.highlight + ")")[0]).offset().top;
102
+
103
+ $('html,body').animate({scrollTop: top - 350}, 500);
104
+ }
91
105
  }
92
106
  });
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.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
11
+ date: 2016-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport