class HDLRuby::Low::TimeWait

Describes a wait delay statement: not synthesizable!

Describes a wait statement: not synthesizable!

Extends the TimeWait class with generation of C text.

Extends the TimeWait class with generation of hdr text.

Add the conversion to high.

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

Extends the TimeWait class with functionality for converting booleans in assignments to select operators.

Extends the TimeWait class with functionality for extracting expressions from cast.

Describes a wait statement: not synthesizable!

Describes a wait statement: not synthesizable!

Extends the TimeWait class with functionality for converting booleans in assignments to select operators.

Look at the unit of time, convert the time to ps and output it. One of two people, TimeWait and Delay.

Attributes

delay[R]

The delay to wait.

Public Class Methods

new(delay) click to toggle source

Creates a new statement waiting delay.

Calls superclass method
# File lib/HDLRuby/hruby_low.rb, line 3784
def initialize(delay)
    # Check and set the delay.
    unless delay.is_a?(Delay)
        raise AnyError, "Invalid class for a delay: #{delay.class}."
    end
    super()
    @delay = delay
    # And set its parent.
    delay.parent = self
end

Public Instance Methods

boolean_in_assign2select!() click to toggle source

Converts booleans in assignments to select operators.

# File lib/HDLRuby/hruby_low_bool2select.rb, line 140
def boolean_in_assign2select!
    # Nothing to do.
    return self
end
casts_without_expression!() click to toggle source

Extracts the expressions from the casts.

# File lib/HDLRuby/hruby_low_casts_without_expression.rb, line 137
def casts_without_expression!
    # Nothing to do.
    return self
end
clone() click to toggle source

Clones the TimeWait (deeply)

# File lib/HDLRuby/hruby_low.rb, line 3820
def clone
    return TimeWait.new(@delay.clone)
end
each_block(&ruby_block) click to toggle source

Iterates over the sub blocks.

# File lib/HDLRuby/hruby_low.rb, line 3841
def each_block(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_block) unless ruby_block
    # A ruby block?
    # Nothing to do.
end
each_block_deep(&ruby_block) click to toggle source

Iterates over all the blocks contained in the current block.

# File lib/HDLRuby/hruby_low.rb, line 3849
def each_block_deep(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_block_deep) unless ruby_block
    # A ruby block?
    # Nothing to do.
end
each_deep(&ruby_block) click to toggle source

Iterates over each object deeply.

Returns an enumerator if no ruby block is given.

# File lib/HDLRuby/hruby_low.rb, line 3805
def each_deep(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_deep) unless ruby_block
    # A ruby block? First apply it to current.
    ruby_block.call(self)
    # Then apply on the delay.
    self.delay.each_deep(&ruby_block)
end
each_node(&ruby_block) click to toggle source

Iterates over the expression children if any.

# File lib/HDLRuby/hruby_low.rb, line 3825
def each_node(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_node) unless ruby_block
    # A ruby block?
    # Nothing to do.
end
each_node_deep(&ruby_block) click to toggle source

Iterates over the nodes deeply if any.

# File lib/HDLRuby/hruby_low.rb, line 3833
def each_node_deep(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_node_deep) unless ruby_block
    # A ruby block? First apply it to current.
    ruby_block.call(self)
end
each_statement_deep(&ruby_block) click to toggle source

Iterates over all the statements contained in the current block.

# File lib/HDLRuby/hruby_low.rb, line 3857
def each_statement_deep(&ruby_block)
    # No ruby block? Return an enumerator.
    return to_enum(:each_statement_deep) unless ruby_block
    # A ruby block?
    # Apply it on self.
    ruby_block.call(self)
end
eql?(obj) click to toggle source

Comparison for hash: structural comparison.

# File lib/HDLRuby/hruby_low.rb, line 3796
def eql?(obj)
    return false unless obj.is_a?(TimeWait)
    return false unless @delay.eql?(obj.delay)
    return true
end
explicit_types!() click to toggle source

Explicit the types conversions in the time wait.

# File lib/HDLRuby/hruby_low_fix_types.rb, line 157
def explicit_types!
    # Nothing to do.
    return self
end
extract_selects!() click to toggle source

Extract the Select expressions.

# File lib/HDLRuby/hruby_low_without_select.rb, line 105
def extract_selects!
    # Nothing to extract.
    return []
end
hash() click to toggle source

Hash function.

# File lib/HDLRuby/hruby_low.rb, line 3815
def hash
    return [@delay].hash
end
map_nodes!(&ruby_block) click to toggle source

Maps on the children (including the condition).

# File lib/HDLRuby/hruby_low_mutable.rb, line 1030
def map_nodes!(&ruby_block)
    # Nothing to do.
end
set_delay!(delay) click to toggle source

Sets the delay.

# File lib/HDLRuby/hruby_low_mutable.rb, line 1019
def set_delay!(delay)
    # Check and set the delay.
    unless delay.is_a?(Delay)
        raise AnyError, "Invalid class for a delay: #{delay.class}."
    end
    @delay = delay
    # And set its parent.
    delay.parent = self
end
to_c(level = 0) click to toggle source

Generates the C text of the equivalent HDLRuby code. level is the hierachical level of the object.

# File lib/HDLRuby/hruby_low2c.rb, line 1333
def to_c(level = 0)
    # The resulting string.
    res = " " * level*3
    # Generate the wait.
    res << "hw_wait(#{self.delay.to_c(level+1)}," +
        "#{Low2C.behavior_access(self)});\n"
    # Return the resulting string.
    return res
end
to_hdr(level = 0) click to toggle source

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

# File lib/HDLRuby/hruby_low2hdr.rb, line 439
def to_hdr(level = 0)
    # The resulting string.
    res = " " * (level*3)
    # Generate the wait.
    res << "wait " << self.delay.to_hdr(level) << "\n" 
    # Return the resulting string.
    return res
end
to_high() click to toggle source

Creates a new high wait statement.

# File lib/HDLRuby/hruby_low2high.rb, line 319
def to_high
    return HDLRuby::High::TimeWait.new(self.delay.to_high)
end
to_verilog(spc = 3) click to toggle source
# File lib/HDLRuby/hruby_verilog.rb, line 1720
def to_verilog(spc = 3)
    return (" " * spc) + self.delay.to_verilog + "\n"
end
to_vhdl(vars,level = 0) click to toggle source

Generates the text of the equivalent HDLRuby::High code. vars is the list of the variables and level is the hierachical level of the object.

# File lib/HDLRuby/hruby_low2vhd.rb, line 1034
def to_vhdl(vars,level = 0)
    # The resulting string.
    res = " " * (level*3)
    # Generate the wait.
    res << "wait for " << self.delay.to_vhdl(level) << ";\n" 
    # Return the resulting string.
    return res
end