class HDLRuby::High::Behavior

Describes a high-level behavior.

Constants

High

High-level libraries for describing digital hardware.

Public Class Methods

new(mode,*events,&ruby_block) click to toggle source

Creates a new behavior executing block activated on a list of events, and built by executing ruby_block. mode can be either :seq or :par for respectively sequential or parallel.

Calls superclass method HDLRuby::Low::Behavior::new
# File lib/HDLRuby/hruby_high.rb, line 3906
def initialize(mode,*events,&ruby_block)
    # Initialize the behavior with it.
    super(nil)
    # # Save the Location for debugging information
    # @location = caller_locations
    # Sets the current behavior
    @@cur_behavior = self
    # Add the events.
    events.each { |event| self.add_event(event) }
    # Create and add the block.
    self.block = High.make_block(mode,&ruby_block)
    # Unset the current behavior
    @@cur_behavior = nil
end

Public Instance Methods

to_low() click to toggle source

Converts the time behavior to HDLRuby::Low.

# File lib/HDLRuby/hruby_high.rb, line 3926
def to_low
    # Create the low level block.
    blockL = self.block.to_low
    # Create the low level events.
    eventLs = self.each_event.map { |event| event.to_low }
    # Create and return the resulting low level behavior.
    behaviorL = HDLRuby::Low::Behavior.new(blockL)
    # For debugging: set the source high object
    behaviorL.properties[:low2high] = self.hdr_id
    self.properties[:high2low] = behaviorL
    eventLs.each(&behaviorL.method(:add_event))
    return behaviorL
end