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.



3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
# File 'lib/HDLRuby/hruby_high.rb', line 3577

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