binary arithmetic () 2 2-adic integer 2jv/homepage/cours/binaryalgebra.pdf · 2-adic integer nb→...
Post on 28-Jun-2018
219 Views
Preview:
TRANSCRIPT
1
BinaryArithmetic
(2) (2)(2)(2) (2)
a b a bb ba b a b
+ +
− −
× ×
Integer Ring : + − ×D
[ ]
2
:
( ) 2
ntt
t n
n t B
n
n
∈
= →
=
∈
∑
D
2
binary sequence 2-adic integer
→N BZ
1y x= − − 2a c s r+ = + 2y x= 1 2y x= +
Binary Algebra©Vuillemin:2010-2047
/2n nB Z Z( ) ( )( ) ( )2
a b a b a ba b a b
+ = ∪ − ∩= ⊕ + ∩0 a b a b a b a b= ∩ ⇔ + = ∪ = ⊕
Disjoint Sum Integers modulo 2n
2
Increment[ ]
2
:
( ) 2
ntt
t n
n t B
n
n
∈
= →
=
∈
∑
D
2
binary sequence 2-adic integer
→N BZ
Binary Algebra©Vuillemin:2010-2047
[0] [0] [0] 2 [1][1
[ ]2 ,
] [1] [1] 2 [2]
[ ]2
[0]
n n
a c s ca c s
A a n S s n
S A c
c+ = ++ = +
= =
= +∑ ∑
Parallel Increment
Serial Increment
1 22
1y x
c rx c y r
= ++ =
= ++
3
Bit SerialArithmetic
111
b bb bb b
− = +¬+ = −¬− = ¬−
[ ]
{ } { : 1= }
(2) 2
:nt
nt
t
t n
n t B
t n t B
n
n∈
= →
∈ = ∈
=
∈
∑N
D
2
binary sequence integer subset 2-adic intege
2r
→N
N B
Z
Binary Algebra©Vuillemin:2010-2047
4
HybridFormulas
Binary Algebra©Vuillemin:2010-2047
∩∩
5
0
1
0
2 2 2n n
n nn n
n N n N
cc rc r+
∈ ∈
===∑ ∑
2
2 2 2 2 2 2t t t t t
t t t t tt t t t t
t N t N t N t N t N
a b c s r
a b c s r∈ ∈ ∈ ∈ ∈
+ + = +
+ + = +∑ ∑ ∑ ∑ ∑
Serial Add
a+b+c = s+2r
s = a+b c = 2r
Binary Algebra©Vuillemin:2010-2047
6
d = a-b ' 1' 2
1 2
b b ba b c d rc r
= ¬ =− −+ + = +
= +
Serial Subtract
Binary Algebra©Vuillemin:2010-2047
( )1
a b a ba b a b¬ − =¬ +− = + +¬
ALU
s= f(i)(a,b)
i f(i)01
∩
+
i f(i)0123
⊕
∩
+
−
Number of Instructions 2 4 8 16 32 64 ...
Two’s Complement
7
Parallel Adder
0 2 2 2 2k k k Nk k k N
k N k N k N
c a b s c< < <
+ + = +∑ ∑ ∑
0 0 0 0 1
1 1 1 1 2
22
a b c s ca b c s c+ + = ++ + = +
Binary Algebra©Vuillemin:2010-2047
8
Trade Time for Space
z=4 : 2b/cycle z=2 : 1b/cycle
22
a b c s rc rs a b
+ + = +== +
2
2
( ) ( ) 2
a u v u v
b w x w x
s u w v x
= + =
= + =
= + + + =
z=√2z2=2
Energy is now the DOMINANT design criteria for most soft&hard.Goal: minimal computation at minimal speed!
0.5b/cycle
Binary Algebra©Vuillemin:2010-2047
0 1 0 1 0 0 1 2
0 2
2 2 2 44
a a b b c s s cc cs a b
+ + + + = + +== +
a k b k s kk k ka B z b B z s B z= = =∑ ∑ ∑0 1( 2 )a a k
k ka B B z= +∑ 2 1 2a k a kk ku B z v B z+= =∑ ∑
9
SIMD
Binary Algebra©Vuillemin:2010-2047
8
8
8
8
2
2
kk
k
kk
k
x x
y y<
<
=
=
∑
∑
8
8
2
(mod 256)
kk
k
k k k
s s
s x y<
=
= +
∑
Pack 8 bytes per 64b word
Compute the byte-wise sum!
7 8 642
128(0 1) (2 1)255
m= = −
( ) ( )( ) ( )
c x m y md x m y ms d c
= ∩ ⊕ ∩= ∩¬ + ∩¬= ⊕
MMXGPU 8 operations
Single 64b operation
8 : , 128k kk x y s x y∀ < < ⇒ = +
10
Binary Series
( ) ( )
( ) ( ) ( )
10 0
a b b aa b c a b ca aa
a b c a b a c
⊗ = ⊗⊗ ⊗ = ⊗ ⊗
⊗ =⊗ =
⊗ ⊕ = ⊗ ⊕ ⊗
( ) ( )
2 2 2
00
( )
a b b aa b c a b ca aa aa b a b
⊕ = ⊕⊕ ⊕ = ⊕
=
⊕ =
⊕=
⊕
⊕
⊕
mod( ) ( ) ( 2)a b a z b z⊗ ×
(mod 2)1 1
1n nz a
za= + + +
−
[ ]
(2) 2
:
( )
ntt
t nt
t n
nn t B
n
n z z∈
∈
= →
=
=
∈
∑
∑
D
2
2
binary sequence 2-adic integer
series ) (z
→N BZ
F
Series Ring: ⊕ ⊗D 2 2Polynomial Rings: [z]/ z [z]nnD F F
Convolution “carry-free” Product
11
SSS[ ]
{ } { : 1= }
(2) 2
(
:
)
nt
nt
t
t nt
t n
n t B
t n t B
n
n z z
n
∈
∈
= →
∈ =
∈
∈
=
=
∑
∑
N
D
2
2
binary sequence integer subset 2-adic integer
series
2
( )z
→N
N B
ZF
2 2( ) ( )n m n z zm zN N N P P PA A A D D D
= += == =
Binary Algebra©Vuillemin:2010-2047
Shuffle
( )( )
k
k
n kn k n z zn k n z z
D N∈ ∈
⇑ =
⇓ = ÷
Shift n kn k n kn k n k
D Z∈ ∈⇑− = ⇓⇓− = ⇑
2
2
( )
( ) ( (10) )( )
n n z n n
n n z n z∞
↑ = = ⊗
↓ = = ∩
21(10)
3
n n
n n n∞
↓↑ =−
↑↓ = ∩ = ∩
Sample
( )(( ) / )
n m n z mn n m
m n m z
=↑ + ↑=↓
=↓
2n nd n d d z⇑ = × = ⊗
Homework
64
Let word size be 64b.Let be a word.
Compute the words (l,h) such that:( 64).
Likewise for .
n
n l hn
D∈
↑ = + ⇑↓
12
Binary Rational
n22 = p 2 Write in binar7
y!np = ∑2 3
2 2 222 11 2 1= 0 2 01 2 010 2 ...7 7 7 7
+ = + = + =
222 0101(110)7
∞=
1 2
= ∩ =+ZP D QN
Binary Algebra©Vuillemin:2010-2047
nW = q 2rite in binary :1 2
nnqd
=+ ∑
0
2
(1 2 )1 2
mod
( ) k k
n q dk kk
n nq n
n − ++
= ∈= ∈
= ∈
Z
Z
B
72
22 30101110 27 7
−= +
4 5 62 2 2
22 3 5 60101 2 01011 2 010111 2 ...7 7 7 7
− − −= + = + = + =
32 2 3
3 3 3110 2 (110)7 7 1 2
∞− −= + = =
−
13
HenselDivision
10 0k kd n d n +− ≤ ≤ ⇒ − ≤ ≤
2 0 1 1( )1 2 i i i pn q q q qd − + −=
+
Initial part
Period
mod
( ,2)1 2 (
orde )
rdp
p d=
=
10 / 2k k k kn n n n+> ⇒ ≤ <
1(1 2 ) / 2k k k kn d n n n +< − + ⇒ < ≤
0t t
0 0.. 1
= q 2 q 2 21 2 1 2
(1 2 ) 2
t t k k
t kk
k k
n nqd dn d q n
<
−
= = ++ +
= + +
∑ ∑
- mod2 ( 1 2 )k
kn n d= +
2 0 12 0 1( ) 1 0
1 2 1 2p
p p
q qnq q q qd
−∞−= = = ⇔ − ≤ ≤
+ −
Homework1- Compute sign.2- Compute quotient & remainderfrom
period=0 exact d
initial part & pe
i
r .
vide
iod
⇔
Binary Algebra©Vuillemin:2010-2047
14
RationalSeries
nWrite as a bin22 = p a 7
ry series!np z= ∑01101 1101 011 11= 0 01 010111 111 111 111
01 10101 01010 010(110)111 111
z z z zz z z
z z z z
z zz z z
z z
∞
• = • = • =
• = • =
2
2
[ ]1 [
]
zz z
=+FPF
Binary Algebra©Vuillemin:2010-2047
15
Binary Algebra
11 2
11
n
zn
−
⊕
∈ ⊂ =¬ ∪ ∩ ⊕
+ × −⊗ •
⇓
<
↓ ↑ ⇑
[ ]
(2) 2
:
( )
ntt
t nt
t n
nn t B
n
n z z∈
∈
= →
=
=
∈
∑
∑
D
2
2
binary sequence 2-adic integer
series ) (z
→N BZ
F
⊕ ⊗⊕ ∩+ − ×
DDD
Binary Operations
3 Rings + Many Hybrids !
0 0 ( 0 0)0
x y x y x yx y x y x y x y y x
× = ⇔ ⊗ = ⇔ = ∪ =∩ = ⇔ + = ∪ = ⊕ ⇔ ⊆ ¬
Odd inverses
1 1 21 2
n naa
= + + +−
15/10/2009 Binary Algebra - Vuillemin
(mod 2)1 1
1n nz a
za= + + +
−
2 2 2: nSubrings ZD P A C D
16
Valuation [ ]
(2) 2
:
( )
ntt
t nt
t n
nn t B
n
n z z∈
∈
= →
=
=
∈
∑
∑
D
{ }
2
2
2 2( )
( ) min(0) , (1) 0
0 2 (1 2 ')v d
v d n dv v
d s d
= ∈
=+∞ =
≠ ⇒ = +Valuation
{ }2 2 2 2
2 2 2 2
( ) ( ) ( ) ( )( ) ( ) min ( ), ( )
v x y v x y v x v yv x y v x y v x v y
× = ⊗ = +
− = ⊕ ≥
( 1) 2( 1) 2 1( 1) 2 1
v
v
v
x x xx xx x x
∩ − = −¬ ∩ − = −⊕ − = + −1
22
2
v
v
v
x xx xx x +
∩− =∪− = −⊕− = −
2
2
2 2
(0)(1 2 ) 0
(2 ) 1 ( )
vv xv x v x
= ∞+ =
= +
17
Measures
1 11
n nz aza
= ⊕ ⊕ ⊕⊕
[ ]
(2) 2
:
( )
ntt
t nt
t n
nn t B
n
n z z∈
∈
= →
=
=
∈
∑
∑
D
Distance
and 1 1 21 2
n naa
= + + +−
2 ( )2 [0,1]v dd R−= ∈ ∩
Norm { }ma
0 0
x ,
x x
x y x y x y
x y x yx y
= ⇔ =
× = ⊗ = ×
≤≤+ +
{ }
( , ) ( , )( , ) 0
( , ) (max ( , ), ( , ) , ) ( , )
d x y d y x x y x yd x y x y
d x z d x y d y zd x y d y z
= = − = ⊕
= ⇔ =
≤ +≤
Big-Endian: R Little-Endian: D.
converge!
HomeworkAll triangles isosceles!
converges 0 lim n nnd d
→∞⇔ =∑
Ultra-metric
{ }2 ( ) minv x k x= ∈
18
Endians
2 0 2
1/2 0
Little Endian:
Big Endian
2
:
2 [0,2 ]
nn n
nn n
q q q
q q q −
= ∈
= ∈ ∩
∑∑
Z
R
Integer Operations
11 2
11
n
zn
−
⊕
+ ×
⊂¬ ∪ ∩ ⊕∈
⊗ •
<
⇓
−
÷
↓ ↑ ⇑
LE = Little Endian = from LSB to MSB.BE = Big Endian = from MSB to LSB.EE = Either Endian = one, or the other.AE = Any Endian = any order.
19
Subset: { } : { 1}nb n b= ∈ =N (z-series: ) n
nn
b z b z∈
= ∑N
Digital Number b∈D
2-adic integer: (2) 2nnn
b b∈
= ∑N
1 ( ) !2
Real: 2nn
n
b is not uni ueb q∈
= ∑N
0 1 2Sequence: ( ) b b b b=N
Digital Sign (a : )l ) (nn
b t b t n∈
= ∂ −∑N
Predicate: ( ) nb n b=
Binary Algebra©Vuillemin:2010-2047
20
Digital Function 1. Continuous: each output depends upon finitely many inputs.
2. Computable : presented by a finite program.
3. Causal : present output depends upon past input.
→D D
Binary Algebra©Vuillemin:2010-2047
11 2
11
n
zn
−
⊕
∈ ⊂¬ ∪ ∩ ⊕
+ × −⊗ •
⇓
= <
↓ ↑ ⇑
4. Sequential : causal + finite memory finite circuit.
5. Memoryless : Boolean function
11 2
11
n
zn
−
⊕
= <
×
∈ ⊂¬ ∪ ∩ ⊕
+ −⊗ •
↓ ↑ ⇑ ⇓
21
Binary Algebra
12 2... ... 2
1 2n⊂ ⊂ ⊂ ⊂ ⊂ ⊂ ⊂ ⊂ ⊂ ⊂
+ZF N Z A DZ
NB B
= ∈ ⊂ ¬ ∩ ∪ ⊕
Words:Catenate, shifts, star, residual
Sets:
1 / (1 2 )d+ − × −Integers:
Series: 1 / (1 )zd⊗ ⊕ − ↑ ↓
* −• ⇑ ⇓
Binary Algebra©Vuillemin:2010-2047
22
What am I doing here?
1. Function2. Algorithm3. Specify4. Verify5. Instrument6. Implement7. Optimize8. Synthesize9. Validate10. Sell
Binary Algebra©Vuillemin:2010-2047
Tall Thin Designercuts across all trades
top related