Class: Numeric

Inherits:
Object
  • Object
show all
Defined in:
lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/std/fixpoint.rb,
lib/HDLRuby/hruby_low2vhd.rb,
lib/HDLRuby/hruby_verilog.rb,
lib/HDLRuby/hruby_low2high.rb

Overview

Extends the Numeric class with generation of HDLRuby::High text.

Instance Method Summary collapse

Instance Method Details

#msObject

Converts to a new delay in milliseconds.



3855
3856
3857
# File 'lib/HDLRuby/hruby_high.rb', line 3855

def ms
    return Delay.new(self,:ms)
end

#nsObject

Converts to a new delay in nanoseconds.



3845
3846
3847
# File 'lib/HDLRuby/hruby_high.rb', line 3845

def ns
    return Delay.new(self,:ns)
end

#psObject

Converts to a new delay in picoseconds.



3840
3841
3842
# File 'lib/HDLRuby/hruby_high.rb', line 3840

def ps
    return Delay.new(self,:ps)
end

#sObject

Converts to a new delay in seconds.



3860
3861
3862
# File 'lib/HDLRuby/hruby_high.rb', line 3860

def s
    return Delay.new(self,:s)
end

#to_fix(dec) ⇒ Object

Convert to fixed point value with +dec+ digits after the decimal point.



69
70
71
# File 'lib/HDLRuby/std/fixpoint.rb', line 69

def to_fix(dec)
    return (self * (2**dec.to_i)).to_i
end

#to_high(level = 0) ⇒ Object

Generates the text of the equivalent HDLRuby::High code. +level+ is the hierachical level of the object.



733
734
735
# File 'lib/HDLRuby/hruby_low2high.rb', line 733

def to_high(level = 0)
    return self.to_s
end

#to_valueObject

Converts to a new high-level value.



3835
3836
3837
# File 'lib/HDLRuby/hruby_high.rb', line 3835

def to_value
    to_expr
end

#to_value?Boolean

Tell if the expression can be converted to a value.

Returns:

  • (Boolean)


3830
3831
3832
# File 'lib/HDLRuby/hruby_high.rb', line 3830

def to_value?
    return true
end

#to_verilog(level = 0) ⇒ Object

Generates the text of the equivalent verilog code. +level+ is the hierachical level of the object.



2077
2078
2079
# File 'lib/HDLRuby/hruby_verilog.rb', line 2077

def to_verilog(level = 0)
    return self.to_s
end

#to_vhdl(level = 0) ⇒ Object

Generates the text of the equivalent HDLRuby::High code. +level+ is the hierachical level of the object.



1495
1496
1497
# File 'lib/HDLRuby/hruby_low2vhd.rb', line 1495

def to_vhdl(level = 0)
    return self.to_s
end

#usObject

Converts to a new delay in microseconds.



3850
3851
3852
# File 'lib/HDLRuby/hruby_high.rb', line 3850

def us
    return Delay.new(self,:us)
end