Class: RubyHDL::High::Sloop
- Inherits:
-
Object
- Object
- RubyHDL::High::Sloop
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes a SW implementation of a loop statement.
Instance Method Summary collapse
-
#initialize(sequencer, &ruby_block) ⇒ Sloop
constructor
Create a new infinite loop statement in sequencer +sequencer+ with +ruby_block+ for generating the block that is taken.
-
#to_c ⇒ Object
Convert to C code.
-
#to_ruby ⇒ Object
Convert to Ruby code.
Constructor Details
#initialize(sequencer, &ruby_block) ⇒ Sloop
Create a new infinite loop statement in sequencer +sequencer+ with +ruby_block+ for generating the block that is taken.
2244 2245 2246 2247 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2244 def initialize(sequencer, &ruby_block) @sequencer = sequencer @blk = Sblock.new(sequencer,&ruby_block) end |
Instance Method Details
#to_c ⇒ Object
Convert to C code.
2255 2256 2257 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2255 def to_c return "for(;;){\n#{@blk.to_ruby}\n#{@sequencer.clk_up_c}\n}" end |
#to_ruby ⇒ Object
Convert to Ruby code.
2250 2251 2252 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2250 def to_ruby return "loop do\n#{@blk.to_ruby}\n#{@sequencer.clk_up}\nend" end |