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+
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
#name ⇒ Object (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_c ⇒ Object
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_ruby ⇒ Object
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 |