Class: Origen::ChipPackage

Inherits:
Object show all
Defined in:
lib/origen/chip_package.rb

Overview

Represents an SoC Package option

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/origen/chip_package.rb', line 257

def method_missing(m, *args, &block)
  ivar = "@#{m.to_s.gsub('=', '')}"
  ivar_sym = ":#{ivar}"
  if m.to_s =~ /=$/
    define_singleton_method(m) do |val|
      instance_variable_set(ivar, val)
    end
  elsif instance_variables.include? ivar_sym
    instance_variable_get(ivar)
  else
    define_singleton_method(m) do
      instance_variable_get(ivar)
    end
  end
  send(m, *args, &block)
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



13
14
15
# File 'lib/origen/chip_package.rb', line 13

def columns
  @columns
end

#descriptionObject

Returns the value of attribute description.



5
6
7
# File 'lib/origen/chip_package.rb', line 5

def description
  @description
end

#fieldObject (readonly)

Returns the value of attribute field.



14
15
16
# File 'lib/origen/chip_package.rb', line 14

def field
  @field
end

#groupsObject (readonly)

Returns the value of attribute groups.



16
17
18
# File 'lib/origen/chip_package.rb', line 16

def groups
  @groups
end

#interconnectsObject

Returns the value of attribute interconnects.



8
9
10
# File 'lib/origen/chip_package.rb', line 8

def interconnects
  @interconnects
end

#last_empty_charObject (readonly)

attr_reader :group_list # method is redefined further down



18
19
20
# File 'lib/origen/chip_package.rb', line 18

def last_empty_char
  @last_empty_char
end

#lower_axesObject (readonly)

Returns the value of attribute lower_axes.



11
12
13
# File 'lib/origen/chip_package.rb', line 11

def lower_axes
  @lower_axes
end

#nameObject Also known as: full_name



26
27
28
# File 'lib/origen/chip_package.rb', line 26

def name
  @name || @id
end

#number_of_columnsObject

Returns the value of attribute number_of_columns.



7
8
9
# File 'lib/origen/chip_package.rb', line 7

def number_of_columns
  @number_of_columns
end

#number_of_rowsObject

Returns the value of attribute number_of_rows.



6
7
8
# File 'lib/origen/chip_package.rb', line 6

def number_of_rows
  @number_of_rows
end

#objObject (readonly)

Returns the value of attribute obj.



15
16
17
# File 'lib/origen/chip_package.rb', line 15

def obj
  @obj
end

#ownerObject

Returns the owner that $owns the mode (the SoC instance usually)



24
25
26
# File 'lib/origen/chip_package.rb', line 24

def owner
  @owner
end

#plottableObject (readonly)

Returns the value of attribute plottable.



19
20
21
# File 'lib/origen/chip_package.rb', line 19

def plottable
  @plottable
end

#rowsObject (readonly)

Returns the value of attribute rows.



12
13
14
# File 'lib/origen/chip_package.rb', line 12

def rows
  @rows
end

#typesObject



47
48
49
# File 'lib/origen/chip_package.rb', line 47

def types
  @types || []
end

#upper_axesObject (readonly)

Returns the value of attribute upper_axes.



10
11
12
# File 'lib/origen/chip_package.rb', line 10

def upper_axes
  @upper_axes
end

Instance Method Details

#add_grounds(marker = 'G') ⇒ Object Also known as: add_ground, plot_ground, plot_grounds



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/origen/chip_package.rb', line 147

def add_grounds(marker = 'G')
  # add_grounds can be called explicitly, or by the .plot("grounds") method call.
  prepare_plot if field.nil?
  if plottable
    pin_list = owner.ground_pins.map { |_ken, pin| pin }
    @groups << "#{marker} - Ground"
    pin_list.each do |item|
      coordinates = coordinate(item.location)
      @field[coordinates[0]][coordinates[1]] = [marker.green + ' ']
    rescue
      puts "#{item} doesn't appear to have a physical location in this configuration."
    end
    generate_field
  end
end

#add_power(marker = 'P') ⇒ Object Also known as: add_powers, plot_power, plot_powers



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/origen/chip_package.rb', line 125

def add_power(marker = 'P')
  # add_power can be called explicitly or by the .plot("power") method call.
  prepare_plot if field.nil?
  if plottable
    pin_list = owner.power_pins.map { |_ken, pin| pin }
    @groups << "#{marker} - Power"
    pin_list.each do |item|
      # puts items,owner.pins[items].location

      coordinates = coordinate(item.location)
      @field[coordinates[0]][coordinates[1]] = [marker.red + ' ']
    rescue
      puts "#{item} doesn't appear to have a physical location in this configuration."
      puts "Current package = #{owner.package}"
    end
    generate_field
  end
end

#clearObject



166
167
168
169
170
171
172
173
174
# File 'lib/origen/chip_package.rb', line 166

def clear
  # clear removes all elements from the .field and .groups attributes.
  prepare_plot if field.nil?
  if plottable
    @groups = []
    @field = []
    @number_of_rows.times { @field.insert(0, []); @number_of_columns.times { @field[0].insert(0, []) } }
  end
end

#coordinate(location) ⇒ Object

############################################################## ############# String/Coordinate Manipulation ################# ##############################################################



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/origen/chip_package.rb', line 224

def coordinate(location)
  ## Returns array of numerical equiv coordinates (e.g. "AA11" -> [20,11])
  error = "\n\nSomething wrong during coordinate-mapping.\nAre you sure you passed an alphanumeric string\n to the coordinate() method?\n"
  split_index = -1
  location.each_char do |character|
    if letter?(character)
      split_index += 1
    end
  end
  row = location[0..split_index]
  column = location[split_index + 1..-1]
  fail ArgumentError, error unless row.length > 0 && column.length > 0

  ## Now convert alphanumeric row to jedec equiv' with to_row() method
  # and return coordinates.
  coordinates = [to_row(row), column.to_i - 1]
end

#generate_field(empty_char = @last_empty_char) ⇒ Object Also known as: show

generate_field should not need to be called explicitly. It is called

by other methods when need-be, and is fundamentallyis responsible
for two things:

  1. It fills the .field array with the appropriate symbols/markers.
  2. It concatenates the array elements into printable rows, and prints
     them.


100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/origen/chip_package.rb', line 100

def generate_field(empty_char = @last_empty_char)
  if plottable
    new_field = []
    @field.each do |rows|
      rows.each do |items|
        if items.length == 0
          items.insert(0, "#{empty_char} ")
        elsif empty_char != @last_empty_char && items == ["#{last_empty_char} "]
          items[0] = "#{empty_char} "
        end
      end
      new_field.insert(-1, rows.join(''))
    end
    @last_empty_char = empty_char
    package = (owner.package.nil?) ? 'No package chosen.' : owner.package.to_s
    puts "\nPin field: #{package}\n\n"
    group_display = @groups.join("\n")
    puts "Legend: \n#{group_display}\n\n"
    puts @upper_axes.join('').yellow
    new_field.each_with_index { |line, index| puts line + "#{@rows[index]} (#{index + 1})\n".chop.yellow }
    puts @lower_axes.join('').yellow, "\n"
  end
end

#group_array(grp) ⇒ Object



211
212
213
214
215
216
217
218
# File 'lib/origen/chip_package.rb', line 211

def group_array(grp)
  # returns an array of pins belonging to the given group
  pin_list = $dut.pins.map { |_key, val| val if val.group == grp }
  pin_list[0].compact!
  puts 'No pins found under that group name.' unless pin_list.any?
rescue
  []
end

#idObject



31
32
33
# File 'lib/origen/chip_package.rb', line 31

def id
  @id || name.to_s.downcase.gsub(/(\s|-)+/, '_').to_sym
end

#id=(val) ⇒ Object



35
36
37
# File 'lib/origen/chip_package.rb', line 35

def id=(val)
  @id = val.to_s.gsub(/(\s|-)+/, '_').downcase.to_sym
end

#initial(test_string) ⇒ Object



253
254
255
# File 'lib/origen/chip_package.rb', line 253

def initial(test_string)
  test_string[0, 1]
end

#letter?(test_character) ⇒ Boolean

Returns:

  • (Boolean)


248
249
250
251
# File 'lib/origen/chip_package.rb', line 248

def letter?(test_character)
  ## Returns nil if the 'test_character' isn't a letter.
  test_character =~ /[[:alpha:]]/
end

#list_groupsObject Also known as: group_list



202
203
204
205
206
207
208
# File 'lib/origen/chip_package.rb', line 202

def list_groups
  # returns an array of group names assigned to the package
  grps = owner.pins.map { |_key, val| val.group }
  grps.uniq!
rescue
  []
end

#plot(pin_name, marker = nil) ⇒ Object

.plot can be called explicitly and accepts string arguments with

or without regex styling. For example:

  $dut.package = :t4240
  $dut.package.plot("ddr_interface") # plots all "ddr interface" groups
  $dut.package.plot("grounds") # adds ground pins to the previously instantiated plot
  $dut.package.plot("d1_mdq37","$") # plots controller 1 mdq 37, and uses $ as a legend marker
  $dut.package.plot("d2_mdq[3-6]0) # plots d2_mdq30, d2_mdq40, d2_md520, and d2_md620


283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/origen/chip_package.rb', line 283

def plot(pin_name, marker = nil)
  prepare_plot if field.nil?
  if plottable && pin_name.is_a?(String) && /ground/ =~ pin_name.downcase
    add_grounds('G')
  elsif plottable && pin_name.is_a?(String) && /power/ =~ pin_name.downcase
    add_power('P')
  elsif plottable && pin_name.is_a?(String)
    found_pins = []
    owner.pins.map { |pin| found_pins << pin[1] if /#{pin_name}/ =~ pin[1].name.to_s || /#{pin_name}/ =~ pin[1].group.to_s }
    if found_pins.size == 1 && marker.nil?
      marker = initial(pin_name.to_s)
      while @groups.index { |grp_name| grp_name =~ /#{marker} -/ }
        marker.next!
        marker = '0' unless marker.size < 2
      end
      coordinates = coordinate(found_pins[0].location)
      @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
      @groups.delete_if { |group| /#{pin_name}/ =~ group }
      @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
    elsif found_pins.size == 1
      coordinates = coordinate(found_pins[0].location)
      @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
      @groups.delete_if { |group| /#{pin_name}/ =~ group }
      @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
    else
      if marker.nil?
        marker = initial(pin_name.to_s)
        while @groups.index { |grp_name| grp_name =~ /#{marker} -/ }
          marker.next!
          marker = '0' unless marker.size < 2
        end
      end
      reg_state = quote_regex(pin_name)
      found_pins.each do |item|
        coordinates = coordinate(item.location)
        @field[coordinates[0]][coordinates[1]] = [marker + ' ']
        @groups.delete_if { |group| "#{marker} - \"#{reg_state}\"" == group }
        @groups << "#{marker} - \"#{pin_name}\""
      rescue
        raise "\n#{item} doesn't appear to have a physical location in this configuration."
      end
    end
    generate_field
  else
    puts 'Unsupported argument type.'
  end
end

#plot_ceoObject



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/origen/chip_package.rb', line 381

def plot_ceo
  scramble = ['         +....~~~~~:,,..::~~:,......,:~==~,,....,:~==~~::,:~~,.,               ',
              '            ...++~:,,:~~~~~======~::::,,,,::=======~~::,,                      ',
              '.................????????+,,,,::::::,,,.,,..,,,,:::????......................:+',
              '           ,.,:~~~~~:,~~~~:~:~~=~:~~~==++====::~~~===~~=~~==:,,                ',
              '         ,....~++?:::,,::::~~~=======+============~~~:,~                       ',
              '           ....+++,:,,::::~~~==========~===========~:,:,~                      ',
              '           ,........~~~~~~============================~........:               ',
              '        ......,~~~~~~~===~++==+=+++++++++++++++++====~===~~~.....~             ',
              '                ,,,::::::~~~~:,,:::,,,,:,,,,......:~~:~::,,:                   ',
              '        .....,::~~~~=============+++++++++++++++++=======~~~:.....             ',
              '               +.,::::::~~~=~=~~~~~~~====~~~~~:::~~==~~::::,                   ',
              '          .......:~~~~=~=======++++++++++++++++++======~~........              ',
              '           +:,,::~===+++++====+====~~~=====~====+++++++++=~~,~+                ',
              '.....................,===+???????    ,..........????????=:,....................',
              '...................=????????++++:,::::::::::::::???????~.......................',
              '......................+++++??????   .............=??????+:,....................',
              '                     =~:,::~~++=~=::,,,,,,,,,:                                 ',
              '              +.........,,,,,,...,,,:,,,........,,,........,?                  ',
              '         :....::~~~=========+++++++++++++++++++++++=======~~:....              ',
              '...................,+???????????? ?::,:,,,,,,::????????=,......................',
              '..................~???????++++,::,::::::~~:::::::+?????:.......................',
              '        :......:~~~~~~~=====+++++++++++++++++++++=+=====~~~......=             ',
              '             ::,::::~~===++===:.,~~~~~~===~~~~~,,:======~~::,                  ',
              '               ,,,::::~~~~~~~~~=~~===~~~~===~=====~~~~~~:::,~                  ',
              '....................::~+???????         =~+     ?????+?+=,.....................',
              '          :,.,~~~~~,:~~~......~,,..:~=+++=~:,..:,.......:~~=~:,~               ',
              '            :........:~~~~~~~~~===============~~~====:,.......                 ',
              '            ::,::~~===+++++++++==~~~~=======~~====+++++==~~:::                 ',
              '         ....,:~~~~~========++++++++++++++++++++++=+=====~~~:....              ',
              '         ,......,~~~~~~~=======+++++++++++++++++++=====~~~.......              ',
              '      ,........+???~:::,,,,,:~~~~==============~~~~:,,?...?                    ',
              '          ...,~~~~~,.,~=====~:,.,.,:~==+==:,,,,.,,.,,~==~::=~,,~               ',
              '             ,........,:::::,:::::~~~~~~~:::,,,,,,~::.......,=                 ',
              '             ::,::~:~~======~:.,~::,,,,,,,,,,,~=.,:~===~~~::,                  ',
              '.........................???++?????====.........?????~,??+::,..................',
              '        ......:~:~~~=~=========+=++++++++++++++++=======~~~~:.....             ',
              '                   ,...,..,.,,.,,,,,,.:::,.,,........?                         ',
              '.......................?++???      ...............??????+::....................',
              '...........................?+?????   ??~....,...+?????????=::..................',
              '        ......:~:~~~~~====~======~==++===+++++===========~~~.....~             ',
              '..........................+????? ?????+=........??????????~::..................',
              '          ....::~~~====+++++=======++++++++++==============~:...~              ',
              '..........................?+?????? ?++=,........????????~+:::..................',
              '         .......:~~~~~~======+++++++++++++++++++++=====~~~:......              ',
              '.......................~??????   :.......,.........??????~:,...................',
              '               ,,:::::~~=~~~:,~=~~~~~~:~~~~~~~====:~~=~~:::::                  ',
              '              ~,,:::::~=====:..~~~,.,:,,.,,,.~==~,:~===~~::,:=                 ',
              '                    :,....::::,:,,,,,,,.,,,,,,..,:=                            ',
              ' ..............+?????=,,,,::,,,::~:~~~~~~~~~:::::,,::??..........~             ',
              '           ,,.:~~====~~~==~=~~~=====~~==+======~~~~~~===~===:,:                ',
              '          ........~~~~~======+++++++++++++++++++=======~~.......               ',
              '          ....::~~~~===============================~~~:~===~:...               ',
              '               ,...........,...................,..........:                    ',
              '         +....:~~~~~~~,,..,,,,,.,:~~~~~===~~~~:,.,,,,,,,:~~~~..,               ',
              '        .......~~~~~~~~=~==+==+++++++++++++=++++++==~====~~,.....:             ',
              '.................~???????+++,,,:,::::::,,,,,:,:::,?????........................',
              '           ~,.,:~==================~~~==+==~=========++++==~:::                ',
              '                 ,....,,,,,......,,,.,..:,:,..........:~                       ',
              '........................??????  ++=.,,:.........++=:?????=::...................',
              '        .......+++?:~:,,,,::~~~==================~~~:,,.?                      ',
              '...................,:+?????????????? =:~:::::~ ???????++:......................',
              '        :....,::~~~~==~====+=+++++++++==+++++++++========~~~:....:             ',
              '.....................~~~+??????        ~:....:  ????????=:.....................',
              '....................::+?????????????????::,.  ????????++~......................',
              '                ,...,,:,.,................,,::..........,=                     ',
              '            ~::,:~~~====+++++==~:~~~~==++===~=::~==++++==:::,:                 ',
              '          ~,.,~~~~~~~,..:~...~=~::,~~=++++=~~::~~~~~~:,,,~==~:,                ',
              '........................~??????=+?+~:~~.........???..????=::...................',
              '    ,..........+????:::,::,,,:~~~~~~==~~~~~~~~~~~~,.:=?......:                 ',
              '................=???????~,,,::,:,:,,,.......,,,,,,:~???..................=     ',
              '               ,,::::::~~~~~~~~~~=====~~~~=====~~~~=~~~::::,                   ',
              '           ........~~~~~========+++++++==++++=========~~........               ',
              '             :..+,,,:~~~~~======~~~==~===~~~~======~~~:::,                     ',
              '               ~.,,::~:~~~~~~~~~~~~~~~=======~=====~~~~::,:                    ',
              ' ..............:??????+,,,,:,,,,:,,,,,,,,....,..,,::~??..............,         ',
              '                 .,:~~:~:::::.....,:~=====~:::~~~:,::~~::,,                    ']
  pw = [16, 47, 75, 168, 53, 36, 57, 116, 94, 21, 64, 52, 13, 95, 1, 17, 32, 38, 4, 142,
        26, 6, 89, 134, 44, 71, 50, 40, 170, 149, 11, 29, 167, 27, 120, 43, 21, 107, 72, 14, 54,
        7, 3, 58, 55, 39, 35, 47, 113, 5, 9, 61, 162, 123, 39, 28, 18, 36, 35, 91, 41, 51, 160,
        128, 54, 53, 0, 138, 165, 125, 31, 25, 19, 155, 25, 66, 3, 15, 49, 96, 49, 56, 158, 100,
        147, 12, 27, 101, 56, 12, 65, 22, 124, 106, 11, 33, 46, 26, 103, 7, 45, 23, 46, 97, 9,
        70, 10, 109, 119, 22, 8, 75, 151, 65, 52, 73, 72, 99, 30, 17, 1, 5, 90, 76, 81, 4, 59,
        50, 82, 84, 30, 68, 102, 148, 80, 48, 74, 129, 137, 132, 69, 2, 140, 34, 144, 55, 20,
        150, 24, 143, 14, 19, 86, 8, 67, 60, 63, 2, 62, 146, 24, 62, 0, 104, 68, 13, 15, 173, 79,
        63, 37, 44, 93, 85, 60, 58, 67]
  y = []
  (0..71).each { |n| y << n + n / 2 * 3 }
  y.each do |z|
    puts scramble[pw[z]]
  end
  'Oh, hello!'
end

#plot_coord(coord, marker = nil) ⇒ Object Also known as: plot_coordinate

.plot_coord can be called explicitly and accepts string arguments in the form

of jedec standard BGA coordinate naming conventions.

  $dut.package = :t4240
  $dut.package.plot_coord("A2")


337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/origen/chip_package.rb', line 337

def plot_coord(coord, marker = nil)
  prepare_plot if field.nil?
  if plottable
    if coord.is_a?(String)
      found_pins = []
      owner.pins.map { |pin| found_pins << pin[1] if coord == pin[1].location.to_s }
      if marker.nil?
        marker = initial(coord.to_s)
        while @groups.index { |grp_name| grp_name =~ /#{marker} -/ }
          marker.next!
          marker = '0' unless marker.size < 2
        end
        found_pins.each do |pin|
          coordinates = coordinate(pin.location)
          @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
          @groups.delete_if { |group| /#{coord}/ =~ group }
          @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
        end
      else
        coordinates = coordinate(found_pins[0].location)
        @field[coordinates[0]][coordinates[1]] = [marker.white_on_blue + ' ']
        @groups.delete_if { |group| /#{coord}/ =~ group }
        @groups << "#{marker} - #{found_pins[0].name} - #{found_pins[0].location}"
      end
      if found_pins.size > 0
        generate_field
      else
        puts "Coordinate not recognized. Jedec convention: <row><col>. E.g., A1.\nCould be power/ground pin. .plot(\"power\") or .plot(\"ground\")."
      end
    else
      puts 'Unsupported argument type.'
    end
  end
end

#plot_helpObject Also known as: help_plot



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/origen/chip_package.rb', line 176

def plot_help
  prepare_plot if field.nil?
  puts "\n#################### PLOT HELP ####################"
  puts 'To generate in-console BGA plots, the ChipPackage class will respond to the following methods:'
  puts '.list_groups, .plot(), .plot_coord(), .show(), and .clear'
  if plottable
    puts "\nPLOTTING GROUPS:"
    puts '$dut.package.list_groups <-- to see available group names'
    puts '$dut.package.plot("ddr_interface_1")'
    puts "$dut.package.plot_group(\"serdes_1\",'Z') <--denotes custom legend marker, Z"
    puts "\nPLOTTING INDIVIDUAL PINS:"
    puts '$dut.package.plot("d1_mdqs00")'
    puts "\nPLOTTING WITH REGEXP:"
    puts '$dut.package.plot("d1_mdqs") <-- Plot all controller 1 DQS pins.'
    puts '$dut.package.plot("d1_mdqs0[0-9]") <-- Plot d1_mdqs00 - d1_mdqs09.'
    puts "\nADDING POWER/GROUND:"
    puts '$dut.package.plot("grounds")'
    puts '$dut.package.plot("power")'
    puts "\nVIEW CURRENT PLOT\n"
    puts '$dut.package.show'
  else
    puts 'Currently, only BGA package types are supported for in-console plotting.'
  end
end

#prepare_plotObject

prepare_plot should not need to be called explicitly. It is called

by other methods when need-be, and is fundamentallyis responsible
for two things:

  1. It checks that self.types includes a "BGA" option.
  2. It populates the .field attribute with a multi-dimensional
     array, proportional in size to the package BGA.


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/origen/chip_package.rb', line 59

def prepare_plot
  @plottable = types.any? { |x| /BGA/i =~ x }
  if @plottable
    @last_empty_char = '.'
    @field = []
    @groups = []
    @group_list = list_groups
    @columns = []
    jedec_rows = %w(A B C D E F G H J K L M N P R T U V W Y AA AB AC AD AE AF AG AH AJ AK AL AM AN AP AR AT AU AV AW AY BA BB BC BD BE BF BG BH BJ BK BL BM BN BP)
    @number_of_rows.times { @field.insert(0, []); @number_of_columns.times { @field[0].insert(0, []) } }
    @rows = jedec_rows[0, @number_of_rows]
    (1..@number_of_columns).map { |item| @columns << item }
    @upper_axes = []
    @lower_axes = []
    @columns.each_with_index do |column, index|
      # if index % 2 == 0
      if index.even?
        temp = column.to_s
        temp += ' ' unless temp.size > 1
        @upper_axes << temp
        @lower_axes << '  '
      else
        temp = column.to_s
        temp += ' ' unless temp.size > 1
        @lower_axes << temp
        @upper_axes << '  '
      end
    end
  else
    puts 'Sorry, currently the plot feature only supports BGA package types.'
  end
end

#quote_regex(regex_statement) ⇒ Object



373
374
375
376
377
378
379
# File 'lib/origen/chip_package.rb', line 373

def quote_regex(regex_statement)
  with_escapes = regex_statement
  with_escapes.gsub!('[', '\[')
  with_escapes.gsub!(']', '\]')
  with_escapes.gsub!('^', '\^')
  with_escapes
end

#to_row(alphanumeric_coord) ⇒ Object



242
243
244
245
246
# File 'lib/origen/chip_package.rb', line 242

def to_row(alphanumeric_coord)
  ## This maps alpha row coordinate to its appropriate Jedec:
  number = alphanumeric_coord.upcase.tr('A-HJ-NPRT-WY', '1-9a-q').to_i(21) - 1
  number -= (number / 21)
end

#to_sObject



39
40
41
# File 'lib/origen/chip_package.rb', line 39

def to_s
  id.to_s
end

#to_symObject



43
44
45
# File 'lib/origen/chip_package.rb', line 43

def to_sym
  to_s.to_sym
end