Ca4-1 Les 4: Gegevensmanipulatie- instructies en machinemodellen “Everything that can be invented has been invented.” — Charles H. Duell, Commissioner,

Slides:



Advertisements
Verwante presentaties
KWALITEITSZORG november 2012
Advertisements

Voorrangsregels bij rekenen (2)
‘SMS’ Studeren met Succes deel 1
Wat was toen het grootste het grootste probleem van de van de FOD?
Presentatie cliëntenonderzoek. Algemeen Gehouden in december 2013 (doorlopend tot eind januari) DoelgroepVerzondenOntvangen% LG wonen en dagbesteding.
Hoe werkt een rekenmachine?
NEDERLANDS WOORD BEELD IN & IN Klik met de muis
1 Resultaten marktonderzoek RPM Zeist, 16 januari 2002 Door: Olga van Veenendaal, medew. Rothkrans Projectmanagement.
November 2013 Opinieonderzoek Vlaanderen – oktober 2013 Opiniepeiling Vlaanderen uitgevoerd op het iVOXpanel.
Uitgaven aan zorg per financieringsbron / /Hoofdstuk 2 Zorg in perspectief /pagina 1.
Duurzaamheid en kosten
1 COVER: Selecteer het grijze vlak hiernaast met rechtsklik & kies ‘change picture’ voor een ander beeld of verwijder deze slide & kies in de menubalk.
Global e-Society Complex België - Regio Vlaanderen e-Regio Provincie Limburg Stad Hasselt Percelen.
Ronde (Sport & Spel) Quiz Night !
1/1/ /e/e eindhoven university of technology 5JJ20:Computerarchitectuur 2M200:Inleiding Computersystemen Sessie 2(1): Inleiding InstructieSetArchitectuur.
INITIATIE DEFINITIESELECTIECONCIPIËREN INBEDDING IN ORGANISATIE ONDERHOUD Opdrachtgever/ Projectleider Eigenaar Architect en zijn team Stakeholders INITIATIEDEFINITIESELECTIECONCIPIËRENINBEDDINGONDERHOUD.
Een optimale benutting van vierkante meters Breda, 6 juni 2007.
Kb.1 Ik leer op een goede manier optellen en aftrekken
Tevredenheids- enquête 2012 P. Grouwels Inleiding Mogelijke antwoorden: Zeer goed: 4 sterren ****: volledig tevreden; Goed: 3 sterren ***:

Nooit meer onnodig groen? Luuk Misdom, IT&T
FOD VOLKSGEZONDHEID, VEILIGHEID VAN DE VOEDSELKETEN EN LEEFMILIEU 1 Kwaliteit en Patiëntveiligheid in de Belgische ziekenhuizen anno 2008 Rapportage over.
Elke 7 seconden een nieuw getal
Digitale foto Megapixel à 3 bytes = 12 Megabyte.
De grafiek van een machtsfunctie
Rekenregels van machten
Voorbeeld a5a · 4b = 20ab b-5a · 4a = -20a 2 c-2a · -6a = 12a 2 d5a · -b · 6c = -30abc e-5b · 3a · -2 = 30ab f-2 · -a = 2a opgave 1 a7a + 8a = 15a b6a.
Rekenregels voor wortels
Lineaire functies Lineaire functie
Regelmaat in getallen (1).
1 het type x² = getal 2 ontbinden in factoren 3 de abc-formule
1 introductie 3'46” …………… normaal hart hond 1'41” ……..
Oefeningen F-toetsen ANOVA.
1Ben Bruidegom Hoe werkt een rekenmachine? Ben Bruidegom AMSTEL Instituut Universiteit van Amsterdam.
1Ben Bruidegom 1 Hoe werkt een “loopje” nu precies? Recapitulatie rekenmachines week 1 Van rekenmachine naar rekenmachine met “loopjes”
1Ben Bruidegom A Harvard Machine Recapitulatie Calculator Calculator  Calculator met “loopjes” Calculator met “loopjes”  Processor.
1Ben Bruidegom 1 Sequentiële schakelingen Toestand uitgang bepaald door:  ingangen &  vorige toestand uitgang.
Sequentiële schakelingen
Wat levert de tweede pensioenpijler op voor het personeelslid? 1 Enkele simulaties op basis van de weddeschaal B1-B3.
In dit vakje zie je hoeveel je moet betalen. Uit de volgende drie vakjes kan je dan kiezen. Er is er telkens maar eentje juist. Ken je het juiste antwoord,
Seminarie 1: Pythagoreïsche drietallen
Talstelsels, rekenen en rekenschakelingen
1Ben Bruidegom 1 De Harvard Machine Van rekenmachine met “loopjes” naar processor.
Ben Bruidegom 1 Sequentiële schakelingen Toestand uitgang bepaald door:  ingangen;  vorige toestand uitgang.
Talstelsels, rekenen en rekenschakelingen
ribwis1 Toegepaste wiskunde – Differentieren Lesweek 7
Inger Plaisier Marjolein Broese van Groenou Saskia Keuzenkamp
SAMENWERKING WO EN HBO BIJ AANSLUITINGSONDERZOEK V0-HO Rob Andeweg DAIR 7 en 8 november 2007.
Standaard-bewerkingen
EFS Seminar Discriminatie van pensioen- en beleggingsfondsen
Hoe gaat dit spel te werk?! Klik op het antwoord dat juist is. Klik op de pijl om door te gaan!
Eerst even wat uitleg. Klik op het juiste antwoord als je het weet.
Les 2: Gegevensvoorstelling
1/1/ eindhoven university of technology / faculty of Computer Science 2IC20:Computersystemen Week 4: Inleiding InstructieSetArchitectuur (ISA) datatypen.
Op reis naar een dierentuin
Informatica: Binair rekenen.
Hoofdstuk 9 havo KWADRATEN EN LETTERS
Uitleg scheikundige begrippen
17/08/2014 | pag. 1 Fractale en Wavelet Beeldcompressie Les 5.
17/08/2014 | pag. 1 Fractale en Wavelet Beeldcompressie Les 3.
Fractale en Wavelet Beeldcompressie
STIMULANS KWALITEITSZORG juni 2014.
In opdracht van NOC*NSF
Culturele Atlas 2004 Gelderland en Overijssel. Culturele Atlas, Enschede ( 76)Apeldoorn ( 92) Zwolle (121)Nijmegen
welke hoef je niet te leren?
DIGITAL ANALYTICS TOOLS. 2 DIGITALE MEDIA - METEN.
Openbaar je talent Service public, talent particulier.
Bits & bytes.
Les 4: Gegevensmanipulatie-instructies en machinemodellen
Transcript van de presentatie:

ca4-1 Les 4: Gegevensmanipulatie- instructies en machinemodellen “Everything that can be invented has been invented.” — Charles H. Duell, Commissioner, U.S. Office of Patents, 1899

ca4-2 Von Neumann-machine Fysiek zicht Invoer/Uitvoer Geheugen:bau-cellen RAM adres controle data BUS controle klok registers ALU Invoer/Uitvoer Controle klok registers Geheugen CVEadres controle data ALU BUS cache

ca4-3 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-4 Operatorgedeelte R O1 O2 controle c-bit s-bit o-bit z-bit S

ca4-5 s Toestandsbits bij 32-bit optelling R = O1: O2: R: c z-bit = 1 indien resultaat = 0

ca4-6 overflow Overflow o-bit = carry(31) xor carry(30)

ca4-7 Getallencirkel optellen aftrekken

ca4-8 Saturatierekenen Overflow kan ook opgevangen worden door de waarden te plafonneren op de extremen (max) (min)

ca4-9 Saturatierekenen overflow modulo saturatie

ca4-10 Resoluties hoofdbewerkingen Som: n bit + n bit  (n+1) bit Verschil: n bit - n bit  (n+1) bit Product: n bit * n bit  (2n) bit Deling: n bit / n bit  n bit

ca4-11 Optelling add doel, bron 00B A … C eax ebx add eax, ebx add eax, 10h add eax, [4] soczsocz Alle waarden zijn hexadecimaal! Instructie:add

ca4-12 Aftrekking sub doel, bron 00B A … C eax ebx 0091C BFF0 sub eax, ebx sub eax, 10h sub eax, [4] soczsocz BFF Alle waarden zijn hexadecimaal! Instructie:sub

ca4-13 Integer hoofdbewerkingen add d,s adc d,s sub d,s sbb d,s mul s imul s div s idiv s neg d inc d dec d d = d + s d = d + s + c d = d - s d = d - s - c vermenigvuldiging (unsigned) vermenigvuldiging (signed) deling (unsigned) deling (signed) d = -d d = d + 1 d = d - 1

ca4-14 mov eax,[10h] mov ebx,[14h] add eax,[18h] adc ebx,[1ch] mov [20h],eax mov [24h],ebx 64-bit optelling 10h14h18h1ch20h24h28h ebx [14h]eax [10h] [1ch] [20h][24h] [18h] +

ca4-15 mul & div edx:eax = bron * eax (bin) mul bron eax = edx:eax / bron (bin) edx = edx:eax % bron div bron edx:eax = bron * eax (2c) imul bron deeltal = quotiënt * deler + rest en rest * deeltal ≥ 0. Instructie:mul Instructie:div

ca4-16 imul: 3 varianten edx:eax = bron * eax imul bron d = d * bron imul d,bron d = bron1 * bron2 imul d,bron1,bron2

ca4-17 Product in helften b.v. Alpha (64 bit) reg[c]:=(reg[a]*reg[b]) mulq a,b,c umulh a,b,c bits n1 tot n2 (neerwaarts genummerd)

ca4-18 Deling Indien deling door een constante, kan dit ook door vermenigvuldiging, b.v. deling door 15 X/15=X*(1/15) 1/15 = … 2 = /15 = * = /15 = 002D 16 * =0002.FFFD 16

ca4-19 Vergelijkingen cmp d,s test d,s d-s  vlaggen d ‘and’ s  vlaggen cmp: vergelijken van waarden: >, =, < test: testen van bits: aan, uit cmp: vergelijken van waarden: >, =, < test: testen van bits: aan, uit Instructie:cmdInstructie:test

ca ? c Natuurlijke getallen (binair) anbe(c or z) == 0above aenbc == 0above or equal bnaec == 1below bena(c or z) == 1below or equal anbe(c or z) == 0above aenbc == 0above or equal bnaec == 1below bena(c or z) == 1below or equal binair

ca ? ? o == 1 o == 0 s == 1s == 0 Gehele getallen (2-complement) gnle((s xor o) or z) == 0 greater genl(s xor o) == 0greater or equal lnge(s xor o) == 1less leng((s xor o) or z) == 1less or equal gnle((s xor o) or z) == 0 greater genl(s xor o) == 0greater or equal lnge(s xor o) == 1less leng((s xor o) or z) == 1less or equal 2-comp

ca4-22 Conditiecodes zz == 1zero cc == 1carry oo == 1overflow pp == 1parity ss == 1sign nzz == 0no zero ncc == 0no carry noo == 0no overflow npp == 0no parity nss == 0 no sign gnle((s xor o) or z) == 0 greater genl(s xor o) == 0greater or equal lnge(s xor o) == 1less leng((s xor o) or z) == 1less or equal ez == 1equal nez == 0not equal anbe(c or z) == 0above aenbc == 0above or equal bnaec == 1below bena(c or z) == 1below or equal zz == 1zero cc == 1carry oo == 1overflow pp == 1parity ss == 1sign nzz == 0no zero ncc == 0no carry noo == 0no overflow npp == 0no parity nss == 0 no sign gnle((s xor o) or z) == 0 greater genl(s xor o) == 0greater or equal lnge(s xor o) == 1less leng((s xor o) or z) == 1less or equal ez == 1equal nez == 0not equal anbe(c or z) == 0above aenbc == 0above or equal bnaec == 1below bena(c or z) == 1below or equal binair 2-comp

ca4-23 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-24 Logische Operaties and d,s or d,s xor d,s not d d = d ‘and’ s d = d ‘or’ s d = d ‘xor’ s d = ‘not’ d

ca4-25 Verschuivingen shl d,n shr d,n sal d,n sar d,n shld d,s,n shrd d,s,n rol d,n ror d,n rcl d,n rcr d,n shl d,n shr d,n sal d,n sar d,n shld d,s,n shrd d,s,n rol d,n ror d,n rcl d,n rcr d,n d = d << n d = d >> n aritmetisch d = d << n aritmetisch d = d >> n d = (d:s d = (s:d >> n) bitrotatie naar links bitrotatie naar rechts uitgebreide bitrotatie naar links uitgebreide bitrotatie naar rechts

ca4-26 Schuifoperaties C=1 C= Schuif 1 positie naar links Schuif 5 posities naar links Instructie: schuifoperatie

ca4-27 Schuifoperaties C 0 SHL C SAR C 0 SHR C 0 SAL

ca4-28 Schuifoperaties D C SHLD S S C SHRD D

ca4-29 Rotatieoperaties C ROL C ROR C RCL C RCR Instructie: rotatieoperatie

ca4-30 Schuifoperaties: logisch links 1  x rechts 1   2 links n  x 2 n rechts n   2 n

ca4-31 Schuifoperaties: aritmetisch links 1  x rechts 1   rechts 1   2

ca4-32 Oefening sal 2 sar shl 2 shr

ca4-33 Voorbeeld mov eax, [10] mov ebx, eax shl ebx, 3 shl eax, 5 add eax, ebx add eax, 10 mov [14], eax ; reg[eax] := ‘i’*8+’i’*32+10 ; reg[eax] := ‘i’*8+’i’*32 ; reg[eax] := ‘i’*32 ; reg[ebx] := ‘i’*8 ; reg[ebx] := ‘i’ ; reg[eax] := mem32[i] j := i*40+10 ; mem32[j] := reg[eax]

ca4-34 Product door verschuivingen x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x x2+x1 x4 x4+x1 x4+x2 x8-x1 x8 x8+x1 x8+x2 x8+x2+x1 x8+x4 x4-x1 x8-x2 x16-x4-x1 x16-x4

ca4-35 Verschuivingen x 57 = x64 - x8 + x1 x 113 = x128 - x16 + x1 Soms combinatie van de twee:

ca4-36 Bit test instructies bt d, o bts d, o btr d, o btc d, o bt d, o bts d, o btr d, o btc d, o c = d c = d ; d = 1 c = d ; d = 0 c = d ; d = d Instructie: bitoperaties

ca4-37 Bit scan instructies bsf d, s bsr d, s bsf d, s bsr d, s d = minst significante 1-bit d = meest significante 1-bit d = index van bit, neerwaarts genummerd Indien allemaal 0: d = onbepaald, z=1

ca4-38 Set byte on condition set d d = conditiecode setge al seto ah setge al seto ah reg[al] = ge ? 1 : 0 reg[ah] = o ? 1 : 0 setno al dec al setno al dec al reg[al] = o ? 0ffh : 00h

ca4-39 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-40 Vlottende-komma- registerverzameling sexpmantisse st st(1) st(2) st(3) st(7) st(6) st(5) st(4) Registers: vlottende-komma

ca4-41 Datatypes FP Enkelvoudige precisie (32 bit) FP Dubbele precisie (64 bit) FP Dubbele extended precisie (80 bit) Integer woord (16 bit) Integer dubbelwoord (32 bit) Integer quadwoord (64 bit) BCD 18 nibbles + tekenbyte (80 bit)

ca4-42 Zuivere stapeladressering fadd st(1) = st+st(1); pop Registeradressering fadd st(i) st = st+st(i) fadd st(i),st st(i) = st+st(i) fadd st,st(i) st = st(i)+st faddp st(i),st st(i) = st+st(i); pop Geheugenadressering fadd st = st+mem[ae] Adresseermodes

ca4-43 Vlottende-kommabewerkingen fadd fsub fdiv fprem fmul fabs fchs fcomi fadd fsub fdiv fprem fmul fabs fchs fcomi FP optelling verschil deling rest na deling vermenigvuldiging absolute waarde st = abs(st) negatiest = - st FP compare and set eflags

ca4-44 Wiskundige functies fsqrt fsin fcos fptan fpatan fyl2x fyl2xp1 f2xm1 fsqrt fsin fcos fptan fpatan fyl2x fyl2xp1 f2xm1 vierkantswortel sinus cosinus tangens arcus tangens logaritme st(1) = st(1)*log 2 (st); pop logaritme st(1) = st(1)*log 2 (st+1); pop exponent st = 2 st -1

ca4-45 Load-store operaties fbld fbstp fild fist fld fst fbld fbstp fild fist fld fst Load/push BCD-getal (ld=load) Store BCD and pop Load/push integer 16/32/64 bit Store integer 16/32/64 bit Load/push floating point value 32/64/80 bit Store floating point value 32/64/80 bit

ca4-46 Load constant fld1 fldl2t fldl2e fldpi fldlg2 fldln2 fldz fld1 fldl2t fldl2e fldpi fldlg2 fldln2 fldz push 1.0 push log 2 10 push log 2 e push π push log 10 2 push log e 2 push +0.0

ca4-47 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-48 Aanleiding Multimedia-applicaties en het web –Beeld (10 kiB) –Geluid (100 kiB) –Video (MiB). Opkomst van 64-bit processors Kleine data-elementen (8 of 16 bit) Zeer veel data-elementen Onafhankelijke data-elementen

ca4-49 Maar bit Oplossing:

ca4-50 Multimedia-extensies Sparc: Visual Instruction Set PA-RISC: MAX-2 X64: MMX, SSE PowerPC: Altivec

ca4-51 MMX: registers 8 MMX-registers van 64 bit (mm0-mm7) Dezelfde registers als ST register geschikt voor de opslag van 8 bytes 4 woorden 2 dubbelwoorden 1 quadwoord Registers: mmx

ca4-52 MMX: Instructies 57 instructies die subwoordparallellisme ondersteunen Voorbeeld: –acht 8-bit optellingen in parallel –vier 16-bit optellingen in parallel –twee 32-bit optellingen in parallel –één 64-bit optelling

ca4-53 Instructies paddb paddw paddd paddq padds[b/w] paddus[b/w] psubb psubw psubd psubq psubs[b/w] psubus[b/w]

ca4-54 paddb paddb mm0,mm1 mm mm1 mm0

ca4-55 paddd paddd mm0,mm1 mm0 + + mm1 mm0

ca4-56 Instructies abc d efg h (a*e).l(b*f).l(c*g).l (d*h).l pmullw (a*e).h(b*f).h(c*g).h (d*h).h pmulhw a*e+b*fc*g+d*h pmaddwd

ca4-57 pcmpeqd pcmpeqd mm0,mm1 FF FFFF 00 FF FF mm0 Andere:pcmpeq[b/w/d] pcmpgt[b/w/d] FF FF mm0 FF FFFF mm1

ca4-58 Logische instructies psra[w/d] psll[w/d/q] psrl[w/d/q] pand pandn por pxor psra[w/d] psll[w/d/q] psrl[w/d/q] pand pandn por pxor

ca4-59 Unpack instructies punpckl[bw/wd/dq] punpckh[bw/wd/dq] mm0 punpckhbw mm0,mm1 mm1 mm0

ca4-60 Pack instructies packss[wb/dw] packssdw mm0,mm1 mm0 mm1 mm0 packuswb

ca4-61 Einde van MMX-programma emms empty MMX state

ca4-62 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-63 SSE-extensies Streaming SIMD Extensions: 70 nieuwe instructies 8 extra registers XMM (128 bits lang) Subwoordparallellisme met vlottende- kommagetallen (enkelvoudige precisie) 128 bit

ca4-64 Packed SSE-operaties xmm0 xmm1 xmm0 x3x2x1x0 y3y2y1y0 x3+y3x2+y2x1+y1x0+y0 addps xmm0, xmm1

ca4-65 Scalaire SSE-operaties xmm0 xmm1 xmm0 x3x2x1x0 y3y2y1y0 x3x2x1x0+y0 addss xmm0, xmm1

ca4-66 SSE2-extensies Subwoordparallellisme met vlottende- kommagetallen (dubbele precisie) + integers. 144 nieuwe instructies 8 woorden 4 dubbelwoorden 2 quadwoorden 16 bytes Int FP/Int

ca4-67 Packed SSE2-operaties xmm0 xmm1 xmm0 x1x0 y1y0 x1+y1x0+y0 addpd xmm0, xmm1

ca4-68 Scalaire SSE2-operaties xmm0 xmm1 xmm0 x1x0 y1y0 x1x0+y0 addsd xmm0, xmm1

ca4-69 Shuffle operaties shufps xmm0, xmm1, pat xmm0 xmm1 xmm0 x3x2x1x0 y3y2y1y0 y? x?

ca4-70 SSE3-uitbreidingen haddps xmm0, xmm1 xmm0 xmm1 xmm0 x3x2x1x0 y3y2y1y0 x3+x2x1+x0y3+y2y1+y0 haddps = Horizontal-Add-Packed-Single

SSE4-uitbreidingen 54 bijkomende instructies Zeer gespecialiseerd ca4-71

ca4-72 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-73 nop doe niets Instructie: nop

ca4-74 xadd xadd d,s t = d+s s = d d = t

ca4-75 cmpxchg cmpxchg d,s if (reg[eax]==d) d = s; else reg[eax] = d;

ca4-76 lock-prefix lock add [1000],eax atomaire optelling van eax bij de geheugenlocatie [1000] slechts combineerbaar met een beperkt aantal instructies

ca4-77 set/clear status bits stc clc std cld sti cli stc clc std cld sti cli c = 1 c = 0 d = 1 d = 0 i = 1 i = 0

ca4-78 Overzicht Aritmetische instructies Logische instructies Vlottende-komma-instructies MMX-instructies SSE/SSE2-4-instructies Varia Machinemodellen

ca4-79 Globale machinetypes Stapelmachines Accumulatormachines Registermachines

ca4-80 Stapelmachine O1 O2 R A := (B-C)/D PUSH B PUSH C SUB PUSH D DIV POP A b.v.: hp-calculator Expressiestapel

ca4-81 A := (B-C)/D LOAD B SUB C DIV D STORE A Accumulatormachine ACC R O1 O2 b.v.: klassieke calculator

ca4-82 A := (B-C)/D MOV R1,B MOV R2,C SUB R3,R1,R2 MOV R1,D DIV R2,R3,R1 MOV A,R2 Registermachine O1 O2 R0 R1 R2 R3 R4 R5 R6 R7 R

ca4-83 A := (B-C)/D Registermachine O1 O2 R MOV R1,B SUB R1,C DIV R1,D MOV A,R1 R0 R1 R2 R3 R4 R5 R6 R7

ca4-84 A := (B-C)/D Registermachine O1 O2 R SUB R1,B,C DIV A,R1,D R0 R1 R2 R3 R4 R5 R6 R7

ca4-85 stapelmachine 0-adresmachine - accumulatormachine 1-adresmachine met registeroperand R met geheugenoperand M registermachine 2-adresmachine tot 0 geheugenoperandi RR tot 1 geheugenoperand MR tot 2 geheugenoperandi MM 3-adresmachine tot 0 geheugenoperandi RRR tot 1 geheugenoperand MRR tot 2 geheugenoperandi MMR tot 3 geheugenoperandi MMM Machinetypes

ca4-86 Oefening A := (A+B)*(C+D) Stapel Accu RRR push A push B add push C push D add mul pop A load C add D store T load A add B mul T store A mov R1,A mov R2,B add R1,R2,R1 mov R2,C mov R3,D add R2,R3,R2 mul R1,R2,R1 mov A,R1

ca4-87 Pauze