class HDLRuby::High::Connection
Describes a connection.
Constants
- High
High-level libraries for describing digital hardware.
Public Instance Methods
at(event)
click to toggle source
Creates a new behavior sensitive to event
including the connection converted to a transmission, and replace the former by the new behavior.
# File lib/HDLRuby/hruby_high.rb, line 3331 def at(event) # Creates the behavior. left, right = self.left, self.right # Detached left and right from their connection since they will # be put in a new behavior instead. left.parent = right.parent = nil # Create the new behavior replacing the connection. behavior = Behavior.new(:par,event) do left <= right end # Adds the behavior. High.top_user.add_behavior(behavior) # Remove the connection High.top_user.delete_connection!(self) end
hif(condition)
click to toggle source
Creates a new behavior with an if statement from condition
enclosing the connection converted to a transmission, and replace the former by the new behavior.
NOTE: the else part is defined through the helse method.
# File lib/HDLRuby/hruby_high.rb, line 3352 def hif(condition) # Creates the behavior. left, right = self.left, self.right # Detached left and right from their connection since they will # be put in a new behavior instead. left.parent = right.parent = nil # Create the new behavior replacing the connection. behavior = Behavior.new(:par) do hif(condition) do left <= right end end # Adds the behavior. High.top_user.add_behavior(behavior) # Remove the connection High.top_user.delete_connection!(self) end
to_expr()
click to toggle source
Converts the connection to a comparison expression.
NOTE: required because the <= operator is ambigous and by default produces a Transmit
or a Connection
.
# File lib/HDLRuby/hruby_high.rb, line 3321 def to_expr # Remove the connection from the system type. High.top_user.delete_connection(self) # Generate an expression. return Binary.new(:<=,self.left,self.right) end
to_low()
click to toggle source
Converts the connection to HDLRuby::Low
.
# File lib/HDLRuby/hruby_high.rb, line 3371 def to_low # return HDLRuby::Low::Connection.new(self.left.to_low, # self.right.to_low) connectionL = HDLRuby::Low::Connection.new(self.left.to_low, self.right.to_low) # For debugging: set the source high object connectionL.properties[:low2high] = self.hdr_id self.properties[:high2low] = connectionL return connectionL end