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+



3333
3334
3335
3336
3337
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3333

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.



3330
3331
3332
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3330

def name
  @name
end

Instance Method Details

#to_cObject

Convert to C code.



3345
3346
3347
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3345

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.



3340
3341
3342
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3340

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