Class: RubyHDL::High::SfunctionT

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

Overview

Describes a SW implementation of a sequencer function.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name, sblock, *args) ⇒ SfunctionT

Create a new named +name+ with arguments +args+ and executing the content of block +sblock+



3421
3422
3423
3424
3425
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3421

def initialize(type,name,sblock,*args)
  @name = name.to_sym
  @args  = args
  @blk = sblock
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3418
3419
3420
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3418

def name
  @name
end

Instance Method Details

#to_cObject

Convert to C code.



3433
3434
3435
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3433

def to_c
  return "unsigned long long #{name}(#{@args.map {|arg| "unsigned long long " + arg.to_c}.join(",")} {\n#{@blk.to_c}\n}\n"
end

#to_rubyObject

Convert to Ruby code.



3428
3429
3430
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3428

def to_ruby
  return "def #{name}(#{@args.map {|arg| arg.to_ruby}.join(",")}\n#{@blk.to_ruby}\nend\n"
end