Class: FivePorts

Inherits:
Inst
  • Object
show all
Defined in:
lib/FivePorts.rb

Overview

This class is the superclass for all five port Inst objects Nand4c and Nand4 inherit from this class

Direct Known Subclasses

Nand4, Nand4c

Instance Attribute Summary

Attributes inherited from Inst

#inputs, #name, #nodes, #outputs

Instance Method Summary collapse

Methods inherited from Inst

#get_port

Constructor Details

#initialize(name) ⇒ FivePorts

This method is called when a new object is instantiated, it takes the name of the Inst object (name) as its only argument. It is responsible for calling its superclass Inst and passing to it the correct number of input ports and output ports to be created.



8
9
10
# File 'lib/FivePorts.rb', line 8

def initialize(name)
  super(name,[0,1,2,3],[4])
end

Instance Method Details

#abeloutObject

This method defines the connections held by the ports for this object’s subclasses.



13
14
15
16
17
18
# File 'lib/FivePorts.rb', line 13

def abelout
  @p0 = self.get_port("p0").connections.collect{|p| p.name}.to_s
  @p1 = self.get_port("p1").connections.collect{|p| p.name}.to_s
  @p2 = self.get_port("p2").connections.collect{|p| p.name}.to_s
  @p3 = self.get_port("p3").connections.collect{|p| p.name}.to_s
end