Class: HDLRuby::High::Connection

Inherits:
Low::Connection show all
Defined in:
lib/HDLRuby/hruby_high.rb

Overview

Describes a connection.

Constant Summary collapse

High =
HDLRuby::High

Constants included from Low::Low2Symbol

Low::Low2Symbol::Low2SymbolPrefix, Low::Low2Symbol::Low2SymbolTable, Low::Low2Symbol::Symbol2LowTable

Instance Attribute Summary

Attributes inherited from Low::Transmit

#left, #right

Attributes included from Low::Hparent

#parent

Instance Method Summary collapse

Methods inherited from Low::Connection

#array_connection, #eql?, #hash, #reassign_expressions!, #to_verilog

Methods inherited from Low::Transmit

#boolean_in_assign2select!, #break_concat_assigns, #clone, #each_block, #each_block_deep, #each_node, #each_node_deep, #each_statement_deep, #eql?, #explicit_types!, #extract_selects!, #hash, #initialize, #map_nodes!, #replace_expressions!, #set_left!, #set_right!, #to_c, #to_high, #to_verilog, #to_vhdl

Methods inherited from Low::Statement

#add_blocks_code, #block, #blocks2seq!, #break_types!, #clone, #delete_unless!, #eql?, #explicit_types!, #extract_declares!, #hash, #mix?, #replace_expressions!, #replace_names!, #to_c, #to_high, #to_upper_space!, #to_vhdl, #top_block, #top_scope, #with_boolean!

Methods included from Low::Low2Symbol

#to_sym

Constructor Details

This class inherits a constructor from HDLRuby::Low::Transmit

Instance Method Details

#at(event) ⇒ Object

Creates a new behavior sensitive to +event+ including the connection converted to a transmission, and replace the former by the new behavior.



2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
# File 'lib/HDLRuby/hruby_high.rb', line 2796

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) ⇒ Object

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.



2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
# File 'lib/HDLRuby/hruby_high.rb', line 2817

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_exprObject

Converts the connection to a comparison expression.

NOTE: required because the <= operator is ambigous and by default produces a Transmit or a Connection.



2786
2787
2788
2789
2790
2791
# File 'lib/HDLRuby/hruby_high.rb', line 2786

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_lowObject

Converts the connection to HDLRuby::Low.



2836
2837
2838
2839
# File 'lib/HDLRuby/hruby_high.rb', line 2836

def to_low
    return HDLRuby::Low::Connection.new(self.left.to_low,
                                        self.right.to_low)
end