예제 #1
0
    bool preproc (FileLine* fl, const string& modname, V3InFilter* filterp, V3ParseImp* parsep,
		  const string& errmsg) {  // "" for no error
	debug(true);  // Recheck if debug on - first check was before command line passed

	// Preprocess the given module, putting output in vppFilename
	UINFONL(1,"  Preprocessing "<<modname<<endl);

	// Preprocess
	s_filterp = filterp;
	bool ok = preprocOpen(fl, s_filterp, modname, errmsg);
	if (!ok) return false;

	while (!s_preprocp->isEof()) {
	    string line = s_preprocp->getline();
	    V3Parse::ppPushText(parsep, line);
	}
	return true;
    }
예제 #2
0
파일: V3TSP.cpp 프로젝트: jeras/verilator
    void findEulerTourRecurse(vl_unordered_set<unsigned>* markedEdgesp,
                              Vertex* startp,
                              std::vector<T_Key>* sortedOutp) {
        Vertex* cur_vertexp = startp;

        // Go on a random tour. Fun!
        std::vector<Vertex*> tour;
        do {
            UINFO(6, "Adding "<<cur_vertexp->key()<<" to tour.\n");
            tour.push_back(cur_vertexp);

            // Look for an arbitrary edge we've not yet marked
            for (V3GraphEdge* edgep = cur_vertexp->outBeginp();
                 edgep; edgep = edgep->outNextp()) {
                vluint32_t edgeId = edgep->user();
                if (markedEdgesp->end() == markedEdgesp->find(edgeId)) {
                    // This edge is not yet marked, so follow it.
                    markedEdgesp->insert(edgeId);
                    Vertex* neighborp = castVertexp(edgep->top());
                    UINFO(6, "following edge "<<edgeId
                          <<" from "<<cur_vertexp->key()
                          <<" to "<<neighborp->key()<<endl);
                    cur_vertexp = neighborp;
                    goto found;
                }
            }
            v3fatalSrc("No unmarked edges found in tour");
          found:
            ;
        } while (cur_vertexp != startp);
        UINFO(6, "stopped, got back to start of tour @ "<<cur_vertexp->key()<<endl);

        // Look for nodes on the tour that still have
        // un-marked edges. If we find one, recurse.
        for (typename std::vector<Vertex*>::iterator it = tour.begin();
             it != tour.end(); ++it) {
            Vertex* vxp = *it;
            bool recursed;
            do {
                recursed = false;
                // Look for an arbitrary edge at vxp we've not yet marked
                for (V3GraphEdge* edgep = vxp->outBeginp();
                     edgep; edgep = edgep->outNextp()) {
                    vluint32_t edgeId = edgep->user();
                    if (markedEdgesp->end() == markedEdgesp->find(edgeId)) {
                        UINFO(6, "Recursing.\n");
                        findEulerTourRecurse(markedEdgesp, vxp, sortedOutp);
                        recursed = true;
                        goto recursed;
                    }
                }
              recursed:
                ;
            } while (recursed);
            sortedOutp->push_back(vxp->key());
        }

        UINFO(6, "Tour was: ");
        for (typename std::vector<Vertex*>::iterator it = tour.begin();
             it != tour.end(); ++it) {
            Vertex* vxp = *it;
            UINFONL(6, " "<<vxp->key());
        }
        UINFONL(6, "\n");
    }