Class: BlifUtils::NetlistGraph::Vertice

Inherits:
Object
  • Object
show all
Defined in:
lib/blifutils/layering.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVertice

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

#componentObject

Returns the value of attribute component.



273
274
275
# File 'lib/blifutils/layering.rb', line 273

def component
  @component
end

#idObject

Returns the value of attribute id.



277
278
279
# File 'lib/blifutils/layering.rb', line 277

def id
  @id
end

#layerObject

Returns the value of attribute layer.



276
277
278
# File 'lib/blifutils/layering.rb', line 276

def layer
  @layer
end

#predecessorsObject

Returns the value of attribute predecessors.



275
276
277
# File 'lib/blifutils/layering.rb', line 275

def predecessors
  @predecessors
end

#successorsObject

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

#cloneObject



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_referencesObject



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_sObject



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