lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.SendRange Class Reference

Class representing a range of a port that sources data together with a list of destination ranges of other ports that should all receive the same data sent in this range. More...

Inherits org.lflang.generator.RuntimeRange< T >.Port.

Public Member Functions

void addDestination (RuntimeRange< PortInstance > dst)
 Add a destination to the list of destinations of this range.
int compareTo (RuntimeRange<?> o)
 Override the base class to add additional comparisons so that ordering is never ambiguous.
int getNumberOfDestinationReactors ()
 Return the total number of destination reactors for this range.
SendRange head (int newWidth)
 Return a new SendRange that is identical to this range but with width reduced to the specified width.
List< Integer > instances ()
 Return the list of natural identifiers for the runtime instances in this range.
List< NamedInstance<?> > iterationOrder ()
 Return a list containing the instance for this range and all of its parents, not including the top level reactor, in the order in which their banks and multiport channels should be iterated.
SendRange overlap (RuntimeRange<?> range)
 Return a range that is the subset of this range that overlaps with the specified range or null if there is no overlap.
boolean overlaps (RuntimeRange<?> range)
 Return true if the specified range has the same instance as this range and the ranges overlap.
Set< Integer > parentInstances (int n)
 Return a set of identifiers for runtime instances of a parent of this RuntimeRange's instance n levels above this RuntimeRange's instance.
ReactorInstance parentReactor ()
 Return the nearest containing ReactorInstance for this instance.
List< Integer > permutation ()
 Return the permutation vector that indicates the order in which the digits of the permuted mixed-radix representations of indices in this range should be incremented.
List< Integer > radixes ()
 Return the radixes vector containing the width of this instance followed by the widths of its containers, not including the top level, which always has radix 1 and value 0.
 SendRange (PortInstance instance, int start, int width, Set< ReactorInstance > interleaved, Connection connection)
 Create a new send range.
 SendRange (RuntimeRange< PortInstance > src, RuntimeRange< PortInstance > dst, Set< ReactorInstance > interleaved, Connection connection)
 Create a new send range representing sending from the specified src to the specified dst.
MixedRadixInt startMR ()
 Return the start as a new permuted mixed-radix number.
SendRange tail (int offset)
 Return a new SendRange that represents the leftover elements starting at the specified offset.
RuntimeRange< T > toggleInterleaved (ReactorInstance reactor)
 Toggle the interleaved status of the specified reactor, which is assumed to be a parent of the instance of this range.
String toString ()

Public Attributes

final Connection connection
 The connection that establishes this relationship or null if not unique or none.
final List< RuntimeRange< PortInstance > > destinations = new ArrayList<>()
 The list of destination ranges to which this broadcasts.
final T instance
 The instance that this is a range of.
final int maxWidth
 The maximum width of any range with this instance.
final int start
 The start offset of this range.
final int width
 The width of this range.

Protected Member Functions

SendRange newSendRange (SendRange srcRange, int srcRangeOffset)
 Assuming that this SendRange is completely contained by one of the destinations of the specified srcRange, return a new SendRange where the send range is the subrange of the specified srcRange that overlaps with this SendRange and the destinations include all the destinations of this SendRange.

Package Attributes

Set< ReactorInstance_interleaved
 Record of which levels are interleaved.

Detailed Description

Class representing a range of a port that sources data together with a list of destination ranges of other ports that should all receive the same data sent in this range.

All ranges in the destinations list have widths that are an integer multiple N of this range but not necessarily the same start offsets.

This class and subclasses are designed to be immutable. Modifications always return a new RuntimeRange.

Author
Edward A. Lee

Constructor & Destructor Documentation

◆ SendRange() [1/2]

org.lflang.generator.SendRange.SendRange ( PortInstance instance,
int start,
int width,
Set< ReactorInstance > interleaved,
Connection connection )

Create a new send range.

Parameters
instanceThe instance over which this is a range of.
startThe starting index.
widthThe width.
interleavedA list of parents that are interleaved or null if none.
connectionThe connection that establishes this send or null if not unique or none.

◆ SendRange() [2/2]

org.lflang.generator.SendRange.SendRange ( RuntimeRange< PortInstance > src,
RuntimeRange< PortInstance > dst,
Set< ReactorInstance > interleaved,
Connection connection )

Create a new send range representing sending from the specified src to the specified dst.

This preserves the interleaved status of both the src and dst.

Parameters
srcThe source range.
dstThe destination range.
interleavedA list of parents that are interleaved or null if none.
connectionThe connection that establishes this send or null if not unique or none.

Member Function Documentation

◆ addDestination()

void org.lflang.generator.SendRange.addDestination ( RuntimeRange< PortInstance > dst)

Add a destination to the list of destinations of this range.

If the width of the destination is not a multiple of the width of this range, throw an exception.

Exceptions
IllegalArgumentExceptionIf the width doesn't match.

◆ compareTo()

int org.lflang.generator.SendRange.compareTo ( RuntimeRange<?> o)

Override the base class to add additional comparisons so that ordering is never ambiguous.

This means that sorting will be deterministic. Note that this can return 0 even if equals() does not return true.

◆ getNumberOfDestinationReactors()

int org.lflang.generator.SendRange.getNumberOfDestinationReactors ( )

Return the total number of destination reactors for this range.

Specifically, this is the number of distinct runtime reactor instances that react to messages from this send range.

◆ head()

SendRange org.lflang.generator.SendRange.head ( int newWidth)

Return a new SendRange that is identical to this range but with width reduced to the specified width.

If the new width is greater than or equal to the width of this range, then return this range. If the newWidth is 0 or negative, return null. This overrides the base class to also apply head() to the destination list.

Parameters
newWidthThe new width.

◆ instances()

List< Integer > org.lflang.generator.RuntimeRange< T >.instances ( )
inherited

Return the list of natural identifiers for the runtime instances in this range.

Each returned identifier is an integer representation of the mixed-radix number [d0, ... , dn] with radices [w0, ... , wn], where d0 is the bank or channel index of this RuntimeRange's instance, which has width w0, and dn is the bank index of its topmost parent below the top-level (main) reactor, which has width wn. The depth of this RuntimeRange's instance, therefore, is n - 1. The order of the returned list is the order in which the runtime instances should be iterated.

◆ iterationOrder()

List< NamedInstance<?> > org.lflang.generator.RuntimeRange< T >.iterationOrder ( )
inherited

Return a list containing the instance for this range and all of its parents, not including the top level reactor, in the order in which their banks and multiport channels should be iterated.

For each depth at which the connection is interleaved, that parent will appear before this instance in depth order (shallower to deeper). For each depth at which the connection is not interleaved, that parent will appear after this instance in reverse depth order (deeper to shallower).

◆ newSendRange()

SendRange org.lflang.generator.SendRange.newSendRange ( SendRange srcRange,
int srcRangeOffset )
protected

Assuming that this SendRange is completely contained by one of the destinations of the specified srcRange, return a new SendRange where the send range is the subrange of the specified srcRange that overlaps with this SendRange and the destinations include all the destinations of this SendRange.

If the assumption is not satisfied, throw an IllegalArgumentException.

If any parent of this range is marked interleaved and is also a parent of the specified srcRange, then that parent will be marked interleaved in the result.

Parameters
srcRangeA new source range.
srcRangeOffsetAn offset into the source range.

◆ overlap()

SendRange org.lflang.generator.SendRange.overlap ( RuntimeRange<?> range)

Return a range that is the subset of this range that overlaps with the specified range or null if there is no overlap.

◆ overlaps()

boolean org.lflang.generator.RuntimeRange< T >.overlaps ( RuntimeRange<?> range)
inherited

Return true if the specified range has the same instance as this range and the ranges overlap.

Parameters
rangeThe range to check for overlap.

◆ parentInstances()

Set< Integer > org.lflang.generator.RuntimeRange< T >.parentInstances ( int n)
inherited

Return a set of identifiers for runtime instances of a parent of this RuntimeRange's instance n levels above this RuntimeRange's instance.

If n == 1, for example, then this return the identifiers for the parent ReactorInstance.

This returns a list of natural identifiers, as defined below, for the instances within the range.

The resulting list can be used to count the number of distinct runtime instances of this RuntimeRange's instance (using n == 0) or any of its parents that lie within the range and to provide an index into an array of runtime instances.

Each natural identifier is the integer value of a mixed-radix number defined as follows:

  • The low-order digit is the index of the runtime instance of i within its container. If the NamedInstance is a PortInstance, this will be the multiport channel or 0 if it is not a multiport. If the NamedInstance is a ReactorInstance, then it will be the bank index or 0 if the reactor is not a bank. The radix for this digit will be the multiport width or bank width or 1 if the NamedInstance is neither a multiport nor a bank.
  • The next digit will be the bank index of the container of the specified NamedInstance or 0 if it is not a bank.
  • The remaining digits will be bank indices of containers up to but not including the top-level reactor (there is no point in including the top-level reactor because it is never a bank).
  • Each index that is returned can be used as an index into an array of runtime instances that is assumed to be in a natural order.
Parameters
nThe number of levels up of the parent. This is required to be less than the depth of this RuntimeRange's instance or an exception will be thrown.

◆ parentReactor()

ReactorInstance org.lflang.generator.RuntimeRange< T >.parentReactor ( )
inherited

Return the nearest containing ReactorInstance for this instance.

If this instance is a ReactorInstance, then return it. Otherwise, return its parent.

◆ permutation()

List< Integer > org.lflang.generator.RuntimeRange< T >.permutation ( )
inherited

Return the permutation vector that indicates the order in which the digits of the permuted mixed-radix representations of indices in this range should be incremented.

◆ radixes()

List< Integer > org.lflang.generator.RuntimeRange< T >.radixes ( )
inherited

Return the radixes vector containing the width of this instance followed by the widths of its containers, not including the top level, which always has radix 1 and value 0.

◆ startMR()

Return the start as a new permuted mixed-radix number.

For any instance that is neither a multiport nor a bank, the corresponding digit will be 0.

◆ tail()

SendRange org.lflang.generator.SendRange.tail ( int offset)

Return a new SendRange that represents the leftover elements starting at the specified offset.

If the offset is greater than or equal to the width, then this returns null. If this offset is 0 then this returns this range unmodified. This overrides the base class to also apply tail() to the destination list.

Parameters
offsetThe number of elements to consume.

◆ toggleInterleaved()

RuntimeRange< T > org.lflang.generator.RuntimeRange< T >.toggleInterleaved ( ReactorInstance reactor)
inherited

Toggle the interleaved status of the specified reactor, which is assumed to be a parent of the instance of this range.

If it was previously interleaved, make it not interleaved and vice versa. This returns a new RuntimeRange.

Parameters
reactorThe parent reactor at which to toggle interleaving.

◆ toString()

String org.lflang.generator.SendRange.toString ( )

Member Data Documentation

◆ _interleaved

Set<ReactorInstance> org.lflang.generator.RuntimeRange< T >._interleaved
packageinherited

Record of which levels are interleaved.

◆ connection

final Connection org.lflang.generator.SendRange.connection

The connection that establishes this relationship or null if not unique or none.

◆ destinations

final List<RuntimeRange<PortInstance> > org.lflang.generator.SendRange.destinations = new ArrayList<>()

The list of destination ranges to which this broadcasts.

◆ instance

final T org.lflang.generator.RuntimeRange< T >.instance
inherited

The instance that this is a range of.

◆ maxWidth

final int org.lflang.generator.RuntimeRange< T >.maxWidth
inherited

The maximum width of any range with this instance.

◆ start

final int org.lflang.generator.RuntimeRange< T >.start
inherited

The start offset of this range.

◆ width

final int org.lflang.generator.RuntimeRange< T >.width
inherited

The width of this range.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/SendRange.java