Method: Mux2#abelout

Defined in:
lib/Mux2.rb

#abeloutObject

This method defines the connections held by the ports of this object and returns the specific ABEL code to be output for this object based on the connections on its input ports.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/Mux2.rb', line 11

def abelout
  # make these class variables just for consistency's sake
  @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
  
  s = ""
  s << "\n\"active low enabled MUX2\nWHEN (#{@p0} == 1) THEN\n\t#{self.name}p10 = 0;\n"
  s << "else WHEN (!#{@p0} & !#{@p1}) THEN\n\t#{self.name}p10 = #{@p2};\n"
  s << "else WHEN (!#{@p0} & #{@p1}) THEN\n\t#{self.name}p10 = #{@p3};\n"        
end