class BlifUtils::NetlistGraph::Vertice

Attributes

component[RW]
id[RW]
layer[RW]
predecessors[RW]
successors[RW]

Public Class Methods

create_from_model_component(component, model) click to toggle source
# 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) click to toggle source
# 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
new() click to toggle source
# File lib/blifutils/layering.rb, line 279
def initialize
        @component = nil
        @successors = []
        @predecessors = []
        @layer = nil
        @id = -1
end

Public Instance Methods

clone() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/blifutils/layering.rb, line 312
def to_s
        return "#{@component.class.name.split('::')[-1]} (#{@component.output.name})#{@layer.nil? ? '' : " [L#{@layer}]"}"
end