Class: RubyHDL::High::SfunctionT
- Inherits:
-
Object
- Object
- RubyHDL::High::SfunctionT
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes a SW implementation of a sequencer function.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(type, name, sblock, *args) ⇒ SfunctionT
constructor
Create a new named +name+ with arguments +args+ and executing the content of block +sblock+.
-
#to_c ⇒ Object
Convert to C code.
-
#to_ruby ⇒ Object
Convert to Ruby code.
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
#name ⇒ Object (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_c ⇒ Object
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_ruby ⇒ Object
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 |