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


C++ Platform::identification方法代码示例

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


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

示例1: main

int main(int argc, char **argv) {

    Manager manager;
    PropList props;
    PROCESSOR_PATH(props) = "../../data/procs/op1.xml";
    CACHE_CONFIG_PATH(props) = "../../data/caches/inst-64x16x1.xml";

    try {

        // Load program
        if(argc < 2) {
            cerr << "ERROR: no argument.\n"
                 << "Syntax is : test_ipet <executable>\n";
            return 2;
        }
        WorkSpace *fw = manager.load(argv[1], props);
        assert(fw);

        // Display information
        cout << "PLATFORM INFORMATION\n";
        Platform *pf = fw->platform();
        cout << "Platform : " << pf->identification().name() << '\n';
        cout << '\n';

        // Display registers
        cout << "REGISTERS\n";
        for(int i = 0; i < pf->banks().count(); i++) {
            const hard::RegBank *bank = pf->banks()[i];
            cout << "Bank " << bank->name() << ", "
                 << bank->size() << "bits, "
                 << bank->count() << " registers, "
                 << reg_kinds[bank->kind()];
            for(int j = 0; j < bank->registers().count(); j++) {
                if(j % 8 == 0)
                    cout << "\n\t";
                else
                    cout << ", ";
                cout << bank->registers()[j]->name();
            }
            cout << '\n';
        }
        cout << '\n';

        // Display cache
        cout << "CACHE CONFIGURATION\n";
        const CacheConfiguration& cconf(pf->cache());
        display_cache_level(1, cconf.instCache(), cconf.dataCache());
        cout << '\n';

        // Display some instructions
        fw->require(DECODED_TEXT);
        cout << "READ/WRITTEN REGS TEST\n";
        String label("main");
        Inst *inst = fw->process()->findInstAt("main");
        //fw->findLabel(label));
        if(!inst)
            throw new otawa::Exception(CString("no main in this file ?"));
        for(int i = 0; i < 10; i++, inst = inst->nextInst()) {
            cout << '\n' << inst->address() << ": "
                 << inst << " (" << io::hex(inst->kind()) << ")\n";
            const elm::genstruct::Table<hard::Register *>& reads = inst->readRegs();
            cout << "\tread registers : ";
            for(int i = 0; i < reads.count(); i++)
                cout << reads[i] << ' ';
            cout << '\n';
            const elm::genstruct::Table<hard::Register *>& writes = inst->writtenRegs();
            cout << "\twritten registers : ";
            for(int i = 0; i < writes.count(); i++)
                cout << writes[i] << ' ';
            cout << '\n';
        }
        cout << io::endl;


        // Processor load test
        cout << "Processor load test\n";
        //pf->loadProcessor("proc.xml");
        const hard::Processor *proc = pf->processor();
        if(!proc)
            cout << "NO PROCESSOR !\n";
        else {
            cout << "arch = " << proc->getArch() << io::endl;
            cout << "model = " << proc->getModel() << io::endl;
            cout << "builder = " << proc->getBuilder() << io::endl;
            cout <<"stages =\n";
            const elm::genstruct::Table<hard::Stage *>& stages = proc->getStages();
            for(int i = 0; i< stages.count(); i++) {
                cout << '\t'
                     << stages[i]->getName() << " "
                     << stages[i]->getType() << " "
                     << stages[i]->getWidth() << " "
                     << stages[i]->getLatency() << " "
                     << io::pointer(stages[i]) << io::endl;
                const elm::genstruct::Table<hard::FunctionalUnit *>& fus = stages[i]->getFUs();
                if(fus) {
                    cout << "\tfus=\n";
                    for(int i = 0; i < fus.count(); i++)
                        cout << "\t\t" << fus[i]->getName() << ' '
                             << fus[i]->getWidth() << ' '
                             << fus[i]->getLatency() << ' '
//.........这里部分代码省略.........
开发者ID:t-crest,项目名称:patmos-otawa,代码行数:101,代码来源:test_hard.cpp


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