Class: HDLRuby::Viz::IC::Tile
- Inherits:
-
Object
- Object
- HDLRuby::Viz::IC::Tile
- Defined in:
- lib/HDLRuby/hruby_viz.rb
Overview
A routing tile.
Instance Attribute Summary collapse
-
#dots ⇒ Object
readonly
The dots to draw on the tile.
-
#ic ⇒ Object
Returns the value of attribute ic.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
-
#wires ⇒ Object
readonly
The wires to draw on the tile.
Instance Method Summary collapse
-
#dir(port) ⇒ Object
Give the direction of the route from +port+ if any.
-
#free_from_left?(port0, port1) ⇒ Boolean
(also: #free_from_right?)
Tell if the tile is free for a +port+ route from left.
-
#free_from_up?(port0, port1) ⇒ Boolean
(also: #free_from_down?)
Tell if the tile is free for a +port+ route from up.
-
#initialize ⇒ Tile
constructor
A new instance of Tile.
Constructor Details
#initialize ⇒ Tile
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
#dots ⇒ Object (readonly)
The dots to draw on the tile.
1383 1384 1385 |
# File 'lib/HDLRuby/hruby_viz.rb', line 1383 def dots @dots end |
#ic ⇒ Object
Returns the value of attribute ic.
1380 1381 1382 |
# File 'lib/HDLRuby/hruby_viz.rb', line 1380 def ic @ic end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
1379 1380 1381 |
# File 'lib/HDLRuby/hruby_viz.rb', line 1379 def routes @routes end |
#wires ⇒ Object (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)
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)
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 |