Class: RubyHDL::High::Value

Inherits:
Expression show all
Defined in:
lib/HDLRuby/std/sequencer_sw.rb

Overview

Describes the software implementation of a value.

Instance Attribute Summary collapse

Attributes inherited from Expression

#type

Instance Method Summary collapse

Methods inherited from Expression

#<=, #[], #mux, #sdownto, #seach, #stimes, #supto, #to_expr

Constructor Details

#initialize(type, content) ⇒ Value

Create a new value with +type+ data type and content +content+.



1963
1964
1965
1966
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1963

def initialize(type,content)
  super(type)
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



1960
1961
1962
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1960

def content
  @content
end

Instance Method Details

#to_cObject

Convert to C code.



1979
1980
1981
1982
1983
1984
1985
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1979

def to_c
  if @content.is_a?(::Array) then
    return "{" + @content.to_s[1..-2] + "}"
  else
    return @content.to_s
  end
end

#to_python(l = "") ⇒ Object

Convert to Python code.



1988
1989
1990
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1988

def to_python(l = "")
  return @content.to_s
end

#to_rubyObject

Convert to Ruby code.



1974
1975
1976
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1974

def to_ruby
  return @content.to_s
end

#to_valueObject

Compute the expression (convert it to a value).



1969
1970
1971
# File 'lib/HDLRuby/std/sequencer_sw.rb', line 1969

def to_value
  return self
end