Module: HDLRuby::High::RCSimBlock

Included in:
Block, TimeBlock
Defined in:
lib/HDLRuby/hruby_rcsim.rb

Overview

Module for extending the Block classes for hybrid Ruby-C simulation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rcstatementObject (readonly)

Returns the value of attribute rcstatement.



679
680
681
# File 'lib/HDLRuby/hruby_rcsim.rb', line 679

def rcstatement
  @rcstatement
end

Instance Method Details

#to_rcsim(owner = nil) ⇒ Object

Generate the C description of the hardware case. +owner+ is a link to the C description of the owner behavior if any.



683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
# File 'lib/HDLRuby/hruby_rcsim.rb', line 683

def to_rcsim(owner = nil)
    # Create the block C object.
    @rcstatement = RCSim.rcsim_make_block(self.mode)

    # Sets the owner if any.
    if owner then
        RCSim.rcsim_set_owner(@rcstatement,owner)
    end

    # Add the inner signals.
    # self.each_inner do |inner|
    #     RCSim.rcsim_add_block_inner(@rcstatement,inner.to_rcsim(@rcstatement))
    # end
    if self.each_inner.any? then
        RCSim.rcsim_add_block_inners(@rcstatement,
                                     self.each_inner.map do |sig|
            sig.to_rcsim(@rcstatement)
        end)
    end

    # Add the statements.
    # self.each_statement do |stmnt|
    #     RCSim.rcsim_add_block_statement(@rcstatement,stmnt.to_rcsim)
    # end
    if self.each_statement.any? then
        RCSim.rcsim_add_block_statements(@rcstatement,
                                    self.each_statement.map do |stmnt|
            stmnt.to_rcsim
        end)
    end

    return @rcstatement
end