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



2470
2471
2472
2473
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2470

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



2466
2467
2468
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2466

def value
  @value
end

Instance Method Details

#to_cObject

Convert to Ruby code.



2481
2482
2483
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2481

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

#to_rubyObject

Convert to Ruby code.



2476
2477
2478
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2476

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