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
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.
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+.
2512 2513 2514 2515 2516 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2512 def initialize(type,name) @type = type.to_type @name = name.to_sym # @content = nil # The content is the Ruby value, not the HW description one! end |
Instance Attribute Details
#name ⇒ Object (readonly)
, :content
2510 2511 2512 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2510 def name @name end |
#type ⇒ Object (readonly)
, :content
2510 2511 2512 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2510 def type @type end |
Instance Method Details
#array? ⇒ Boolean
Tell if the signal is an array.
2519 2520 2521 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2519 def array? return @type.base.is_a?(TypeVector) end |
#to_f ⇒ Object
Convert to an float.
2557 2558 2559 2560 2561 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2557 def to_f # return @content.to_f # return binding.local_variable_get(to_ruby.to_sym).to_f return self.value.to_f end |
#to_i ⇒ Object
Convert to an integer.
2550 2551 2552 2553 2554 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2550 def to_i # return @content.to_i # return binding.local_variable_get(to_ruby.to_sym).to_i return self.value.to_i end |
#to_ruby ⇒ Object
Convert to ruby code.
2534 2535 2536 2537 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2534 def to_ruby # return self.name.to_s + ".content" return "__" + self.name.to_s end |
#to_s ⇒ Object
Convert to a string.
2564 2565 2566 2567 2568 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2564 def to_s # return @content.to_s # return binding.local_variable_get(to_ruby.to_sym).to_s return self.value.to_s end |
#value ⇒ Object
Gets the value of the signal.
2540 2541 2542 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2540 def value return TOPLEVEL_BINDING.eval(self.to_ruby) end |
#value=(val) ⇒ Object
Sets the value of the signal.
2545 2546 2547 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2545 def value=(val) return TOPLEVEL_BINDING.eval("#{self.to_ruby} = #{val}") end |