Class: HDLRuby::High::Transmit

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

Overview

Enhance the Transmit class with VCD support.

Constant Summary collapse

High =
HDLRuby::High

Constants included from Low::Low2Symbol

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

Instance Attribute Summary collapse

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, #casts_without_expression!, #clone, #each_block, #each_block_deep, #each_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_hdr, #to_high, #to_verilog, #to_vhdl, #use_name?

Methods inherited from Low::Statement

#add_blocks_code, #add_make_block, #behavior, #block, #blocks2seq!, #break_types!, #clone, #delete_related!, #delete_unless!, #each_deep, #each_statement, #eql?, #explicit_types!, #extract_declares!, #hash, #mix?, #par_in_seq2seq!, #parent_system, #replace_expressions!, #replace_names!, #scope, #to_c, #to_ch, #to_hdr, #to_high, #to_seq!, #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

#hierarchy, #no_parent!, #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.



3619
3620
3621
3622
3623
3624
# File 'lib/HDLRuby/hruby_high.rb', line 3619

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

Instance Attribute Details

#rcstatementObject (readonly)

Returns the value of attribute rcstatement.



522
523
524
# File 'lib/HDLRuby/hruby_rcsim.rb', line 522

def rcstatement
  @rcstatement
end

Instance Method Details

#execute(mode) ⇒ Object

Executes the statement.



655
656
657
# File 'lib/HDLRuby/hruby_rsim.rb', line 655

def execute(mode)
    self.left.assign(mode,self.right.execute(mode))
end

#get_vars_with_fullname(vars_with_fullname = {}) ⇒ Object

Gets the VCD variables with their long name.



250
251
252
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 250

def get_vars_with_fullname(vars_with_fullname = {})
    # By default: nothing to do
end

#get_vars_with_idstr(vars_with_idstr = {}) ⇒ Object

Gets the VCD variables with their id string.



255
256
257
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 255

def get_vars_with_idstr(vars_with_idstr = {})
    # By default: nothing to do
end

#init_sim(systemT) ⇒ Object

Initialize the simulation for system +systemT+.



650
651
652
# File 'lib/HDLRuby/hruby_rsim.rb', line 650

def init_sim(systemT)
    self.left.init_sim(systemT)
end

#show_hierarchy(vcdout) ⇒ Object

Shows the hierarchy of the variables.



245
246
247
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 245

def show_hierarchy(vcdout)
    # By default: nothing to do.
end

#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.



3630
3631
3632
3633
3634
3635
3636
3637
# File 'lib/HDLRuby/hruby_high.rb', line 3630

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.



3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
# File 'lib/HDLRuby/hruby_high.rb', line 3640

def to_low
    # return HDLRuby::Low::Transmit.new(self.left.to_low,
    #                                   self.right.to_low)
    transmitL = HDLRuby::Low::Transmit.new(self.left.to_low,
                                      self.right.to_low)
    # # For debugging: set the source high object 
    # transmitL.properties[:low2high] = self.hdr_id
    # self.properties[:high2low] = transmitL
    return transmitL
end

#to_rcsimObject

Generate the C description of the transmit.



525
526
527
528
529
530
531
# File 'lib/HDLRuby/hruby_rcsim.rb', line 525

def to_rcsim
    # Create the transmit C object.
    @rcstatement = RCSim.rcsim_make_transmit(self.left.to_rcsim,
                                       self.right.to_rcsim)

    return @rcstatement
end