![](bg4.png)
as follows (10):
MAP
2
(X) =
∑
1≤i≤NZ
∑
1≤p≤NT
δ
i,p
̸=0
Con f ig
i,p
× npr
i,p
(10)
Where npr
ip
represents the maximal number of
preemptions of the task T
p
mapped on RZ
i
.
MAP
2
improves the execution time of each task and
the quality of services (QoS). It is also computed with
the following assumption: the task T
i
that is mapped
in RZ
j
could be preempted only if δ
j,i
% of this task
is executed.
MAP
3
calculates the cost of the used RZs during the
placement of all the tasks on the device. The costs of
the resources are determined taking into account the
information in (Xilinx, 2009). The expression (11)
depicts MAP
3
.
MAP
3
(X) =
∑
1≤k≤NP
∑
load RZ
i
̸=0
1≤i≤NZ
σ
k
× Z
i,k
(11)
Where Z
i,k
is the number of RB
k
in RZ
i
.
In recent works, we demonstrated that the place-
ment/mapping problem is NP hard so that we will
solve it using a heuristic method: the Bees algorithm.
3 THE BEES ALGORITHM
The Bees algorithm is inspired by the food foraging
behavior of the honey bees (Pham et al., 2006; Pham
et al., 2007b) and could be regarded as an intelligent
optimization tool. This algorithm is used to solve the
multi-objective problems and it is able to locate good
solutions efficiently (Pham and Ghanbarzadeh, 2007;
Pham et al., 2007a). The following code is the pseudo
code of the Bees Algorithm:
1. Initialize the population with random solutions
(Placing (n) bees randomly in the search space).
2. Evaluate the fitness of the visited sites (patches of
flowers).
While (stopping criterion is not met)
3. Select (m) best sites having the highest fitness
and also choose the (e) elite sites among these best
patches.
4. Recruit a number (nsp) bees for (m) selected sites
and a number (nep) bees for (e) elite sites and evalu-
ate fitness (wherensp < nep).
5. Select the fittest bee from each patch.
6. Assign the (n − m) remaining bees to search ran-
domly and evaluate their fitness.
End While.
We propose to adapt the Bees Algorithm with our
context of placement and mapping of the tasks so that
we can exploit the effectiveness of this algorithm to
solve the placement problem.
4 THE PROPOSED METHOD
The objective of the proposed method is minimizing
the cost function to obtain a good placement and map-
ping of hardware tasks on the device. The entries of
this method are the RZs, which are generated from the
hardware tasks, and the RPBs. The outputs are hard-
ware tasks placed on the technology while optimizing
the various parameters of the objective function. In
other words, the solution of the placement/mapping
problem is the hardware tasks mapped on RZs which
are placed in RPBs. Accordingly, we consider a bee as
a combination of RZs which already contain the hard-
ware tasks. This combination is depicted by a vector
of RZs: RZV . We also consider a patch of flowers
as a combination of RPBs which is represented by a
vector of RPBs: RPBV . As illustrated by Figure 2,
the set {P
k
,k ∈ [1,nprm]} represents the preemption
points of the task T
i
, T
i
,
k
is the k−th execution section
of this task and nprm is the number of preemptions of
T
i
.
Figure 2: Preemption points and execution sections of T
i
.
We repeat these next steps Nitermapping times.
4.1 Step 1: Generate Arbitrarily the
Occupation Rates Matrix
The first step consists in calculating the matrix P
which contains the occupation rates of the tasks in
the RZs. Like the random choice of the scout bees
from the colony to explore the flowers, this matrix is
randomly generated so that the RZVs are chosen ar-
bitrarily. Every line of this matrix should respect the
constraint (CM1) and every column should also re-
spect the constraint (CM2). The elements of this ma-
trix (P = p
i
,
j
,1 ≤ i ≤ NT,1 ≤ j ≤ NZ) are vectors
of the hardware tasks execution sections. Each exe-
cution section of a task is assigned randomly to a pos-
sible RZ containing enough resources to execute this
task. It is not necessary that the execution sections of
a task are assigned to all the possible RZs thus we can
find an RZ where the mapping of some tasks is pos-
sible but does not contain any execution section. In
this case, p
i
,
j
= (0). Also, if the mapping of a task T
i
in RZ
j
is impossible, p
i
,
j
= (0). Figure 3 shows the
structure of this matrix.
Where k, p and q are naturals in [1,nprm].
The next steps (from 2 to 7) are repeated Nitr
times.
PLACEMENT OF HARDWARE TASKS ON FPGA USING THE BEES ALGORITHM
501