[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[f-cpu] FPU Adder....



Hello
I\'m in charge of the Floating Point Unit (engineer school project
supervised by yann himself!!).
Since we started only this year learning VHDL, i took lot of time to
understand how both VHDL and F-CPU works.
And i don\'t know if the current adder i wrote is correct or not (will
it work with other units, is it F-CPU compatible,...?)
So i give you the current fadd and i\'m waiting for any comment...
For the moment, the fadder works for \"trivial\" calculation like 1+5,
6+15.5, 1000+6...
I will start rounding and other problems next year (only 2 days  ), but
i really want to have
a correct code (especialy if i have to restart from scratch)...

I\'m not a VHDL expert so if you see some howful things, don\'t be
surprised...
It takes 6 cycles to have a result, i don\'t know if it\'s too mush or
not enough (i cannot synthetise so
i don\'t know if my stages are too deep or not)

Here the output of my tests :

*** testing FPU add/sub unit (fadd/fsub instruction) ***
Clock period: 10 ns
Reseting unit...
End of reset.
Default values:
** SIGNALS REPORT **
Inputs:
En        := 0
Rst       := 0
Din_0     :=
0000000000000000000000000000000000000000000000000000000000000000
Din_1     :=
0000000000000000000000000000000000000000000000000000000000000000
Substract := 0
Flags     := 000000
SIMD      := 000
Outputs:
Dout_0    :=
00000000000000000000000000000000UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
FExout    := UUUUUUUUU
** END OF SIGNALS REPORT **
------ FLOAT ADDITION -----
First calculation
Din_0 := 01000001011100000000000000000000 (15.0f)
Din_1 := 01000000110000000000000000000000 (6.0f)
Launching ONE calculation (over 6 cycles)...
Check successfull: Dout_0 := 01000001101010000000000000000000 (21.0f)
Launching cascading calculations (6 calculations)
1st cycle
Din_0 := 01000000110000000000000000000000 (6.0f)
Din_1 := 11000001011100000000000000000000 (-15.0f)
2nd cycle
Din_0 := 11000000110000000000000000000000 (-6.0f)
Din_1 := 11000001011100000000000000000000 (-15.0f)
3rd cycle
Din_0 := 11000000110000000000000000000000 (-6.0f)
Din_1 := 01000001011110010101101000001000 (15.58448f)
4th cycle
Din_0 := 01000000110000000000000000000000 (6.0f)
Din_1 := 01000100011110100000000000000000 (1000.0f)
5th cycle
Din_0 := 01000000110000000000000000000000 (6.0f)
Din_1 := 01000100011110100000000000000000 (-1000.0f)
6th cycle
Din_0 := 01000100011110100000000000000000 (1000.0f)
Din_1 := 01100010010110001101011100100111 (1e21f)
Result first calculation (6.0f + -15.0f)
Check successfull: Dout_0 := 11000001000100000000000000000000 (-9.0f)
7th cycle
Din_0 := 01000001000110010101101000001000 (9.58448f)
Din_1 := 01000001100101100100101101011110 (18.7848f)
Result second calculation (-6.0f + -15.0f)
Check successfull: Dout_0 := 11000001101010000000000000000000 (-21.0f)
8th cycle
Result third calculation (-6.0f + 15.58448f)
Check successfull: Dout_0 := 01000001000110010101101000001000
(9.58448f)
9th cycle
Result fourth calculation (6.0f + 1000.0f)
Check successfull: Dout_0 := 01000100011110111000000000000000
(1006.0f)
10th cycle
Result fifth calculation (6.0f + -1000.0f)
Check successfull: Dout_0 := 11000100011110001000000000000000
(-994.0f)
11th cycle
Result sixth calculation (1000.0f + 1e21f)
WHOA THERE!!!
Dout_0 := 01100010011010000111011100100111
Dout_0 /= 01100010010110001101011100100111
Result seventh calculation (9.58448f + 18.7868)
Check successfull: Dout_0 := 01000001111000101111100001100010
(28,37128)

=> we see here a little rounding problem...

For the moment, the unit only work with 32-bit floats (for easy
reading)...
I plan to use the same unit for both 32bit/64bit calculations, with a
select bit in Mode vector...

What else to say???

Happy new year!!

Byebye

-- 

~~ Gaetan ~~
http://www.xeberon.net


Attachment: eu_fasu-20031230.tar.gz
Description: application/gzip