Class: HDLRuby::High::Transmit

Inherits:
Low::Transmit show all
Includes:
HStatement
Defined in:
lib/HDLRuby/hruby_high.rb

Overview

Decribes a transmission statement.

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 included from HStatement

#hif

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, #map_nodes!, #replace_expressions!, #set_left!, #set_right!, #to_c, #to_high, #to_verilog, #to_vhdl, #use_name?

Methods inherited from Low::Statement

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

Methods included from Low::Low2Symbol

#to_sym

Methods included from Low::Hparent

#scope

Constructor Details

#initialize(left, right) ⇒ Transmit

Creates a new transmission from a +right+ expression to a +left+ reference, ensuring left is not a constant.



2971
2972
2973
2974
2975
2976
# File 'lib/HDLRuby/hruby_high.rb', line 2971

def initialize(left,right)
    if left.constant? then
        raise AnyError, "Cannot assign to constant: #{left}"
    end
    super(left,right)
end

Instance Method Details

#to_exprObject

Converts the transmission to a comparison expression.

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



2982
2983
2984
2985
2986
2987
2988
2989
# File 'lib/HDLRuby/hruby_high.rb', line 2982

def to_expr
    # Remove the transission from the block.
    High.top_user.delete_statement!(self)
    # Generate an expression.
    return Binary.new(
        self.left.to_expr.type.send(:<=,self.right.to_expr.type),
        :<=,self.left.to_expr,self.right.to_expr)
end

#to_lowObject

Converts the transmit to HDLRuby::Low.



2992
2993
2994
2995
# File 'lib/HDLRuby/hruby_high.rb', line 2992

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