Class: RubyHDL::High::Value
- Inherits:
-
Expression
- Object
- Expression
- RubyHDL::High::Value
- Defined in:
- lib/HDLRuby/std/sequencer_sw.rb
Overview
Describes the software implementation of a value.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(type, content) ⇒ Value
constructor
Create a new value with +type+ data type and content +content+.
-
#to_c ⇒ Object
Convert to C code.
-
#to_i ⇒ Object
Convert to an integer.
-
#to_python(l = "") ⇒ Object
Convert to Python code.
-
#to_ruby ⇒ Object
Convert to Ruby code.
-
#to_tf(l = "") ⇒ Object
Convert to TensorFlow code.
-
#to_value ⇒ Object
Compute the expression (convert it to a value).
Methods inherited from Expression
#<=, #[], #heach, #mux, #sdownto, #seach, #stimes, #supto, #to_expr
Methods included from HEnumerable
#hall?, #hany?, #hchain, #hchunk, #hchunk_while, #hcompact, #hcount, #hcycle, #hdrop, #hdrop_while, #heach_cons, #heach_entry, #heach_range, #heach_slice, #heach_with_index, #heach_with_object, #hfind, #hfind_index, #hfirst, #hflat_map, #hgrep, #hgrep_v, #hgroup_by, #hinclude?, #hinject, #hlazy, #hmap, #hmax, #hmax_by, #hmin, #hmin_by, #hminmax, #hminmax_by, #hnone?, #hone?, #hpartition, #hreduce, #hreject, #hreverse_each, #hselect, #hslice_after, #hslice_before, #hslice_when, #hsort, #hsort_by, #hsum, #htake, #htake_while, #htally, #hto_a, #hto_h, #huniq, #hzip
Constructor Details
#initialize(type, content) ⇒ Value
Create a new value with +type+ data type and content +content+.
2378 2379 2380 2381 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2378 def initialize(type,content) super(type) @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
2375 2376 2377 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2375 def content @content end |
Instance Method Details
#to_c ⇒ Object
Convert to C code.
2403 2404 2405 2406 2407 2408 2409 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2403 def to_c if @content.is_a?(::Array) then return "{" + @content.to_s[1..-2] + "}" else return @content.to_s end end |
#to_i ⇒ Object
Convert to an integer.
2389 2390 2391 2392 2393 2394 2395 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2389 def to_i if @content.is_a?(::Array) then raise "Cannot convert an array Value to an integer." else return @content.to_i end end |
#to_python(l = "") ⇒ Object
Convert to Python code.
2412 2413 2414 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2412 def to_python(l = "") return @content.to_s end |
#to_ruby ⇒ Object
Convert to Ruby code.
2398 2399 2400 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2398 def to_ruby return @content.to_s end |
#to_tf(l = "") ⇒ Object
Convert to TensorFlow code.
2417 2418 2419 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2417 def to_tf(l = "") return @content.to_s end |
#to_value ⇒ Object
Compute the expression (convert it to a value).
2384 2385 2386 |
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 2384 def to_value return self end |