Class: HDLRuby::High::Std::SequencerFunctionE

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

Overview

Describes a sequencer eigen function. Here, an eigen function is a function definition specilized with arguments types.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(funcT, argTs) ⇒ SequencerFunctionE

Creates a new eigen function with function type +funcT+ and arguments types +argTs+.



116
117
118
119
# File 'lib/HDLRuby/std/sequencer_func.rb', line 116

def initialize(funcT, argTs)
    @funcT = funcT
    @argTs = argTs.to_a
end

Instance Attribute Details

#funcTObject (readonly)

Returns the value of attribute funcT.



112
113
114
# File 'lib/HDLRuby/std/sequencer_func.rb', line 112

def funcT
  @funcT
end

Instance Method Details

#==(obj) ⇒ Object

Comparison of eigen functions.



147
148
149
150
151
152
153
154
# File 'lib/HDLRuby/std/sequencer_func.rb', line 147

def ==(obj)
    # Is obj an eigen function?
    return false unless obj.is_a?(SequencerFunctionE)
    # Has obj the same function type?
    return false unless self.funcT == obj.funcT
    # Has obj the same argument types?
    return obj.each_argT.zip(self.each_argT).all? {|t0,t1| t0 == t1 }
end

#bodyObject

Gets the body of the function.



127
128
129
# File 'lib/HDLRuby/std/sequencer_func.rb', line 127

def body
    @funcT.body
end

#each_argT(&ruby_block) ⇒ Object

Iterates over the argument types.

Returns an enumerator if no ruby block is given.



139
140
141
142
143
144
# File 'lib/HDLRuby/std/sequencer_func.rb', line 139

def each_argT(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_argT) unless ruby_block
    # A ruby block? Apply it on each agument type.
    @argTs.each(&ruby_block)
end

#nameObject

Gets the name of the function.



122
123
124
# File 'lib/HDLRuby/std/sequencer_func.rb', line 122

def name
    @funcT.name
end

#overflowObject

Gets the stack overflow code of the function.



132
133
134
# File 'lib/HDLRuby/std/sequencer_func.rb', line 132

def overflow
    @funcT.overflow
end