A general-purpose method for faithfully rounded floating-point function approximation in FPGAs
David B. Thomas Imperial College London
David Thomas, Imperial College, dt10@ic.ac.uk 1
A general-purpose method for faithfully rounded floating-point - - PowerPoint PPT Presentation
A general-purpose method for faithfully rounded floating-point function approximation in FPGAs David B. Thomas Imperial College London 1 David Thomas, Imperial College, dt10@ic.ac.uk FloPoCo : Parameterised primitives 2 David Thomas,
David Thomas, Imperial College, dt10@ic.ac.uk 1
David Thomas, Imperial College, dt10@ic.ac.uk 2
David Thomas, Imperial College, dt10@ic.ac.uk 3
David Thomas, Imperial College, dt10@ic.ac.uk 4
David Thomas, Imperial College, dt10@ic.ac.uk 5
David Thomas, Imperial College, dt10@ic.ac.uk 6
David Thomas, Imperial College, dt10@ic.ac.uk 7
David Thomas, Imperial College, dt10@ic.ac.uk 8
David Thomas, Imperial College, dt10@ic.ac.uk 9
David Thomas, Imperial College, dt10@ic.ac.uk 9
David Thomas, Imperial College, dt10@ic.ac.uk 10
David Thomas, Imperial College, dt10@ic.ac.uk 10
Subject: Floating-point log1p? To: dt10@ic.ac.uk From: phd-slash-industry-bod@somewhere.com Body: I’m converting some code for an accelerator, and it uses log1p. Can I use your core from that PoC you did a while back?
David Thomas, Imperial College, dt10@ic.ac.uk 11
Subject: Re: Floating-point log1p? To: phd-slash-industry-bod@somewhere.com From: dt10@ic.ac.uk Body: Afraid that was written in Handel-C, I don’t have any VHDL. You could recreate it using the attached maple script, plus write a code gen. > I’m converting some code for an accelerator, and > it uses log1p. Can I use your core from that > PoC you did a while back?
David Thomas, Imperial College, dt10@ic.ac.uk 12
Subject: Re: Floating-point log1p? To: phd-slash-industry-bod@somewhere.com From: dt10@ic.ac.uk Body: Any luck? > Afraid that was written in Handel-C, I don’t > have any VHDL. You could recreate it using > the attached maple script, plus write a code gen. > > I’m converting some code for an accelerator, and > > it uses log1p. Can I use your core from that > > PoC you did a while back?
David Thomas, Imperial College, dt10@ic.ac.uk 13
Subject: Re: Floating-point log1p? To: phd-slash-industry-bod@somewhere.com From: dt10@ic.ic.ac.uk Body: Oh, we don’t have maple. It’s ok, I found out log1p(x)=log(1+x), and just did
> Any luck? > > Afraid that was written in Handel-C, I don’t > > have any VHDL. You could recreate it using > > the attached maple script, plus write a code gen.
David Thomas, Imperial College, dt10@ic.ac.uk 14
Source Pipelined Faithful RTL add, mul, div FloPoCo Yes Yes Yes log, exp FloPoCo Yes Yes Yes sin, cos FPLibrary No Yes Yes Altera Yes Yes Altera flow only Xilinx Yes ? Vivado HLS only log1p Altera Yes Yes Altera flow only expm1 Altera Yes No OpenCL only erf Altera Yes No OpenCL only
David Thomas, Imperial College, dt10@ic.ac.uk 15
Source Pipelined Faithful RTL add, mul, div FloPoCo Yes Yes Yes log, exp FloPoCo Yes Yes Yes sin, cos FPLibrary No Yes Yes Altera Yes Yes Altera flow only Xilinx Yes ? Vivado HLS only log1p Altera Yes Yes Altera flow only expm1 Altera Yes No OpenCL only erf Altera Yes No OpenCL only
David Thomas, Imperial College, dt10@ic.ac.uk 15
Source Pipelined Faithful RTL add, mul, div FloPoCo Yes Yes Yes log, exp FloPoCo Yes Yes Yes sin, cos FPLibrary No Yes Yes Altera Yes Yes Altera flow only Xilinx Yes ? Vivado HLS only log1p Altera Yes Yes Altera flow only expm1 Altera Yes No OpenCL only erf Altera Yes No OpenCL only
David Thomas, Imperial College, dt10@ic.ac.uk 15
David Thomas, Imperial College, dt10@ic.ac.uk 16
David Thomas, Imperial College, dt10@ic.ac.uk 16
David Thomas, Imperial College, dt10@ic.ac.uk 16
David Thomas, Imperial College, dt10@ic.ac.uk 17
David Thomas, Imperial College, dt10@ic.ac.uk 17
David Thomas, Imperial College, dt10@ic.ac.uk 19
David Thomas, Imperial College, dt10@ic.ac.uk 20
David Thomas, Imperial College, dt10@ic.ac.uk 21
David Thomas, Imperial College, dt10@ic.ac.uk 21
David Thomas, Imperial College, dt10@ic.ac.uk 21
David Thomas, Imperial College, dt10@ic.ac.uk 21
David Thomas, Imperial College, dt10@ic.ac.uk 21
David Thomas, Imperial College, dt10@ic.ac.uk 21
22 David Thomas, Imperial College, dt10@ic.ac.uk
2 4 6 8 10 12 14 16 0.5 1.5 2.5 3.0 3.5 4.0 16 06 . ) 1 . sin(
95 .
x x x x y
23 David Thomas, Imperial College, dt10@ic.ac.uk
David Thomas, Imperial College, dt10@ic.ac.uk 24
David Thomas, Imperial College, dt10@ic.ac.uk 25
David Thomas, Imperial College, dt10@ic.ac.uk 26
David Thomas, Imperial College, dt10@ic.ac.uk 27
David Thomas, Imperial College, dt10@ic.ac.uk 28
David Thomas, Imperial College, dt10@ic.ac.uk 29
David Thomas, Imperial College, dt10@ic.ac.uk 30
David Thomas, Imperial College, dt10@ic.ac.uk 31
David Thomas, Imperial College, dt10@ic.ac.uk 32
David Thomas, Imperial College, dt10@ic.ac.uk 35
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand
David Thomas, Imperial College, dt10@ic.ac.uk 36
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 37
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 38
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 39
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 40
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 41
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 42
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 43
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 44
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21 1.0 2.0 2.0 1.0 1.5 1.5
David Thomas, Imperial College, dt10@ic.ac.uk 45
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21 1.0 2.0 2.0 1.0 1.5 1.5
David Thomas, Imperial College, dt10@ic.ac.uk 46
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand 20 2-1 2-3 2-2 2-4 22 21 23 2-4 2-3 2-2 2-1 20 21
David Thomas, Imperial College, dt10@ic.ac.uk 47
Segmentation Fixed-Point Polynomial Table-Lookup s flags expnt significand c0 cd ... s flags
c0 cd x
c1
c1
expnt
y = ∑ci xi x ëSiû ≤ i ≤ éSiù
s flags expnt significand
David Thomas, Imperial College, dt10@ic.ac.uk 48
David Thomas, Imperial College, dt10@ic.ac.uk 48
David Thomas, Imperial College, dt10@ic.ac.uk 49
David Thomas, Imperial College, dt10@ic.ac.uk 49
David Thomas, Imperial College, dt10@ic.ac.uk 49
David Thomas, Imperial College, dt10@ic.ac.uk 49
David Thomas, Imperial College, dt10@ic.ac.uk 50
David Thomas, Imperial College, dt10@ic.ac.uk 51
David Thomas, Imperial College, dt10@ic.ac.uk 51
David Thomas, Imperial College, dt10@ic.ac.uk 51
David Thomas, Imperial College, dt10@ic.ac.uk 52
David Thomas, Imperial College, dt10@ic.ac.uk 52
David Thomas, Imperial College, dt10@ic.ac.uk 52
David Thomas, Imperial College, dt10@ic.ac.uk 52
David Thomas, Imperial College, dt10@ic.ac.uk 53
David Thomas, Imperial College, dt10@ic.ac.uk 53
David Thomas, Imperial College, dt10@ic.ac.uk 53
David Thomas, Imperial College, dt10@ic.ac.uk 53
David Thomas, Imperial College, dt10@ic.ac.uk 54
David Thomas, Imperial College, dt10@ic.ac.uk 54
David Thomas, Imperial College, dt10@ic.ac.uk 54