fixed point arithmetic - university of texas at...
TRANSCRIPT
-
Fixed Point Arithmetic
-
h~r+/1-.. - hxE]) /;;1,JT
,,
* /1.r(k - WH-Ar /I- hXDJ ?o,,.;r - Re,A7lfW To ·hol1,tAI c ?o,~-r - tJ11v \//VIX.AL cll:££C.fi:Z.
.,;. JI JZc H, r a.. -rt.1 /f.-A'L · C /f-e , c r:r - 'Z!I ~H/ll:7"!,V, - I '.r aH/7 l fitLf 0-f'"r - St~// tJt) /Vtt, All ru i>tf - Lot,JC /tJ-ro(ot-' - t, cz;:,· - /(. ~5 l])VC /V1P'160f.S
~ 1'1,cwA iCH 1-nrc cUK.IT ;t/(["CHAAlt.JhJ - Av;,rn()~ ftH< UtUY ,P2r,J11_,,) - .,,.
• lAC.
• Kbt:('r-- . s~~(/" • !Htr f7ot,J61(.. 3AL(. lz)( H.nvf>/cy)
.....
- l1uLr1rL1C A-rm~, Ir;;~ /-r, M-rto,.; ~(.~) 'KoorH!.J )k C (),{./ r Hr,
-•
. . • . . . .. ... . . .. .' .,.,
. .. ..
-
(, 'l
-
•
•
•
Computer Arit.hmetic (Integers)
* Why several choices for representation
* The Choices 2' s complement 1 's complement Signed magnitude Long integers - l( . .... ~~i .. ~ .:-. .x
Decimal (BCD) Residue Arithmetic
-
• * Why several choices?
' '
Application space should drive architecture ·
- Compute intensive, low 1/0 - Arbitrarily. large precision - Generally within a fixed set,
e with opt.ion to go to multiples of that size ·
* The concept of "Long Integer" vs "Short ln!~ger" ·
-
Three Most Common Schemes
.. 2's complement 1 's complement Signed magnitude
Exam.pie: (A 4-bit data· pcith)
Representation What is being Represented
2's Comp 1 's Comp Sign-Mag
0000 0 0 0 0001 1 1 1 0010 ·2 2 2 0011 3 3 3 0100 4 4 4 0101 5 5 5 0110 6 6 6 0111 7 7 7 1000 -8 -7 0 1001 -7 -6 2 1010 -6 -5 2 1011 - 5 , . -4 3 1100 -4 -3 4 1101 -3 -2 5 1110 -2 - 1 6 1111 -1 -0 7
* Why 2's Complement?(Easy for Computer) * Why 1 's Complement (Self-Delusion) * Why Signed-Magnitude? (Easy for Humans)
-
() 0 G) O Oo f l () Oo /
1- {) o I o/ ) 1 c> 0 I I/ 4 4.0106 f (0101~.s'
C ,a1IO J
\ I o t E--J
7 - ~ -r~--~a~~o ~~- -5+]
- /~ ~ 7 (00 I -f:£_ t (u l t1b--S--,4- I o I I - . : i F> - I I o o ·~ -~ l l O \ ~ @ -t- I _t. l l l u ( l \
I -O - ) I l t \
0
·' ( -----=--
Jr" "i:r~J-
----~~ f;:;.Jf.1/J
l'( ~:oil~ -----
-
~ ll~ i Sf I s-
/4-DD!(
r
Ah J /It,,, IF«/, V>l ~
f o''d l fey,, s
A 1] C ) .J
g
..___s_i _-t_··_,, -c-~--~\ ~--1----_J c.. 'o
\ f1Dll C l ,, Ill/ J - tZ I
-
.f;~ 11./0 -
Dec111/f'r_ /1~1r11111..'71c
( o~;, 1/4 £1 llti' (€ !_0.1 ('ffl J /};cl't!J) JJ (: a)
:I UICI-I D«IHAL · Olc;rf- Xt!'~£.est;:J,J",(.~ !.?y· .A 4 1f1T Cot>€
lJ1n-1
(1) (1) (3)
J![)l) 2r1 7o ~JP
Cb,Vs--rA ,.)7
1f 3 +
00 ( D /0 o O 00 I I. 0 I {) I I O o I t O {) O, tooo Ool)J IDl.l
GARffACe ~ 'l i B
8 ttt. A;.JZ) IH£.lo/ Gel o.t
Cl(:, ---,> S7 Er i€i + S-1? --.:,. E ~•,.-E 8' I - (. oo --? ?~,
[ lJHy SuZTtl/C-r CO 0 ?/
-
fs_ 9-__ ;t: tt~-1-vc (/1 '"° JL rfx11,1 cJ
I I
~;-7 0 s--- 7
\=~ \: t~ ~~ 11 \ 0 I / ] .._L ~ f S-ecs -
'· 0 IO O
~ ~O V \/ \ o ( 0 I \ (51
Dito o 10\ / 01t \ QllD fJt lO · (}II O --( 10 D \\Il/ 1 1 t{O l
I I oc?1 oA,.oa l · (5 loo
~1:-:: I I I I~_'.,~◊-\'' - --- -····
-
IS oo-rN 1..f lllC~M r y,., (A VA~1AT10,11)
~..,f.f,( li'cJt14.J _______ ___.._; )(_ • ...:..JrJ 0
------·~---" -----
,4L.U ~ c' .X '1 C J.. 1
' f'As~ 11.~s 0 0 0 S-w 'Z.. __ o ol 0 fA 'Sf Ano SMF 1- 0
• 0 0 JHF I Ai>o St1F l 0 ( I 0 "1ss- Sul S11P 2. l -~- -0 O I f'A.r, A,i> S11r t.. 0 ... -0 I \ )fff I A,1> S111=· I __ ·St.J8 fA SJ
.J ..
G~.f.r.v.-l "2..
SHF I S"4f"'L . . . _., -·- .
J exA,.,,,,. : 00 10 I L. . ::__/( . s--,, oo u ED
2. Ol ED ,e
_,,_-z. ' 0 I 1e .,. - l • 4 - I _aif
-
,~iJ ?J. /1 > - - ----- · ·-- - -- --
ResidueArithmetic
* When? - · Inputs, outputs are short
integers · - Intermediate results may be
very large - Internally compute intensive,
as opposed to having to do substantial 1/0
* How?
a,b
a* b
Transform to Residue Representation
(Slow)
I I Inverse transform
(Slow)
f(a), f(b) Perform the operation
(VERY FAST)
f(a) * f(b)
-
/(EsIDue IIR.1TH1-1«-r1c ( UJ1,Ir1,.;u~)
¥ /N GeATe,(_ Vt!"TAIL J
- hcK.. A Jer j,c }101>ul I f, J /2. ... /4 Svcu fH,A--r ·· 1«c7 A,u .4l
-
{t)
6~ 11 j,r- -R.es mue Af/_li/1"1CT!C { 61/nl( rs )
f.cfR..eSOJTATI o~S : · 11 - r;- 3 ( 24 - J o C -
(zJ !1001T1010 : / 7 ' sr J I +2..4- J () ~
- --4- 7 I s 7
(3) /3/tJct/ft. ICATIOAI : 19 S"" 3 I z4 3 o t.. 7 t -I 0 ' JY
4~t
(4) /Jlf( /-r t/4£ K.5 :
A N f3 -= ( M fl + ~) ~ (~ f,· + ' ) = fc·{1t1,,fc, -1- ai-, + l"') + t«b
~ (fl ¥ 13) "',, ft = "' i
-
f 1W P.L./(£
f:t:sivu I[ A,errH Ml.'71 c ( C,,vr1t1Vis!J)
/rJve!U'e - ' / f:AdSFIJ)(..M,'I 71 o rJ LET X 3£f l