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.



644
645
646
# File 'lib/HDLRuby/hruby_rcsim.rb', line 644

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.



648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
# File 'lib/HDLRuby/hruby_rcsim.rb', line 648

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_block_owner(@rcstatement,owner)
    end

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

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

    return @rcstatement
end