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



2485
2486
2487
2488
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2485

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#to_cObject

Convert to Ruby code.



2496
2497
2498
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2496

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

#to_rubyObject

Convert to Ruby code.



2491
2492
2493
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2491

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