Method: HDLRuby::Viz::Node#next_place_matrix

Defined in:
lib/HDLRuby/hruby_viz.rb

#next_place_matrix(matrix, c0, r, c) ⇒ Object

Find the next free position in the place matrix +matrix+. +c0+ is the left-most column that can be used. +r+ and +c+ are the current row and column. Retuns the new rows and columns.



3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
# File 'lib/HDLRuby/hruby_viz.rb', line 3328

def next_place_matrix(matrix,c0,r,c)
  puts "next_place_matrix: matrix[0].size=#{matrix[0].size} r=#{r} c=#{c}"
  while matrix[r][c] do
    c += 1
    if c >= matrix[0].size then
      c = c0
      r += 1
      if r >= matrix.size then
        # Need to increase the size of the matrix.
        matrix << ([nil] * matrix[0].size)
      end
    end
  end
  puts "r=#{r} c=#{c}"
  return r,c
end