Module: HDLRuby::High::HArrow

Defined in:
lib/HDLRuby/hruby_high.rb

Overview

Module giving high-level properties for handling the arrow (<=) operator.

Constant Summary collapse

High =
HDLRuby::High

Instance Method Summary collapse

Instance Method Details

#<=(expr) ⇒ Object

Creates a transmit, or connection with an +expr+.

NOTE: it is converted afterward to an expression if required.



3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
# File 'lib/HDLRuby/hruby_high.rb', line 3059

def <=(expr)
    # Generate a ref from self for the left of the transmit.
    left = self.to_ref
    # Cast expr to self if required.
    expr = expr.to_expr.match_type(left.type)
    # Ensure expr is an expression.
    expr = expr.to_expr
    # Cast it to left if necessary.
    expr = expr.as(left.type) unless expr.type.eql?(left.type)
    # Generate the transmit.
    if High.top_user.is_a?(HDLRuby::Low::Block) then
        # We are in a block, so generate and add a Transmit.
        High.top_user.
            # add_statement(Transmit.new(self.to_ref,expr))
            add_statement(Transmit.new(left,expr))
    else
        # We are in a system type, so generate and add a Connection.
        High.top_user.
            # add_connection(Connection.new(self.to_ref,expr))
            add_connection(Connection.new(left,expr))
    end
end