Chapter 3. The FPU
40
@ e c h o off
for / l %% i in (1 ,1 ,100) do (
f p u _ a d d _ s u b . exe
t i m e o u t / t 1
)
Figure 3.1: The .bat program
int sa [ 6 4 ] = { 0 } ;
int sb [ 6 4 ] = { 0 } ;
v o i d r a n d _ v a r s ( int * p ) {
int i ;
for ( i =0; i < 6 4 ; i ++) {
p [ i ]= r a n d ( ) % 2 ;
}
}
r a n d _ v a r s ( sa );
r a n d _ v a r s ( sb );
Figure 3.2: The random vector generator
Table 3.1: Device Utilization Summary for the FPU adder
Logic Utilization
Used
Available
Utilization
Number of Slice Registers
154
93120
0%
Number of slice LUTs
1400
46560
3%
Number of used LUT-FF pairs
142
1412
10%
Number of bonded IOBs
199
240
82%
Number of BUFG/BUFGCTRLs
1
32
3%
some calculations like addition and subtraction were executed in decimal numbers and
others such as shift were executed in binary. Two functions were created to convert
decimal to binary and vice versa. Figure
shows the two functions along with the
type definition that had to be used to represent so large numbers.
The next step is to create the VHDL testbench that automatically uses inputs and runs
the simulation for many vectors. This is done by creating a top module that contains
the module to be tested. The top module reads the .txt file generated by the program
and feeds the vectors to the component in predetermined time intervals, which are the
clock cycles required to complete the execution. The outputs are also stored in the same
.txt generated by the program so as to be compared.