Class: RubyHDL::High::SignalI
- Inherits:
-
Expression
- Object
- Expression
- RubyHDL::High::SignalI
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes a SW implementation of a signal.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
, :content.
-
#type ⇒ Object
readonly
, :content.
Instance Method Summary collapse
-
#array? ⇒ Boolean
Tell if the signal is an array.
-
#initialize(type, name) ⇒ SignalI
constructor
Create a new signal with type +type+ and name +name+.
-
#to_f ⇒ Object
Convert to an float.
-
#to_i ⇒ Object
Convert to an integer.
-
#to_ruby ⇒ Object
(also: #to_c)
Convert to Ruby code.
-
#to_s ⇒ Object
Convert to a string.
-
#value ⇒ Object
Gets the value of the signal.
-
#value=(val) ⇒ Object
Sets the value of the signal.
-
#value? ⇒ Boolean
Check if a value is defined for the signal.
Methods inherited from Expression
#<=, #[], #mux, #sdownto, #seach, #stimes, #supto, #to_expr, #to_value
Constructor Details
#initialize(type, name) ⇒ SignalI
Create a new signal with type +type+ and name +name+.
3110 3111 3112 3113 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3110 def initialize(type,name) @type = type.to_type @name = name.to_sym end |
Instance Attribute Details
#name ⇒ Object (readonly)
, :content
3108 3109 3110 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3108 def name @name end |
#type ⇒ Object (readonly)
, :content
3108 3109 3110 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3108 def type @type end |
Instance Method Details
#array? ⇒ Boolean
Tell if the signal is an array.
3116 3117 3118 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3116 def array? return @type.base.is_a?(TypeVector) end |
#to_f ⇒ Object
Convert to an float.
3149 3150 3151 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3149 def to_f return self.value.to_f end |
#to_i ⇒ Object
Convert to an integer.
3144 3145 3146 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3144 def to_i return self.value.to_i end |
#to_ruby ⇒ Object Also known as: to_c
Convert to Ruby code.
3121 3122 3123 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3121 def to_ruby return "__" + self.name.to_s end |
#to_s ⇒ Object
Convert to a string.
3154 3155 3156 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3154 def to_s return self.value.to_s end |
#value ⇒ Object
Gets the value of the signal.
3134 3135 3136 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3134 def value return TOPLEVEL_BINDING.eval(self.to_ruby) end |
#value=(val) ⇒ Object
Sets the value of the signal.
3139 3140 3141 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3139 def value=(val) return TOPLEVEL_BINDING.eval("#{self.to_ruby} = #{val}") end |
#value? ⇒ Boolean
Check if a value is defined for the signal.
3129 3130 3131 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 3129 def value? return TOPLEVEL_BINDING.local_variable_defined?(self.to_ruby) end |