void PipeLatPower::BranchBound() { bool *v0 = new bool[num_tasks_in_stream - 1]; bool *v1 = new bool[num_tasks_in_stream]; int bound0 = (int)pow(2.0, (num_tasks_in_stream - 1)); int bound1 = (int)pow(2.0, num_tasks_in_stream); /* * The first hierarchy search */ for (int i = 0; i < bound0 - 1; i++) { get_bit_vector(v0, i, num_tasks_in_stream - 1); /* * Divide the stream into pipeline stages and * insert the tasks of each pipeline stage into * its individual Bucket. */ int start_id = 0, stop_id = 0; int sno = 0; for (int j = 1; j <= (num_tasks_in_stream - 1); j++) { if (v0[j] == 1) { // a bound is encountered stop_id = j - 1; // insert tasks for (int k = start_id; k <= stop_id; k++) { bucket->insert_task(sno, &task_chain[k]); } start_id = stop_id + 1; sno++; } } bucket->set_ns(sno); /* * The second hierarchy search: for each pipeline stage, * enumerate processor type for each task in this stage. */ for (int j = 0; j < bound1; j++) { get_bit_vector(v1, j, num_tasks_in_stream); for (int k = 0; k < num_tasks_in_stream; k++) { task_chain[k].set_type(v1[k]); } /* * The third hierarchy search: for each task mapped onto CPU, * enumerate available frequencies. As the frequency search space * is larger than 2, we use DFS. */ std::vector<Task *> cpu_task_vector; int cpu_task_num = 0; for (int k = 0; k < num_tasks_in_stream; k++) { if (0 == v1[k]) cpu_task_vector.push_back(&task_chain[k]); } cpu_task_num = cpu_task_vector.size(); DFSFreqSpace(cpu_task_vector, 0, cpu_task_num); } /* * Clear footprint for this division. */ bucket->clear(); } delete [] v0; delete [] v1; }
static int get_version_freq(struct tobj *tobj, int v) { int *freq = get_bit_vector(tobj); return freq[v]; }