Logo Search packages:      
Sourcecode: fauhdlc version File versions

void ast::GenCode::createInitFunction ( const Process node  )  [private]

create an init function for the process and add it to the current code container.

Parameters:
node Process for which an init function should get created

Definition at line 341 of file GenCode.cpp.

References intermediate::CodeContainer::addCode(), ASSIGN_OPERATION_CONNECT, ASSIGN_OPERATION_COPY, assignExpression, assignOperation, container, destRegs, ast::Process::drivers, ast::SymbolDeclaration::getICName(), intermediate::ImmediateOperand::getZero(), isTarget, and sourceRegs.

{
      for (std::list<Driver*>::const_iterator i = node.drivers.begin();
            i != node.drivers.end(); i++) {

            this->sourceRegs = RegisterSet(*this->container);
            // even though the signal and the driver are known,
            // the way how to access these is not (pointer, or
            // base-pointer?). (ok, driver of a Process should
            // always be directly via the reference, as it
            // cannot be a parameter!)
            // reuse the SimpleName stored in the driver to
            // find out.

            // first pick up destination driver (the 
            // SimpleName is used to obtain the signal
            // *and* the driver depending on isTarget)
            this->assignOperation = ASSIGN_OPERATION_CONNECT;
            this->isTarget = true;
            this->assignExpression = false;
            assert((*i)->n != NULL);
            (*i)->n->accept(*this);

            // then pick up the source signal.
            this->destRegs = this->sourceRegs;
            this->sourceRegs = RegisterSet(*this->container);
            this->isTarget = false;
            this->assignExpression = true;
            (*i)->n->accept(*this);
      }

      this->assignExpression = false;
      this->assignOperation = ASSIGN_OPERATION_COPY;
      this->sourceRegs = RegisterSet(*this->container);
      this->destRegs = RegisterSet(*this->container);
      
      Reference *ref = new Reference(node.getICName());
      BeginTransfer *bg = new BeginTransfer(ref, new Reference(""));
      this->container->addCode(bg);

      Proc *proc = new Proc(ref);
      this->container->addCode(proc);

      EndTransfer *et = new EndTransfer(ref, ImmediateOperand::getZero());
      this->container->addCode(et);
}


Generated by  Doxygen 1.6.0   Back to index