Class: RubyHDL::High::Swhile

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

Overview

Describes a SW implementation of a while statement.

Instance Method Summary collapse

Constructor Details

#initialize(sequencer, cond, &ruby_block) ⇒ Swhile

Create a new while statement in sequencer +sequencer+ with +cond+ condition and +ruby_block+ for generating the block that is taken while the condition is met.



2034
2035
2036
2037
2038
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2034

def initialize(sequencer,cond, &ruby_block)
  @sequencer = sequencer
  @condition = cond.to_expr
  @yes_blk = Sblock.new(sequencer,&ruby_block)
end

Instance Method Details

#to_rubyObject

Convert to ruby code.



2041
2042
2043
2044
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2041

def to_ruby
  return @sequencer.clk_up + 
    "\nwhile(#{@condition.to_ruby}) do\n#{@yes_blk.to_ruby}\n#{@sequencer.clk_up}\nend\n"
end