Test Bench For Exponential Function
Test Bench For Exponential Function
an Exponentiation Module
Mohammad Ebrahimi
810192234
II.DATA PATH
Figure 1 shows the circuit of data path. Data path component
consist of several components including Multiplier that
gives 3 n-bit inputs and an n-bit output. Multiplier itself
consists of two cascaded array multiplier. Array multiplier
accepts two n-bit inputs and result is available on n-bit output.
Note that the array multiplier ignores n-bit least significant
bits. Multiplier has three inputs. One of inputs comes from x
input, another multiplier input(1/i) comes from look-up-table,
and the other one is the previous output that comes from
rega output. An up-counting counter has been considered
two address look-up-table entries sequentially. Up-counter
counts while its start signal is high. Start signal come from
controller and connected to controller busy output. after
each multiplication the intermediate results are accumulate
using n+2 bit adder, n bit for fractional part and 2 bit for
integral part of the result. Counter and registers are common
and clear so we describe array multiplier and look up table
details in the rest of this section:
Array multiplier: multiplication of binary operands in a
digital system can be performed in a variety of ways that are
different in speed and gate count. A combinational n*n
multiplier requires an array on n*n multiplier cells each of
which is responsible for multiplying a bit of multiplier with a
bit of multiplicand and adding the result with the product bit
coming from a previous multiplication stage.
Therefore an AND gate for 1*1 multiplication and a full-adder
for the add operation constitute the required multiplier cell
hardware, as shown in Figure 2.
The cell shown in Figure 2 multiplies its xi and yi inputs using
the AND gate and adds this result with its input partial
product p0, a carry output c0, and passes xi and yi inputs on to
its outputs(xo and yo).
III.CONTROLLER
Controller receives 3 signals as input CLK, start, and
finish. First, controller is in Waiting state and wait for
positive pulse on start. After detecting positive pulse on
start, controller changes its state to Busy. The controller has
been written according to Huffman coding style so that
sequential and combinational parts of controller is separated.
Controller has 3 outputs including busy, waiting and
done. Figure 7 shows the state machine of the controller.
(start,finish)
(0X)
Waiting
(10)
Busy
(x0)
(X1)
Done
IV.TestBench
tester.v includes testbench for module Exp. Data
provision methods including deterministic, arithmetic,
periodic, random and Text IO have been used to apply data to
Exp. Data has been applied in random and equal time slots
and results collected after falling edge of busy signal.
V.Simulation Results
Figure 8-a and 8-b show the result waveforms after running
testbench. In addition to waveform, results have been
displayed on screen using $diplay command in figure 9.
VI.CONCLUSION
In this homework we designed and implemented a module
that calculates ex using tailor series. In order to do
multiplication we design a generic array multiplier. The Exp
module start calculating after active pulse detection on start
signal on the rise edge of clk signal and issues busy signal to
high simultaneously . After completion of calculation busy
signal is deactivated and the module is ready to accept another
input on x vector.
Data path
Multiplier
Rega(16 bit)
Array
Multiplier
Array
Multiplier
Set
CLK
Set
Regb_out[17:16]
Start
Counter(4 bit)
Look
up
table
Set
Adder
CLK
CLK
Finish
Regb_out[15:0]
Regb(18 bit)
Regb_out
done
Controller
Start
busy
CLK
ResultIntegralpart
ResultFractionalpart