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.
2191 2192 2193 2194 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2191 def initialize(sequencer, &ruby_block) @sequencer = sequencer @blk = Sblock.new(sequencer,&ruby_block) end |
Instance Method Details
#to_c ⇒ Object
Convert to C code.
2202 2203 2204 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2202 def to_c return "for(;;){\n#{@blk.to_ruby}\n#{@sequencer.clk_up_c}\n}" end |
#to_ruby ⇒ Object
Convert to Ruby code.
2197 2198 2199 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2197 def to_ruby return "loop do\n#{@blk.to_ruby}\n#{@sequencer.clk_up}\nend" end |