Hardware Implementations of Fixed-Point Atan2 Hardware Implementations of Fixed-Point Atan2 Florent de Dinechin Matei I¸ stoan Universit´ e de Lyon, INRIA, INSA-Lyon, CITI-Lab ARITH22 Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 Methods for Computing atan 2 in Hardware Yet another arithmetic function . . . • . . . that is useful in telecom (to recover the phase of a signal) (12–24 bits of precision) • . . . and in general for cartesian to polar coordinate transformation • and an interesting function, nonetheless 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 1 0.8 0.6 1 0.8 x 0.4 0.6 0.4 0.2 0.2 y 0 0 Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 2 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 Common Specification • target function y 1 ( x , y ) α = atan 2( y , x ) f ( x , y ) = 1 π arctan ( y x ) − 1 1 x • input: fixed-point format − 1 − 1 0 1 arctan ( ky kx ) = arctan ( y x ) [ ) • output: fixed-point format and binary angles y (0 , 1) π − 1 0 1 2 ( − 1 , 0) (1 , 0) 0 π [ ) = ⇒ x − π Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 3 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 Common Specification • target function y 1 ( x , y ) α = atan 2( y , x ) f ( x , y ) = 1 π arctan ( y x ) − 1 1 x • input: fixed-point format − 1 − 1 0 1 arctan ( ky kx ) = arctan ( y x ) [ ) • output: fixed-point format and binary angles y (0 , 1) π − 1 0 1 2 ( − 1 , 0) (1 , 0) 0 π [ ) = ⇒ x − π Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 3 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 Common Specification • target function y 1 ( x , y ) α = atan 2( y , x ) f ( x , y ) = 1 π arctan ( y x ) − 1 1 x • input: fixed-point format − 1 − 1 0 1 arctan ( ky kx ) = arctan ( y x ) [ ) • output: fixed-point format and binary angles y (0 , 1) π − 1 0 1 2 ( − 1 , 0) (1 , 0) 0 π [ ) = ⇒ x − π Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 3 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 Common Specification • target function y 1 ( x , y ) α = atan 2( y , x ) f ( x , y ) = 1 π arctan ( y x ) − 1 1 x • input: fixed-point format − 1 − 1 0 1 arctan ( ky kx ) = arctan ( y x ) [ ) • output: fixed-point format and binary angles y (0 , 1) π − 1 0 1 2 ( − 1 , 0) (1 , 0) 0 π [ ) = ⇒ x − π Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 3 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 A Meaningful Comparison 3 different methods for evaluating atan 2 in hardware • same accuracy specification: f ( x , y ) computed with last-bit accuracy (faithful rounding) • same implementation effort Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 4 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 A Meaningful Comparison 3 different methods for evaluating atan 2 in hardware • same accuracy specification: f ( x , y ) computed with last-bit accuracy (faithful rounding) • same implementation effort Target platform: FPGAs ( F ield P rogrammable G ate A rrays) Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 4 / 24
Hardware Implementations of Fixed-Point Atan2 Introduction: Methods for computing Atan2 Hello FPGAs! Island-style homogeneous FPGAs Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 5 / 24
Hardware Implementations of Fixed-Point Atan2 CORDIC First Method: An Unrolled CORDIC x 0 = x y 0 = y = 0 α 0 x i − 2 − i s i y i x i +1 = y i + 2 − i s i x i y i +1 = α i − s i arctan 2 − i = α i +1 � x 2 + y 2 x n − → K y n − → 0 arctan y − → α i x Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 6 / 24
Hardware Implementations of Fixed-Point Atan2 CORDIC CORDIC Iteration: Datapath Implementation Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 7 / 24
Hardware Implementations of Fixed-Point Atan2 CORDIC CORDIC Iteration: Datapath Implementation Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 7 / 24
Hardware Implementations of Fixed-Point Atan2 CORDIC CORDIC Iteration: Accurate Datapath Implementation = ⇒ p = w − 1 − ⌈ log 2 ε w − 1 ⌉ bits for the x i and y i datapath • we can stop updating x i when 2 i − 1 > p ( unrolled operator ) Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 7 / 24
Hardware Implementations of Fixed-Point Atan2 CORDIC CORDIC Iteration: Accurate Datapath Implementation = ⇒ p = w − 1 − ⌈ log 2 ε w − 1 ⌉ bits for the x i and y i datapath • we can stop updating x i when 2 i − 1 > p ( unrolled operator ) = ⇒ g α = 1 + ⌈ log 2 (( w − 1) × 0 . 5) ⌉ guard bits for the α i datapath Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 7 / 24
Hardware Implementations of Fixed-Point Atan2 CORDIC Hello, again, FPGAs! Current heterogeneous FPGAs Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 8 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Polynomial Approximations Polynomial approximation, and their derivatives (bipartite etc.): • the straight-forward solution for implementing univariate functions • problem: area asymptotically exponential in the input width... for a bivariate function, we double the input width . • solutions: - range reduction? - multiple consecutive one-input functions? Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 9 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Polynomial Approximations Polynomial approximation, and their derivatives (bipartite etc.): • the straight-forward solution for implementing univariate functions • problem: area asymptotically exponential in the input width... for a bivariate function, we double the input width . • solutions: - range reduction? - multiple consecutive one-input functions? Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 9 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Polynomial Approximations Polynomial approximation, and their derivatives (bipartite etc.): • the straight-forward solution for implementing univariate functions • problem: area asymptotically exponential in the input width... for a bivariate function, we double the input width . • solutions: - range reduction? - multiple consecutive one-input functions? Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 9 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan The 1 x and arctan ( x ) Functions arctan ( y x ) = arctan ( y × 1 x ) reciprocal function arctangent function Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 10 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Range Reductions – Symmetry and Parity y x � y � � | x | � = − π arctan 2 − arctan x | y | Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 11 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Range Reductions – Scaling � 2 s y � � y � arctan = arctan | x | | y | 2 s x x bitwise OR y 1 LZC s = 1 s s = 2 s = 0 ShiftX ShiftY normalized s = 3 domain x r y r 1 x 0 0 Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 12 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan The 1 x and arctan ( x ) Functions – Reduced Domain reciprocal function on [0 . 5 , 1) arctangent function on [0 , 1) Now we can evaluate them with tables, or multipartite tables, or polynomial approximators, etc. (all available as faithful FloPoCo operators) Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 13 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Reciprocal-Multiply-Arctangent Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 14 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Reciprocal-Multiply-Arctangent Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 14 / 24
Hardware Implementations of Fixed-Point Atan2 Recip-Mult-Atan Reciprocal-Multiply-Arctangent Florent de Dinechin, Matei I¸ stoan Hardware Implementations of Fixed-Point Atan2 ARITH22 14 / 24
Recommend
More recommend