Class: BlifUtils::NetlistGraph::Vertice
- Inherits:
-
Object
- Object
- BlifUtils::NetlistGraph::Vertice
- Defined in:
- lib/blifutils/layering.rb
Instance Attribute Summary collapse
-
#component ⇒ Object
Returns the value of attribute component.
-
#id ⇒ Object
Returns the value of attribute id.
-
#layer ⇒ Object
Returns the value of attribute layer.
-
#predecessors ⇒ Object
Returns the value of attribute predecessors.
-
#successors ⇒ Object
Returns the value of attribute successors.
Class Method Summary collapse
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize ⇒ Vertice
constructor
A new instance of Vertice.
- #remove_input_output_reg_cst_modinst_references ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Vertice
Returns a new instance of Vertice.
279 280 281 282 283 284 285 |
# File 'lib/blifutils/layering.rb', line 279 def initialize @component = nil @successors = [] @predecessors = [] @layer = nil @id = -1 end |
Instance Attribute Details
#component ⇒ Object
Returns the value of attribute component.
273 274 275 |
# File 'lib/blifutils/layering.rb', line 273 def component @component end |
#id ⇒ Object
Returns the value of attribute id.
277 278 279 |
# File 'lib/blifutils/layering.rb', line 277 def id @id end |
#layer ⇒ Object
Returns the value of attribute layer.
276 277 278 |
# File 'lib/blifutils/layering.rb', line 276 def layer @layer end |
#predecessors ⇒ Object
Returns the value of attribute predecessors.
275 276 277 |
# File 'lib/blifutils/layering.rb', line 275 def predecessors @predecessors end |
#successors ⇒ Object
Returns the value of attribute successors.
274 275 276 |
# File 'lib/blifutils/layering.rb', line 274 def successors @successors end |
Class Method Details
.create_from_model_component(component, model) ⇒ Object
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/blifutils/layering.rb', line 317 def self.create_from_model_component (component, model) newVertice = BlifUtils::NetlistGraph::Vertice.new newVertice.component = component component.inputs.each do |net| driverCompo = net.driver newVertice.predecessors << driverCompo unless newVertice.predecessors.include?(driverCompo) end component.output.fanouts.each do |fanout| fanoutCompo = fanout.target newVertice.successors << fanoutCompo unless newVertice.successors.include?(fanoutCompo) end return newVertice end |
.get_vertices_from_model(model) ⇒ Object
335 336 337 338 |
# File 'lib/blifutils/layering.rb', line 335 def self.get_vertices_from_model (model) vertices = model.components.collect{|component| self.create_from_model_component(component, model)} return vertices end |
Instance Method Details
#clone ⇒ Object
288 289 290 291 292 293 294 295 296 |
# File 'lib/blifutils/layering.rb', line 288 def clone newVertice = BlifUtils::NetlistGraph::Vertice.new newVertice.component = @component newVertice.layer = @layer newVertice.successors = @successors.collect{|suc| suc} newVertice.predecessors = @predecessors.collect{|pred| pred} newVertice.id = @id return newVertice end |
#remove_input_output_reg_cst_modinst_references ⇒ Object
299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/blifutils/layering.rb', line 299 def remove_input_output_reg_cst_modinst_references @successors.delete_if do |successor| successor == :output or successor.component.class == BlifUtils::Netlist::Latch end @predecessors.delete_if do |predecessor| predecessor == :input or predecessor.component.class == BlifUtils::Netlist::Latch or (predecessor.component.class == BlifUtils::Netlist::LogicGate and predecessor.component.is_constant?) end end |
#to_s ⇒ Object
312 313 314 |
# File 'lib/blifutils/layering.rb', line 312 def to_s return "#{@component.class.name.split('::')[-1]} (#{@component.output.name})#{@layer.nil? ? '' : " [L#{@layer}]"}" end |