Class: RubyHDL::High::Sreturn

Inherits:
Statement show all
Defined in:
lib/HDLRuby/std/sequencer_sw.rb

Overview

Describes a SW implementation of a return statement.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Statement

#each_statement, #each_statement_deep

Constructor Details

#initialize(sequencer, val) ⇒ Sreturn

Create a new break statement in sequencer +sequencer+ returning value +val+.



2707
2708
2709
2710
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2707

def initialize(sequencer,val)
  @sequencer = sequencer
  @value = val
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



2703
2704
2705
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2703

def value
  @value
end

Instance Method Details

#to_cObject

Convert to Ruby code.



2718
2719
2720
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2718

def to_c
  return @sequencer.clk_up_c + "\nreturn #{@value.to_c};"
end

#to_python(l = "") ⇒ Object

Convert to Python code.



2723
2724
2725
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2723

def to_python(l = "")
  return @sequencer.clk_up_python(l) + "\n#{l}return #{@value.to_c}"
end

#to_rubyObject

Convert to Ruby code.



2713
2714
2715
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2713

def to_ruby
  return @sequencer.clk_up + "\nreturn #{@value.to_ruby}"
end