当前位置: 首页>>代码示例>>C++>>正文


C++ VL_UNLIKELY函数代码示例

本文整理汇总了C++中VL_UNLIKELY函数的典型用法代码示例。如果您正苦于以下问题:C++ VL_UNLIKELY函数的具体用法?C++ VL_UNLIKELY怎么用?C++ VL_UNLIKELY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VL_UNLIKELY函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bufferFlush

void VerilatedVcd::bufferFlush () {
    // We add output data to m_writep.
    // When it gets nearly full we dump it using this routine which calls write()
    // This is much faster than using buffered I/O
    if (VL_UNLIKELY(!isOpen())) return;
    char* wp = m_wrBufp;
    while (1) {
	ssize_t remaining = (m_writep - wp);
	if (remaining==0) break;
	errno = 0;
	ssize_t got = write (m_fd, wp, remaining);
	if (got>0) {
	    wp += got;
	    m_wroteBytes += got;
	} else if (got < 0) {
	    if (errno != EAGAIN && errno != EINTR) {
		// write failed, presume error (perhaps out of disk space)
		string msg = (string)"VerilatedVcd::bufferFlush: "+strerror(errno);
		vl_fatal("",0,"",msg.c_str());
		closeErr();
		break;
	    }
	}
    }

    // Reset buffer
    m_writep = m_wrBufp;
}
开发者ID:archipelagos,项目名称:environment,代码行数:28,代码来源:verilated_vcd_c.cpp

示例2: vpi_register_cb

vpiHandle vpi_register_cb(p_cb_data cb_data_p) {
    _VL_VPI_ERROR_RESET(); // reset vpi error status
    // cppcheck-suppress nullPointer
    if (VL_UNLIKELY(!cb_data_p)) {
        _VL_VPI_WARNING(__FILE__, __LINE__, "%s : callback data pointer is null", VL_FUNC);
        return NULL;
    }
    switch (cb_data_p->reason) {
    case cbAfterDelay: {
	QData time = 0;
	if (cb_data_p->time) time = _VL_SET_QII(cb_data_p->time->high, cb_data_p->time->low);
	VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, VL_TIME_Q()+time);
	VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi:  vpi_register_cb %d %p delay=%" VL_PRI64 "u\n",cb_data_p->reason,vop,time););
	VerilatedVpi::cbTimedAdd(vop);
	return vop->castVpiHandle();
    }
    case cbReadWriteSynch:		// FALLTHRU // Supported via vlt_main.cpp
    case cbReadOnlySynch:		// FALLTHRU // Supported via vlt_main.cpp
    case cbNextSimTime:			// FALLTHRU // Supported via vlt_main.cpp
    case cbStartOfSimulation:		// FALLTHRU // Supported via vlt_main.cpp
    case cbEndOfSimulation:		// FALLTHRU // Supported via vlt_main.cpp
    case cbValueChange:			// FALLTHRU // Supported via vlt_main.cpp
    case cbPLIError:			// FALLTHRU // NOP, but need to return handle, so make object
    case cbEnterInteractive:		// FALLTHRU // NOP, but need to return handle, so make object
    case cbExitInteractive:		// FALLTHRU // NOP, but need to return handle, so make object
    case cbInteractiveScopeChange: {	// FALLTHRU // NOP, but need to return handle, so make object
	VerilatedVpioCb* vop = new VerilatedVpioCb(cb_data_p, 0);
	VL_DEBUG_IF_PLI(VL_PRINTF("-vltVpi:  vpi_register_cb %d %p\n",cb_data_p->reason,vop););
	VerilatedVpi::cbReasonAdd(vop);
	return vop->castVpiHandle();
    }
开发者ID:phb,项目名称:verilator-asserts,代码行数:31,代码来源:verilated_vpi.cpp

示例3: eval

void Vtop::eval() {
    Vtop__Syms* __restrict vlSymsp = this->__VlSymsp; // Setup global symbol table
    Vtop* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;
    // Initialize
    if (VL_UNLIKELY(!vlSymsp->__Vm_didInit)) _eval_initial_loop(vlSymsp);
    // Evaluate till stable
    VL_DEBUG_IF(VL_PRINTF("\n----TOP Evaluate Vtop::eval\n"); );
开发者ID:vineeth88,项目名称:gate_level_sim,代码行数:7,代码来源:Vtop.cpp

示例4: debug

    static int debug(bool reset=false) {
	static int level = -1;
	if (VL_UNLIKELY(level < 0) || reset) {
	    level = v3Global.opt.debugSrcLevel(__FILE__);
	    if (s_preprocp) s_preprocp->debug(debug());
	}
	return level;
    }
开发者ID:torc-isi,项目名称:torc,代码行数:8,代码来源:V3PreShell.cpp

示例5: dumpFull

void VerilatedVcd::dump (vluint64_t timeui) {
    if (!isOpen()) return;
    if (VL_UNLIKELY(m_fullDump)) {
	m_fullDump = false;	// No need for more full dumps
	dumpFull(timeui);
	return;
    }
    if (VL_UNLIKELY(m_rolloverMB && m_wroteBytes > this->m_rolloverMB)) {
	openNext(true);
	if (!isOpen()) return;
    }
    dumpPrep (timeui);
    for (vluint32_t ent = 0; ent< m_callbacks.size(); ent++) {
	VerilatedVcdCallInfo *cip = m_callbacks[ent];
	(cip->m_changecb) (this, cip->m_userthis, cip->m_code);
    }
    dumpDone();
}
开发者ID:archipelagos,项目名称:environment,代码行数:18,代码来源:verilated_vcd_c.cpp

示例6: error

void V3PreProcImp::openFile(FileLine* fl, V3InFilter* filterp, const string& filename) {
    // Open a new file, possibly overriding the current one which is active.
    V3File::addSrcDepend(filename);

    // Read a list<string> with the whole file.
    StrList wholefile;
    bool ok = filterp->readWholefile(filename, wholefile/*ref*/);
    if (!ok) {
	error("File not found: "+filename+"\n");
	return;
    }

    if (!m_preprocp->isEof()) {  // IE not the first file.
	// We allow the same include file twice, because occasionally it pops
	// up, with guards preventing a real recursion.
	if (m_lexp->m_streampStack.size()>V3PreProc::INCLUDE_DEPTH_MAX) {
	    error("Recursive inclusion of file: "+filename);
	    return;
	}
	// There's already a file active.  Push it to work on the new one.
	addLineComment(0);
    }

    // Create new stream structure
    m_lexp->scanNewFile(m_preprocp->fileline()->create(filename, 1));
    addLineComment(1); // Enter

    // Filter all DOS CR's en-mass.  This avoids bugs with lexing CRs in the wrong places.
    // This will also strip them from strings, but strings aren't supposed to be multi-line without a "\"
    for (StrList::iterator it=wholefile.begin(); it!=wholefile.end(); ++it) {
	// We don't end-loop at \0 as we allow and strip mid-string '\0's (for now).
	bool strip = false;
	const char* sp = it->data();
	const char* ep = sp + it->length();
	// Only process if needed, as saves extra string allocations
	for (const char* cp=sp; cp<ep; cp++) {
	    if (VL_UNLIKELY(*cp == '\r' || *cp == '\0')) {
		strip = true; break;
	    }
	}
	if (strip) {
	    string out;  out.reserve(it->length());
	    for (const char* cp=sp; cp<ep; cp++) {
		if (!(*cp == '\r' || *cp == '\0')) {
		    out += *cp;
		}
	    }
	    *it = out;
	}

	// Push the data to an internal buffer.
	m_lexp->scanBytesBack(*it);
	// Reclaim memory; the push saved the string contents for us
	*it = "";
    }
}
开发者ID:toddstrader,项目名称:verilator-integer-array,代码行数:56,代码来源:V3PreProc.cpp

示例7: addCallback

void VerilatedVcd::addCallback (
    VerilatedVcdCallback_t initcb, VerilatedVcdCallback_t fullcb, VerilatedVcdCallback_t changecb,
    void* userthis)
{
    if (VL_UNLIKELY(isOpen())) {
	string msg = (string)"Internal: "+__FILE__+"::"+__FUNCTION__+" called with already open file";
	vl_fatal(__FILE__,__LINE__,"",msg.c_str());
    }
    VerilatedVcdCallInfo* vci = new VerilatedVcdCallInfo(initcb, fullcb, changecb, userthis, nextCode());
    m_callbacks.push_back(vci);
}
开发者ID:archipelagos,项目名称:environment,代码行数:11,代码来源:verilated_vcd_c.cpp

示例8: broken

const char* AstNodeClassDType::broken() const {
    set<AstMemberDType*> exists;
    for (AstMemberDType* itemp = membersp(); itemp; itemp=itemp->nextp()->castMemberDType()) {
	exists.insert(itemp);
    }
    for (MemberNameMap::const_iterator it=m_members.begin(); it!=m_members.end(); ++it) {
	if (VL_UNLIKELY(exists.find(it->second) == exists.end())) {
	    this->v3error("Internal: Structure member broken: "<<it->first);
	    return "member broken";
	}
    }
    return NULL;
}
开发者ID:toddstrader,项目名称:verilator-linkdot-elab,代码行数:13,代码来源:V3AstNodes.cpp

示例9: printTime

void VerilatedVcd::printTime (vluint64_t timeui) {
    // VCD file format specification does not allow non-integers for timestamps
    // Dinotrace doesn't mind, but Cadence vvision seems to choke
    if (VL_UNLIKELY(timeui < m_timeLastDump)) {
	timeui = m_timeLastDump;
	static bool backTime = false;
	if (!backTime) {
	    backTime = true;
	    VL_PRINTF("VCD time is moving backwards, wave file may be incorrect.\n");
	}
    }
    m_timeLastDump = timeui;
    printQuad(timeui);
}
开发者ID:archipelagos,项目名称:environment,代码行数:14,代码来源:verilated_vcd_c.cpp

示例10: applyIgnores

    inline void applyIgnores(FileLine* filelinep) {
	// HOT routine, called each parsed token line
	if (m_lastLineno != filelinep->lineno()
	    || m_lastFilename != filelinep->filename()) {
	    //UINFO(9,"   ApplyIgnores for "<<filelinep->ascii()<<endl);
	    if (VL_UNLIKELY(m_lastFilename != filelinep->filename())) {
		absBuild(filelinep->filename());
		m_lastFilename = filelinep->filename();
	    }
	    // Process all on/offs for lines up to and including the current line
	    int curlineno = filelinep->lineno();
	    for (; m_lastIt != m_lastEnd; ++m_lastIt) {
		if (m_lastIt->m_lineno > curlineno) break;
		//UINFO(9,"     Hit "<<*m_lastIt<<endl);
		filelinep->warnOn(m_lastIt->m_code, m_lastIt->m_on);
	    }
	    if (0 && debug() >= 9) {
		for (IgnLines::const_iterator it=m_lastIt; it != m_lastEnd; ++it) {
		    UINFO(9,"     NXT "<<*it<<endl);
		}
	    }
	    m_lastLineno = filelinep->lineno();
	}
    }
开发者ID:VarunKoyyalagunta,项目名称:verilator,代码行数:24,代码来源:V3Config.cpp

示例11: debug

    // METHODS
    static int debug() {
	static int level = -1;
	if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__);
	return level;
    }
开发者ID:phb,项目名称:verilator-asserts,代码行数:6,代码来源:V3Slice.cpp

示例12: debug

    // ***These tests only run with DEBUG ON***
    static int debug() {
	static int level = -1;
	// Note setting just --debug will not enable this, as we exit when we run the test
	if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__, 0);
	return level;
    }
开发者ID:torc-isi,项目名称:torc,代码行数:7,代码来源:V3GraphTest.cpp

示例13: svGetCallerInfo

int svGetCallerInfo(const char** fileNamepp, int *lineNumberp) {
    if (VL_UNLIKELY(!Verilated::dpiInContext())) { _VL_SVDPI_CONTEXT_WARN(); return false; }
    if (VL_LIKELY(fileNamepp)) *fileNamepp = Verilated::dpiFilenamep();  // thread local
    if (VL_LIKELY(lineNumberp)) *lineNumberp = Verilated::dpiLineno();  // thread local
    return true;
}
开发者ID:VarunKoyyalagunta,项目名称:verilator,代码行数:6,代码来源:verilated_dpi.cpp

示例14: svGetScope

svScope svGetScope() {
    if (VL_UNLIKELY(!Verilated::dpiInContext())) { _VL_SVDPI_CONTEXT_WARN(); return NULL; }
    return (svScope)Verilated::dpiScope();
}
开发者ID:VarunKoyyalagunta,项目名称:verilator,代码行数:4,代码来源:verilated_dpi.cpp


注:本文中的VL_UNLIKELY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。