Top Up Prev Next Bottom Contents Index Search

16.6 Class CGStar

In this section, we will explain additional class CGStar members and methods not described above in this chapter. Class CGStar has a constructor with no arguments. Class CGStar is derived from class DynDFStar, and not from class SDFStar, so that BDF and DDF code generation may be supported in the future.

There is an iterator to enumerate the CGPortHoles of a CGStar: class CGStarPortIter. The next() and operator++ methods return type CGPortHole*.

16.6.1 CGStar Protected Methods and Members

Protected members related to CodeStream, SymbolList, and resource management can be found in earlier sections of this chapter.

virtual void outputComment(const char* msg, const char* stream=NULL);
This method adds a comment msg to the target stream. If no target stream is specified, the myCode stream is used.

StringList expandPortName(const char* name);
If the argument specifies the name of a MultiPortHole, the index may be indicated by a State. In this case, this method gets the value of the State as the index to the MultiPortHole and returns a valid MultiPortHole name. This method is used in the expandSize method.

void advance();
This method updates the offset variable of all PortHoles of the CGStar by the number of samples consumed or produced. It calls the advance method of each PortHole.

IntState procId;
This is an integer state to indicate processor assignment for parallel code generation. By default, the value is -1 to indicate that the star is not yet assigned.

int dataParallel
This is a flag to be set if this star is a wormhole or a parallel star.

Profile* profile;
This is a pointer to a Profile object, which can be used to indicate the local schedule of a data parallel star or macro actor. If it is not a parallel star, this pointer is set NULL.

int deferrable();
When constructing a schedule for a single processor, we can defer the firing of a star as long as possible in order to reduce the buffer requirements on every output arc. In this method, we never defer a Fork star, and always defer any non-Fork star that feeds into a Fork. This prevents the resulting fork buffer from being larger than necessary, because new tokens are not added until they must be.

16.6.2 CGStar Public Methods

const char* domain() const;
int isA(const char* class);
The first method returns "CG". The second method returns TRUE if the argument class is CGStar or a base class of CGStar.

int isSDF() const;
Returns TRUE if it is a star with SDF semantics (default). For BDF and DDF stars, it will return FALSE.

virtual void initCode();
This method allows a star to generate code outside the main loop. This method will be called after the schedule is created and before the schedule is executed. In contrast, the go() method is called during the execution of the schedule, to form code blocks into a main loop body.

int run();
In CG domains, this method does not perform any actual data movement, but executes the go() method followed by the advance() method.

CGTarget* cgTarget();
int setTarget(Target* t);
These methods get and set the pointer to the target to which this star is assigned. When we set the target pointer, we also initialize the SymbolLists and the CodeStream pointers. If this method is successful, it returns TRUE, otherwise it returns FALSE.

virtual int isParallel() const;
virtual Profile* getProfile(int ix=0);
The first method returns TRUE if this star is a wormhole or a parallel star. If it is parallel, the second method returns the pointer to a Profile, indexed by the argument. A parallel star stores its internal scheduling results in a Profile object .

int maxComm(); 
Returns the maximum communication overhead with all ancestors. It calls the commTime method of the target class to obtain the communication cost.

virtual void setProcId(int i);
virtual int getProcId();
These methods set and get the processor ID to which this star is assigned.

Top Up Prev Next Bottom Contents Index Search

Copyright © 1990-1997, University of California. All rights reserved.