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


C++ EventData::setTimescale方法代码示例

本文整理汇总了C++中EventData::setTimescale方法的典型用法代码示例。如果您正苦于以下问题:C++ EventData::setTimescale方法的具体用法?C++ EventData::setTimescale怎么用?C++ EventData::setTimescale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventData的用法示例。


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

示例1: expand

void Transform::expand(    CycleData& cyData, EventData& evData,
        map< string, WaveformTable>& wftMap,
        vector<string> pinList, double timescale) {

    assert( timescale >= 0.0);
    assert( timescale <= 1.0);

    if(timescale == 0.0) {
        //
        // Calculate timescale
        //
        vector<double> res;
        map<string, WaveformTable>::iterator iter;
        for(iter = wftMap.begin(); iter != wftMap.end(); iter++) {
            res.push_back( iter->second.getEventResolution());
        }
        double minRes = *(min_element( res.begin(), res.end()));
        double exponent = ceil( log10(1/minRes));
        timescale = pow( 10.0, -exponent);

        //applog.debug << "Calculating timescale : " << timescale << endl;
        //applog.debug << "minRes = " << minRes << " exponent = " << exponent << endl;

        assert( timescale >= 0.0);
        assert( timescale <= 1.0);
    }

    //if(debug)
        //cyData.print( applog.debug);

    SignalHeader signalHeader = cyData.getSignalHeader();

    vector<string> pinNames;
    for(unsigned int i=0; i < signalHeader.size(); i++) {
        pinNames.push_back( signalHeader[i].name);
    }

    evData.setSignalHeader( signalHeader);

    unsigned long numVectors = cyData.getNumVectors();

    unsigned long long periodBeginTimestamp = 0;
    unsigned long loopSum = 0;
    for(unsigned long vecNum=0; vecNum < numVectors; vecNum++) {
        CycleData::PeriodData periodData;
        cyData.getPeriodData( periodData, vecNum);


//        periodData.print( applog.debug);

        WaveformTable wft = wftMap[periodData.wftRef];
        double period = wft.period.value;

        // Need my_round due to fractional error
        unsigned long long periodTimestamp = (unsigned long long) my_round(period/timescale);

        EventData periodEventData;

        getEventData( periodData, wft, periodEventData, pinNames, timescale);

//        periodEventData.print( applog.debug);
        
        for(unsigned int i=0; i <= periodData.loopCount; i++) {
            // append event data
            //applog.debug << "Adding events at timestamp " << periodBeginTimestamp << endl;
            evData.add( periodEventData, periodBeginTimestamp);
//            periodBeginTimestamp = (unsigned long long) (((vecNum + 1 + loopSum + i)*period)/timescale);
            periodBeginTimestamp = (unsigned long long) ((vecNum + 1 + loopSum + i)*periodTimestamp);
        }
        loopSum += periodData.loopCount;
    }

    evData.setTimescale( timescale);
}
开发者ID:whosmin,项目名称:semitest,代码行数:74,代码来源:transform.cpp


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