Class: HDLRuby::Viz::IC::Tile

Inherits:
Object
  • Object
show all
Defined in:
lib/HDLRuby/hruby_viz.rb

Overview

A routing tile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTile

Returns a new instance of Tile.



1385
1386
1387
1388
1389
1390
# File 'lib/HDLRuby/hruby_viz.rb', line 1385

def initialize
  @routes = []
  @ic = nil
  @wires = []
  @dots = []
end

Instance Attribute Details

#dotsObject (readonly)

The dots to draw on the tile.



1383
1384
1385
# File 'lib/HDLRuby/hruby_viz.rb', line 1383

def dots
  @dots
end

#icObject

Returns the value of attribute ic.



1380
1381
1382
# File 'lib/HDLRuby/hruby_viz.rb', line 1380

def ic
  @ic
end

#routesObject (readonly)

Returns the value of attribute routes.



1379
1380
1381
# File 'lib/HDLRuby/hruby_viz.rb', line 1379

def routes
  @routes
end

#wiresObject (readonly)

The wires to draw on the tile.



1382
1383
1384
# File 'lib/HDLRuby/hruby_viz.rb', line 1382

def wires
  @wires
end

Instance Method Details

#dir(port) ⇒ Object

Give the direction of the route from +port+ if any.



1393
1394
1395
1396
1397
1398
1399
# File 'lib/HDLRuby/hruby_viz.rb', line 1393

def dir(port)
  return BLOCKED if ic
  @routes.each do |p0,p1,dir|
    return dir if p0 == port
  end
  return nil
end

#free_from_left?(port0, port1) ⇒ Boolean Also known as: free_from_right?

Tell if the tile is free for a +port+ route from left. def free_from_left?(port)

Returns:

  • (Boolean)


1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
# File 'lib/HDLRuby/hruby_viz.rb', line 1420

def free_from_left?(port0,port1)
  # puts "left? in ic: #{ic.name}..." if ic
  # IC tile, not free.
  return false if ic
  # Are there any conflicting routes.
  @routes.each do |p0,p1,dir|
    # puts "left? port0=#{port0.name} port1=#{port1.name} p0=#{p0.name} p1=#{p1.name}"
    # next if p0 == port or p1 == port
    next if p0 == port0 or p1 == port0 or p0 == port1 or p1 == port1
    # puts "No skip"
    return false if (dir & (LEFT|RIGHT) != 0)
  end
  return true
end

#free_from_up?(port0, port1) ⇒ Boolean Also known as: free_from_down?

Tell if the tile is free for a +port+ route from up. def free_from_up?(port)

Returns:

  • (Boolean)


1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
# File 'lib/HDLRuby/hruby_viz.rb', line 1403

def free_from_up?(port0,port1)
  # puts "up? in ic: #{ic.name}..." if ic
  # IC tile, not free.
  return false if ic
  # Are there any conflicting routes.
  @routes.each do |p0,p1,dir|
    # puts "up? port0=#{port0.name} port1=#{port1.name} p0=#{p0.name} p1=#{p1.name}"
    # next if p0 == port or p1 == port
    next if p0 == port0 or p1 == port0 or p0 == port1 or p1 == port1
    # puts "No skip"
    return false if (dir & (UP|DOWN) != 0)
  end
  return true
end