src/arch/cc/eqasm_backend_cc.cc
// compile for Central Controller
// NB: a new eqasm_backend_cc is instantiated per call to compile, so we don't need to cleanup
compile for Central Controller
NB: a new eqasm_backend_cc is instantiated per call to compile, so we don't need to cleanup
compile for Central Controller NB : a new eqasm_backend_cc is instantiated per call to compile so we don ' t need to cleanup
void eqasm_backend_cc::compile(quantum_program* programp, const ql::quantum_platform &platform)
{
    DOUT("Compiling " << programp->kernels.size() << " kernels to generate Central Controller program ... ");
    load_hw_settings(platform);
    codegen.init(platform);
    bundleIdx = 0;
    codegen.program_start(programp->unique_name);
#if OPT_CC_SCHEDULE_KERNEL_H    
    ql::schedule(programp, platform, "prescheduler");
#else
 #if OPT_CC_SCHEDULE_RC
    ql::rcschedule(programp, platform, "rcscheduler");
 #endif
#endif
    for(auto &kernel : programp->kernels) {
        IOUT("Compiling kernel: " << kernel.name);
        codegen_kernel_prologue(kernel);
        if (!kernel.c.empty()) {
            ql::ir::bundles_t bundles = ql::ir::bundler(kernel.c, platform.cycle_time);
            codegen.kernel_start();
            codegen_bundles(bundles, platform);
            codegen.kernel_finish(kernel.name, bundles.back().start_cycle+bundles.back().duration_in_cycles);
        } else {
            DOUT("Empty kernel: " << kernel.name);                      
        }
        codegen_kernel_epilogue(kernel);
    }
    codegen.program_finish(programp->unique_name);
    std::string file_name(ql::options::get("output_dir") + "/" + programp->unique_name + ".vq1asm");
    IOUT("Writing Central Controller program to " << file_name);
    ql::utils::write_file(file_name, codegen.getCode());
    std::string map_input_file = ql::options::get("backend_cc_map_input_file");
    if(map_input_file != "") {
        std::string file_name_map(ql::options::get("output_dir") + "/" + programp->unique_name + ".map");
        IOUT("Writing instrument map to " << file_name_map);
        ql::utils::write_file(file_name_map, codegen.getMap());
    }
    DOUT("Compiling Central Controller program [Done]");
}
void eqasm_backend_cc :: compile ( quantum_program * programp , const ql :: quantum_platform & platform ) { DOUT ( " " << programp -> kernels . size ( ) << " " ) ; load_hw_settings ( platform ) ; codegen . init ( platform ) ; bundleIdx = 0 ; codegen . program_start ( programp -> unique_name ) ; #if OPT_CC_SCHEDULE_KERNEL_H ql :: schedule ( programp , platform , " " ) ; #else #if OPT_CC_SCHEDULE_RC ql :: rcschedule ( programp , platform , " " ) ; #endif #endif for ( auto & kernel : programp -> kernels ) { IOUT ( " " << kernel . name ) ; codegen_kernel_prologue ( kernel ) ; if ( ! kernel . c . empty ( ) ) { ql :: ir :: bundles_t bundles = ql :: ir :: bundler ( kernel . c , platform . cycle_time ) ; codegen . kernel_start ( ) ; codegen_bundles ( bundles , platform ) ; codegen . kernel_finish ( kernel . name , bundles . back ( ) . start_cycle + bundles . back ( ) . duration_in_cycles ) ; } else { DOUT ( " " << kernel . name ) ; } codegen_kernel_epilogue ( kernel ) ; } codegen . program_finish ( programp -> unique_name ) ; std :: string file_name ( ql :: options :: get ( " " ) + " " + programp -> unique_name + " " ) ; IOUT ( " " << file_name ) ; ql :: utils :: write_file ( file_name , codegen . getCode ( ) ) ; std :: string map_input_file = ql :: options :: get ( " " ) ; if ( map_input_file != " " ) { std :: string file_name_map ( ql :: options :: get ( " " ) + " " + programp -> unique_name + " " ) ; IOUT ( " " << file_name_map ) ; ql :: utils :: write_file ( file_name_map , codegen . getMap ( ) ) ; } DOUT ( " " ) ; }
compile for Central Controller
NB: a new eqasm_backend_cc is instantiated per call to compile, so we don't need to cleanup
compile for Central Controller NB : a new eqasm_backend_cc is instantiated per call to compile so we don ' t need to cleanup
// init // generate program header // generate code for all kernels // FIXME: WIP // FIXME: plain old CClight scheduler // NB: normal situation for kernels with classical control // write program to file // write instrument map to file (unless we were using input file)