Class: Numeric

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

Overview

Extends the Numeric class for conversion to fixed point litteral.

Instance Method Summary collapse

Instance Method Details

#fsObject

Converts to a new dealy in fentoseconds.



4892
4893
4894
# File 'lib/HDLRuby/hruby_high.rb', line 4892

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

#msObject

Converts to a new delay in milliseconds.



4912
4913
4914
# File 'lib/HDLRuby/hruby_high.rb', line 4912

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

#nsObject

Converts to a new delay in nanoseconds.



4902
4903
4904
# File 'lib/HDLRuby/hruby_high.rb', line 4902

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

#psObject

Converts to a new delay in picoseconds.



4897
4898
4899
# File 'lib/HDLRuby/hruby_high.rb', line 4897

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

#sObject

Converts to a new delay in seconds.



4917
4918
4919
# File 'lib/HDLRuby/hruby_high.rb', line 4917

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

#to_fix(dec) ⇒ Object

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



89
90
91
# File 'lib/HDLRuby/std/fixpoint.rb', line 89

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

#to_hdr(level = 0) ⇒ Object

Generates the text of the equivalent hdr text. +level+ is the hierachical level of the object.



759
760
761
# File 'lib/HDLRuby/hruby_low2hdr.rb', line 759

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

#to_valueObject

Converts to a new high-level value.



4887
4888
4889
# File 'lib/HDLRuby/hruby_high.rb', line 4887

def to_value
    to_expr
end

#to_value?Boolean

Tell if the expression can be converted to a value.

Returns:

  • (Boolean)


4882
4883
4884
# File 'lib/HDLRuby/hruby_high.rb', line 4882

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.



2478
2479
2480
# File 'lib/HDLRuby/hruby_verilog.rb', line 2478

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.



1580
1581
1582
# File 'lib/HDLRuby/hruby_low2vhd.rb', line 1580

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

#usObject

Converts to a new delay in microseconds.



4907
4908
4909
# File 'lib/HDLRuby/hruby_high.rb', line 4907

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