2017 ARM : (2.11 ) (2.12 ) C (2.13 )

Size: px
Start display at page:

Download "2017 ARM : (2.11 ) (2.12 ) C (2.13 )"

Transcription

1 1 ARM ARM Raspberry Pi 3 ARM 64 C ARM ARMv Hello, world! hello.s Tips LEGv (2.3 ) (2.1 ) (2.4 ) (2.5 ) (2.6 ) (2.7 ) (2.8 ) (2.9 ) (2.10 ) : [email protected], :

2 2017 ARM : (2.11 ) (2.12 ) C (2.13 ) ( 3 ) Introduction (3.1 ) (3.2 ) (3.3 ) (3.4 ) (3.5 ) (3.6 ) A io.s 32 1 ARM *1 CPU SPARC ARM ARM *2 CPU C ARM 1.1 ARM 64 (aarch64) MIPS ( ) (N-body) *1 *2 iphone Apple Ax Android Qualcomm Snapdragon ARM

3 2017 ARM 3 ARM ( SIMD ) MPI 1.2 Raspberry Pi 3 ( ) 1 1 OS 64 bit Arch Linux ARM 64bit CED ARM MPI 1. David A. Patterson, John L. Hennessy. Computer Organization and Design ARM Edition: The Hardware Software Interface. Morgan Kaufmann, ARM Cortex-A Series Programmer s Guide for ARMv8-A Version: ARM Cortex-A53 Processor , CQ. 5. Ananth Grama, et al. Introduction to Parallel Computing. 2nd Edition, Addison Wesley, Linux Arm Exploring AArch64 assember - Chapter The GNU Assembler Using as. GNU as ARM Architecture Reference Manual: ARMv8, for ARMv8-A architecture profile and AMBA Architecture/AR150-DA r0p0-02eac0/DDI0487B a a ARM

4 2017 ARM 4 * *4 SIMD MPI /19 2 6/ /21? SIMD *3 LLVM *4

5 2017 ARM bit linux Arch Linux ARM: 64bit URL Installation # fdisk /dev/sdx linux OS AArch64 Installation 32bit 3. sync Ubuntu sudo su (HHK Pro Ctrl+Command+Fn+1) root sudo bash passwd root export LC ALL=C 2. Ubuntu ps kill 3. sync sync SD 4. umount root mount mount ext4 OS micro SD AC Arch Linux ARCH (tty1) alarm login: root su su Arch Linux pacman [alarm@alarm ~]$ su Password: <root > [alarm@alarm ~]# pacman -Syu < -Syu> : < >

6 2017 ARM 6 [alarm@alarm ~]# 1. /etc/pacman.d/mirrorlist us pacman -Syyu y 2 (yy) 2. linux-aarch64 3. PC USB [alarm@alarm ~]# reboot OS [alarm@alarm ~]$ uname -a Linux alarm ARCH #1 SMP Fri Apr 28 20:02:39 MDT 2017 aarch64 GNU/Linux gcc emacs emacs [alarm@alarm ~]$ su Password: [alarm@alarm ~]# pacman -S gcc : < > [alarm@alarm ~]# pacman -S emacs : < > [alarm@alarm ~]# alarm kobo users kobo [alarm@alarm ~]# useradd -m -g users -s /bin/bash kobo [alarm@alarm ~]# passwd kobo Hello, world 1 hello.c 1 #include<stdio.h> 2 int main(void) 3 {

7 2017 ARM 7 4 printf("hello, world!\n"); 5 return 0; 6 } [kobo@alarm ~]$ gcc -Wall -o hello hello.c [kobo@alarm ~]$./hello Hello, world! [kobo@alarm ~]$ 2.2 CPU ARM Cortex-A53 4 Raspberry Pi 3 is out now! Specs, benchmarks & more Kernel Panic OS

8 2017 ARM 8 3 ARMv8 3.1 Hello, world! Hello world hello/hello.s, hello/io.s io.s *5 hello.s 2 hello.s 1.include "io.s" // include some helper functions 2 3.text 4 5.global _start 6 _start: 7 adr x0, mystring 8 bl print0s 9 10 adr x20, mydword 11 ldur x1, [x20] 12 bl print1d mov x21, # stur x21, [x20] 16 ldur x1, [x20] 17 bl print1d adr x22, mydwords 20 ldur x1, [x22, #0] 21 bl print1d 22 ldur x1, [x22, #8] 23 bl print1d exit data mydword: 30.dword mydwords: 32.dword 125, 126, mystring: 34.string "Hello, world!" [alarm@alarm hello]$ as -o hello.o hello.s [alarm@alarm hello]$ ld -o hello hello.o -lc [alarm@alarm hello]$ *5 io.s

9 2017 ARM 9 [alarm@alarm hello]$./hello Hello, world! [alarm@alarm hello]$ as ld start main gcc [alarm@alarm hello]$ gcc -o hello hello.s [alarm@alarm hello]$ *6 3.2 hello.s hello.s GNU as ARM *7 1 io.s // *8 3.text 22.data.text.data 1 5.global *9 start 6 start C main (:) 7,8 Hello, world! 7 Hello, world!\ n mystring x0 8 print0s bl (branch with link) print0s x0 io.s mydword x20 11 x1 (ldur) 12 x1 print1d x1 *6 start main *7 ARM GNU as *8 *9.globl

10 2017 ARM x1 124 # * x1 mydword (stur) 16 mydword , mydwords x20 20 mydwords 0 mydwords x mydwords x1 8 mydwords exit 27 29, mydword 64.dword (double word) 31,32 64 [125, 126, 127] mydwords (,) 33,34 Hello, world!\n mystring.string * Tips C gcc [alarm@alarm hello]$ gcc -S foo.c foo.c foo.s 3.4 LEGv8 ARM * 12 LEGv8 *10 *11.asciz.ascii *12

11 2017 ARM 11 * 13 LEGv8 LEGv * 14 ( 1) 1 LEGv8 32 X0 X30, XZR XZR Memory[0], Memory[4],, Memory[4,611,686,018,427,387,904] LEGv8 2 8 LEGv8 2 adr mov 2 LEGv8 add ADD X1, X2, X3 X1 = X2 + X3 3 subtract SUB X1, X2, X3 X1 = X2 - X3 3 add immediate ADDI X1, X2, #20 * 15 X1 = X subtract immediate SUBI X1, X2, #20 X1 = X2-20 add and set flags ADDS X1, X2, X3 X1 = X2 + X3 subtract and set flags SUBS X1, X2, X3 X1 = X2 - X3 add immediate and set flags ADDIS X1, X2, #20 X1 = X subtract immediate and set flags SUBIS X1, X2, #20 X1 = X2-20 load register LDUR X1, [X2, #40] X1 = Memory[X2 + 40] store register STUR X1, [X2, #40] Memory[X2 + 40] = X1 load signed word LDURSW X1, [X2, #40] X1 = Memory[X2 + 40] store word STURW X1, [X2, #40] Memory[X2 + 40] = X1 load half LDURH X1, [X2, #40] X1 = Memory[X2 + 40] store half STURH X1, [X2, #40] Memory[X2 + 40] = X1 load byte LDURB X1, [X2, #40] X1 = Memory[X2 + 40] store byte STURB X1, [X2, #40] Memory[X2 + 40] = X1 load exclusive register LDXR X1, [X2, #0] X1 = Memory[X2 + 0] store exclusive register STXR X1, [X2, #0] Memory[X2 + 0] = X1 move wide with zero MOVZ X1, #20, LSL 0 X1 = 20 16bit move wide with keep MOVK X1, #20, LSL 0 X1 = 20 16bit and AND X1, X2, X3 X1 = X2 & X3 AND inclusive or ORR X1, X2, X3 X1 = X2 X3 OR exclusive or EOR X1, X2, X3 X1 = X2 ^ X3 XOR and immediate ANDI X1, X2, #20 X1 = X2 & 20 AND inclusive or immediate ORRI X1, X2, #20 X1 = X2 20 OR exclusive or immediate EORI X1, X2, #20 X1 = X2 ^ 20 XOR logical shift left LSL X1, X2, #10 X1 = X2 << 10 logical shift right LSR X1, X2, #10 X1 = X2 >> 10 compare and branch on equal 0 CBZ X1, #25 * 16 if X1 == 0 goto PC compare and branch on not equal 0 CBNZ X1, #25 if X1!= 0 goto PC branch conditionally B.cond #25 if condition goto PC+100 branch B #2500 goto PC branch to register BR X30 goto X30 branch with link BL #2500 X30 = PC+4; PC += *13 Lessen Extrinsic Garrulity Lessen= Extrinsic = Garrulity = *14 1 = 32

12 2017 ARM (2.3 ) LDUR * 17 STUR * 18 : A=[0, 1, 2, 3, 4] X22 g X9 g = A[3]; LDUR X9, [X22, #24] load.s 1.include "io.s" 2.text 3.global _start 4 _start: 5 adr x22, A // get the address of A 6 ldur x9, [x22, #24] // g = A[3], where 24 = 8 * 3 7 mov x1, x9 // X1 = g for print 8 bl print1d 9 exit data 12 A: 13.dword 0, 1, 2, 3, 4 3 [alarm@alarm ~]$ as -o load.o load.s [alarm@alarm ~]$ ld -o load load.o -lc [alarm@alarm ~]$./load 3 [alarm@alarm ~]$ : A=[0, 1, 2, 3, 4] X22 g X9 A[3] = g; STUR X9, [X22, #24] g 33 *17 (LoaD Register)+ (Unscaled) U 2.19 *18 (STore Register)+ (Unscaled) U

13 2017 ARM 13 4 store.s 1.include "io.s" 2.text 3.global _start 4 _start: 5 adr x22, A // get the address of A 6 mov x9, #33 // g = 33 7 stur x9, [x22, #24] // A[3] = g 8 ldur x1, [x22, #24] // X1 = A[3] 9 bl print1d 10 exit data 13 A: 14.dword 0, 1, 2, 3, 4 [alarm@alarm ~]$ as -o store.o store.s [alarm@alarm ~]$ ld -o store store.o -lc [alarm@alarm ~]$./store 33 [alarm@alarm ~]$ 3.6 (2.1 ) 2 (immediate) ADD SUB 3 : f, g, h, i, j X19,, X23 f = (g + h) - (i + j); ADD X9, X20, X21 // X9 = g + h ADD X10, X22, X23 // X10 = i + j SUB X19, X9, X10 // X19 = X9 - X10 = (g + h) - (i + j) g = 5, h = 4, i = 3, j = 2 5 addsub.s 1.include "io.s" 2.text 3.global _start 4 _start: 5 mov x20, #5 // g = 5 6 mov x21, #4 // h = 4 7 mov x22, #3 // i = 3 8 mov x23, #2 // j = 2 9 add x9, x20, x21 // X9 = g + h 10 add x10, x22, x23 // X10 = i + j 11 sub x19, x9, x10 // X19 = X9 - X10 = (g + h) - (i + j) = f

14 2017 ARM mov x1, x19 // X1 = X19 for print 13 bl print1d 14 exit (5 + 4) (3 + 2) = 4 [alarm@alarm ~]$ as -o addsub.o addsub.s [alarm@alarm ~]$ ld -o addsub addsub.o -lc [alarm@alarm ~]$./addsub 4 [alarm@alarm ~]$ : h X21 A X22 A[4] = h + A[3]; LDUR X9, [X22, #24] // X9 = A[3] ADD X9, X21, X9 // X9 = h + A[3] STUR X9, [X22, #96] // A[4] = h + A[3] h = 33 A[4] = 36 6 addstore.s 1.include "io.s" 2.text 3.global _start 4 _start: 5 adr x22, A // get the address of A 6 mov x21, #33 // h = 33 7 ldur x9, [x22, #24] // X9 = A[3] 8 add x9, x21, x9 // X9 = h + A[3] 9 stur x9, [x22, #32] // A[4] = h + A[3] 10 ldur x1, [x22, #32] // X1 = A[4] 11 bl print1d 12 exit data 15 A: 16.dword 0, 1, 2, 3, 4 [alarm@alarm ~]$ as -o addstore.o addstore.s [alarm@alarm ~]$ ld -o addstore addstore.o -lc [alarm@alarm ~]$./addstore 36 [alarm@alarm ~]$ ADDI ADD

15 2017 ARM 15 ADDI X0, #123 ADD X0, # (2.4 ) 3.8 (2.5 ) LEGv aarch (2.6 ) LEGv8 NOT XOR aarch (2.7 ) CBZ, CBNZ CBZ register, L1 register 0 L1 CBNZ register, L1 register 0 L1 B : if-then-else if (i == j) f = g + h; else f = g - h; f,g,h,i,j X19,,X23 SUB X9, X22, X23 // X9 = i - j CBNZ X9, Else // Go to Else if i!= j (X9!= 0) ADD X19, X20, X21 // f = g + h (skipped if i!= j) B Exit // Go to Exit Else: SUB X19, X20, X21 // f = g - h (skipped if i == j) Exit: 7 if.s

16 2017 ARM 16 1.include "io.s" 2.text 3.global _start 4 _start: 5 mov x20, #5 6 mov x21, #4 7 mov x22, #3 8 mov x23, #2 9 sub x9, x22, x23 10 cbnz x9, Else 11 add x19, x20, x21 12 b Exit 13 Else: 14 sub x19, x20, x21 15 Exit: 16 mov x1, x19 17 bl print1d 18 exit i j 1 [alarm@alarm ~]$ as -o if.o if.s [alarm@alarm ~]$ ld -o if if.o -lc [alarm@alarm ~]$./if 1 [alarm@alarm ~]$ X [alarm@alarm ~]$ as -o if.o if.s [alarm@alarm ~]$ ld -o if if.o -lc [alarm@alarm ~]$./if 9 [alarm@alarm ~]$ while (save[i] == k) i += 1; save k i,k X22, X24 save X25 Loop: LSL X10, X22, #3 // Temp reg X10 = i << 3 = i * 8 ADD X10, X10, X25 // X10 = address of save[i] LDUR X9, [X10, #0] // Temp reg X9 = save[i]] SUB X11, X9, X24 // Temp reg X11 = save[i] - k CBNZ X11, Exit // goto Exit if save[i]!= k ADDI X22, X22, #1 // i += 1; B Loop // goto Loop Exit

17 2017 ARM 17 k = 5 save[] = {5, 5, 5, 5, 1, 5, 5, 5, 5}; 8 loop.s 1.include "io.s" 2.text 3.global _start 4 _start: 5 adr x25, save 6 mov x22, #0 // i = 0 7 mov x24, #5 // k = 5 8 Loop: 9 lsl x10, x22, #3 10 add x10, x10, x25 11 ldur x9, [x10, #0] 12 sub x11, x9, x24 13 cbnz x11, Exit 14 add x22, x22, #1 15 b Loop 16 Exit: 17 mov x1, x22 18 bl print1d 19 exit data 22 save: 23.dword 5, 5, 5, 5, 1, 5, 5, 5, 5 4 [alarm@alarm ~]$ as -o loop.o loop.s [alarm@alarm ~]$ ld -o loop loop.o -lc [alarm@alarm ~]$./loop 4 [alarm@alarm ~]$ 2 ADDS, ADDIS, ANDS, ANDIS, SUBS, SUBIS S set flags 3 B.?? 3 ( ) ( ) = B.EQ B.EQ B.NE B.NE < B.LT B.LO (LOwer) B.LE B.LS (Lower or Same) > B.GT B.HI (HIgher) B.GE B.HS (Higher or Same)

18 2017 ARM (2.8 ) * X0 X7: LR (X30): BL (branch with link) * 20 BL ProcedureAddress ProcedureAddress BR (branch register) BR LR push pop SP X28 * 21 C long long int leaf_example (long long int g, long long int h, long long int i, long long int j) { long long int f; f = (g + h) - (i + j); return f; } *19 *20 branch-and-link instruction ARM *21 SP XZR (X31) XZR SP

19 2017 ARM 19 g, h, i, j X0, X1, X2, X3 f X19 leaf_example: f g + h i + j 2 X9, X10 f X19 3 push SUBI SP, SP, #24 // 3 STUR X10, [SP, #16] // X10 push STUR X9, [SP, #8] // X9 push STUR X19, [SP, #0] // X19 push 3 24 ADD X9, X0, X1 // X9 = g + h ADD X10, X2, X3 // X19 = i + j SUB X19, X9, X10 // f = X9 - X10, which is (g + h) - (i + j) X0 ADD X0, X19, XZR // returns f (X0 = X19 + 0) X9, X10, X19 pop LDUR X19, [SP, #0] LDUR X9, [SP, #8] LDUR X10, [SP, #16] ADDI SP, SP, #24 BR LR X9 X17: ( ) X19 X28: LEGv8 aarch64 ADDI, SUBI ADD, SUB LR X30 16 * 22 1.include "io.s" 9 leaf1.s *22 Programmer s Guide 5-6

20 2017 ARM 20 2.text 3 4.global leaf_example 5 leaf_example: 6 sub sp, sp, #48 7 stur x10, [sp, #32] 8 stur x9, [sp, #16] 9 stur x19, [sp, #0] 10 add x9, x0, x1 11 add x10, x2, x3 12 sub x19, x9, x10 13 add x0, x19, xzr 14 ldur x19, [sp, #0] 15 ldur x9, [sp, #16] 16 ldur x10, [sp, #32] 17 add sp, sp, #48 18 br x global _start 21 _start: 22 mov x0, #5 // g = 5 23 mov x1, #4 // h = 4 24 mov x2, #3 // i = 3 25 mov x3, #2 // j = 2 26 bl leaf_example 27 mov x1, x0 28 bl print1d 29 exit 6 sub sp, sp, #48 7 stur x10, [sp, #32] 8 stur x9, [sp, #16] 9 stur x19, [sp, #0] [alarm@alarm src]$ as -o leaf1.o leaf1.s [alarm@alarm src]$ ld -o leaf1 leaf1.o -lc [alarm@alarm src]$./leaf1 4 [alarm@alarm src]$ LD(U)R, ST(U)R LDP, STP 2 push, pop leaf2.s 10 leaf2.s 1.include "io.s" 2.text 3 4.global leaf_example

21 2017 ARM 21 5 leaf_example: 6 stp x10, x9, [sp, #-16]! 7 stp x19, xzr, [sp, #-16]! 8 add x9, x0, x1 9 add x10, x2, x3 10 sub x19, x9, x10 11 add x0, x19, xzr 12 ldp x19, xzr, [sp], #16 13 ldp x10, x9, [sp], #16 14 ret global _start 17 _start: 18 mov x0, #5 // g = 5 19 mov x1, #4 // h = 4 20 mov x2, #3 // i = 3 21 mov x3, #2 // j = 2 22 bl leaf_example 23 mov x1, x0 24 bl print1d 25 exit stp x10, x9, [sp, #-16]! X10, X9 push 16! * 23 push 3 X19 XZR stp x19, xzr, [sp, #-16]! push pop ldp x19, xzr, [sp], #16 ldp x10, x9, [sp], #16 [alarm@alarm src]$ as -o leaf2.o leaf2.s [alarm@alarm src]$ ld -o leaf2 leaf2.o -lc [alarm@alarm src]$./leaf2 4 [alarm@alarm src]$ bl x30 ret LR *23 Programmer s guide 6-9

22 2017 ARM 22 long long int fact (long long int n) { if (n < 1) return (1); else return (n * fact(n - 1)); } n X0 fact: SUBI SP, SP, #16 // adjust stack for 2 items STUR LR, [SP, #8] // save the return address STUR X0, [SP, #0] // save the argument n SUBIS ZXR, X0, #1 // test for n < 1 B.GE L1 // if n >= 1 go to L1 ADDI X1, XZR, #1 // return 1 ADDI SP, SP, #16 // pop 2 items off stack BR LR // return to caller L1: SUBI X0, X0, #1 // n >= 1: argument gets (n - 1) BL fact // call fact with (n - 1) LDUR X0, [SP, #0] // return from BL: restore argument n LDUR LR, [SP, #8] // restore the return address ADDI SP, SP, #16 // adjust stack pointer to pop 2 items MUL X1, X0, X1 // return n * fact(n - 1) BR LR // return to the caller 11 fact.s 1.include "io.s" 2.text 3 4.global fact 5 fact: 6 stp x30, x0, [sp, #-16]! 7 subs xzr, x0, #1 8 b.ge L1 9 mov x1, #1 10 ldp x30, x0, [sp], #16 11 ret 12 L1: 13 sub x0, x0, #1 14 bl fact 15 ldp x30, x0, [sp], #16 16 mul x1, x0, x1 17 ret global _start 20 _start: 21 mov x0, #10 // n = bl fact 23 bl print1d

23 2017 ARM exit C gcc -O3 -S 12 fact.s 1 : 2 fact: 3 cmp x0, 0 4 mov x1, 1 5 ble.l1 6.p2align 2 7.L3: 8 mul x1, x1, x0 9 subs x0, x0, #1 10 bne.l3 11.L1: 12 mov x0, x1 13 ret 14 : gcc / 4 4 / X19 X27 X28 (SP) X29 (FP) X30 (LR) X9 X15 X0 X7 Elaboration: (ry long long int fact(long long int n) { return fact_iter(n, 1); } long long int fact_iter(long long int n, long long int acc) { if (n > 0) return fact_iter(n - 1, acc * n); else return acc; } : fact (10, 1); :

24 2017 ARM 24 gcc -O3 -S 3.12 (2.9 ) 3.13 (2.10 ) LEGv : (2.11 ) 3.15 (2.12 ) 3.16 C (2.13 ) * 24 swap void swap(long long int v[], size_t k) { long long int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } X0 v X1 k temp X9 swap: lsl x10, x1, #3 // X10 = k * 8 add x10, x0, x10 // X10 = v + (k * 8) // X10 has the address of v[k] ldur x9, [x10, #0] // X9 (temp) = v[k] ldur x11, [x10, #8] // X11 = v[k + 1] // refers to next element of v stur x11, [x10, #0] // v[k] = X11 stur x9, [x10, #8] // v[k + 1] = X9 (temp) ret // return to calling routine void sort (long long int v[], size_t int n) { size_t i, j; *24

25 2017 ARM 25 for (i = 0; i < n; i += 1) { for (j = i-1; j >= 0 && v[j] > v[j+1]; j+= 1) { swap(v, j); } } } mov x19, xzr // i = 0 for1tst: cmp x19, x1 // compare X19 to X1 (i to n) b.ge exit1 // go to exit1 if X19 >= X1 (i>= n) : (body of the first for loop) : add X19, X19, #1 // i += 1 B for1tst // branch to test of outer loop exit1: sub x20, x19, #1 // j = i - 1 for2tst: cmp x20, xzr // compare X20 to 0 (j to 0) b.lt exit2 // go to exit2 if X20 < 0 (j < 0) lsl x10, x20, #3 // X10 = j * 8 add x11, x0, x10 // X11 = v + (j * 8) ldur x12, [x11, #0] // X12 = v[j] ldur x13, [x11, #8] // X13 = v[j + 1] cmp x12, x13 b.le exit2 // go to if X12 <= X13 (v[j] <= v[j + 1) : (body of the second for loop) : sub x20, x20, #1 // j -= 1 b for2tst exit2: swap(v,j) bl swap X0, X1 swap sort X21, X22 sort X0, X1 swap sort SP, LR, X19 X21 * 25 * LDUR STUR

26 2017 ARM 26 * 26 1 #include<stdio.h> 2 3 void swap(long long int v[], size_t k) 4 { 5 long long int temp; 6 temp = v[k]; 7 v[k] = v[k-1]; 8 v[k-1] = temp; 10 9 } 11 void sort(long long int v[], size_t n) 12 { 13 size_t i, j; 14 for(i = 0; i < n; i+=1){ 15 for(j = 1; j < n-i; j+=1){ 16 if (v[j] < v[j-1]){ 17 swap(v, j); 18 } 19 } 20 } 21 } int main(void) 24 { 25 int i; 13 sort.c 26 long long int v[] = {1, 3, 5, 7, 9, 8, 6, 4, 2, 0}; 27 size_t n = 10; 28 sort(v, n); 29 for(i = 0; i < n; i++){ 30 printf("%d\n", v[i]); 31 } 32 return 0; 33 } 1.include "io.s" 2.text 3 4 swap: 5 lsl x10, x1, #3 6 add x10, x0, x ldur x9, [x10, #0] 9 ldur x11, [x10, #-8] 14 sort.s *26 swap for swap i v n

27 2017 ARM stur x11, [x10, #0] 12 stur x9, [x10, #-8] 13 ret global sort 16 sort: 17 stp xzr, x30, [sp, #-16]! 18 stp x22, x21, [sp, #-16]! 19 stp x20, x19, [sp, #-16]! mov x21, x0 // preserve x0 to x21 22 mov x22, x1 // preserve x1 to x // outer loop 25 mov x19, xzr 26 for1tst: 27 cmp x19, x22 28 b.ge exit1 29 // : inner loop 30 mov x20, #1 31 for2tst: 32 sub x9, x22, x19 // X9 = n - i 33 cmp x20, x9 // j < n-i? 34 b.ge exit2 35 // : body of the inner loop 36 iftst: 37 lsl x10, x20, #3 38 add x11, x21, x10 39 ldur x12, [x11, #0] 40 ldur x13, [x11, #-8] 41 cmp x12, x13 // v[j] >= v[j-1]? 42 b.ge exitif 43 mov x0, x21 // first swap parameter is v 44 mov x1, x20 // second swap parameter is j 45 bl swap 46 exitif: 47 // : 48 add x20, x20, #1 49 b for2tst 50 exit2: 51 // : 52 add x19, x19, #1 53 b for1tst 54 exit1: 55 ldp x20, x19, [sp], ldp x22, x21, [sp], ldp xzr, x30, [sp], ret global _start 61 _start:

28 2017 ARM adr x0, v 63 adr x20, k 64 ldur x1, [x20, #0] 65 bl sort // print sorted numbers 68 adr x19, v 69 mov x20, xzr 70 adr x21, k 71 ldur x21, [x21, #0] 72 lsl x21, x21, #3 73 for3tst: 74 cmp x20, x21 75 b.ge exit3 76 add x22, x19, x20 77 ldur x1, [x22, #0] 78 bl print1d 79 add x20, x20, #8 80 b for3tst 81 exit3: 82 exit data 85 v:.dword 1, 3, 5, 7, 9, 8, 6, 4, 2, 0 86 k:.dword ( 3 ) 3.19 Introduction (3.1 ) 3.20 (3.2 ) 2 ALU 3.21 (3.3 ) 2 MUL, SMULH (signed multiply high), UMULH (unsigned multiply high) MUL (3.4 ) 2 SDIV (signed), UDIV (unsigned) 5

29 2017 ARM (3.5 ) IEEE F 6 7 : C float f2c (float fahr) { return ((5.0/9.0) * (fahr )); } fahr S12 S include "io.s" 2.text 3 f2c: 4 adr x27, const5 5 ldr s16, [x27] // S16 = adr x27, const9 7 ldr s18, [x27] // S18 = 9.0 f2c.s 5 LEGv MUL X1, X2, X3 X1 = X2 X SMULH X1, X2, X3 X1 = X2 X UMULH X1, X2, X3 X1 = X2 X SDIV X1, X2, X3 X1 = X2/X3 UDIV X1, X2, X3 X1 = X2/X3 6 LEGv8 p S0 S31, D0 D31, S? D? Memory[0], Memory[4],, Memory[4,611,686,018,427,387,904] LEGv LEGv8 p221 FP add single FADDS S2, S4, S6 S2 = S4 + S6 FP add (single precision) FP subtract single FSUBS S2, S4, S6 S2 = S4 - S6 FP sub (single precision) FP multiply single FMULS S2, S4, S6 S2 = S4 S6 FP multiply (single precision) FP divide single FDIVS S2, S4, S6 S2 = S4 / S6 FP divide (single precision) FP add double FADDD D2, D4, D6 S2 = S4 + S6 FP add (double precision) FP subtract double FSUBD D2, D4, D6 S2 = S4 - S6 FP sub (double precision) FP multiply double FMULD D2, D4, D6 S2 = S4 S6 FP multiply (double precision) FP divide double FDIVD D2, D4, D6 S2 = S4 / S6 FP divide (double precision) FP compare single FCMPS S4, S6 Test S4 vs S6 FP compare single precision FP compare double FCMPD D4, S6 Test D4 vs D6 FP compare double precision load single FP LDURS S1, [X23, #100] S1 = Memory[X ] 32-bit data to FP register load double FP LDURD D1, [X23, #100] D1 = Memory[X ] 64-bit data to FP register store single FP STURS S1, [X23, #100] Memory[X ] = S1 32-bit data to memory store double FP STURD D1, [X23, #100] Memory[X ] = D1 64-bit data to memory

30 2017 ARM 30 8 fdiv s16, s16, s18 // S16 = 5.0 / adr x27, const32 10 ldr s18, [x27] // S18 = fsub s18, s12, s18 // S18 = fahr fmul s0, s16, s18 // S0 = (5.0/9.0) * (fahr ) 13 ret global _start 16 _start: 17 adr x27, input 18 ldr s12, [x27] // S12 = bl f2s 20 bl print0fs 21 exit data 24 input: 25.float const5: 27.float const9: 29.float const32: 31.float 32.0 fadds, faddd fadd ldr, str (Programmer s Guide 6-13) immediate mov io.s print0f, print0fs D0 S0 : 2 A, B, C C = C + A B DGEMM void mm (double c[][], double a[][], double b[][]) { size_t i, j, k; for(i = 0; i < 32; i++) { for(j = 0; j < 32; j++){ for(k = 0; k < 32; k++){ c[i][j] = c[i][j] + a[i][k]*b[k][j]; } } } } X1, X2, X3 X19, X20, X21 * 27 TODO: TY: *27

31 2017 ARM (3.6 ) SIMD TODO:

32 2017 ARM 32 A io.s 16 io.s 1 // Learned and modified from: 2 // 3.text 4 5 // macro 6 // exit 7.macro exit 8.exit\@: 9 mov x8, #93 // exit see /usr/include/asm-generic/unistd.h 10 svc #0 11.endm text 14.global print1d 15.type print1d, %function 16 print1d: 17 stp x29, x30, [sp, #-16]! 18 adr x0, print1d_fmt 19 bl printf 20 ldp x29, x30, [sp], #16 21 ret 22.data 23 print1d_fmt:.string "%d\n" text 26.global print0f 27.type print0f, %function 28 print0f: 29 stp x29, x30, [sp, #-16]! 30 adr x0, print0f_fmt 31 bl printf 32 ldp x29, x30, [sp], #16 33 ret 34.global print0fs 35.type print0fs, %function 36 print0fs: 37 stp x29, x30, [sp, #-16]! 38 adr x0, print0f_fmt 39 fcvt d0, s0 40 bl printf 41 ldp x29, x30, [sp], #16 42 ret 43.data 44 print0f_fmt:.string "%f\n" text 47.global print0s

33 2017 ARM type print0s, %function 49 print0s: 50 stp x29, x30, [sp, #-16]! 51 bl puts 52 ldp x29, x30, [sp], #16 53 ret

3 SIMPLE ver 3.2: SIMPLE (SIxteen-bit MicroProcessor for Laboratory Experiment) 1 16 SIMPLE SIMPLE 2 SIMPLE 2.1 SIMPLE (main memo

3 SIMPLE ver 3.2: SIMPLE (SIxteen-bit MicroProcessor for Laboratory Experiment) 1 16 SIMPLE SIMPLE 2 SIMPLE 2.1 SIMPLE (main memo 3 SIMPLE ver 3.2: 20190404 1 3 SIMPLE (SIxteen-bit MicroProcessor for Laboratory Experiment) 1 16 SIMPLE SIMPLE 2 SIMPLE 2.1 SIMPLE 1 16 16 (main memory) 16 64KW a (C )*(a) (register) 8 r[0], r[1],...,

More information

main.dvi

main.dvi 20 II 7. 1 409, 3255 e-mail: [email protected] 2 1 1 1 4 2 203 2 1 1 1 5 503 1 3 1 2 2 Web http://www.icsd2.tj.chiba-u.jp/~namba/lecture/ 1 2 1 5 501 1,, \,", 2000 7. : 1 1 CPU CPU 1 Intel Pentium

More information

Microsoft PowerPoint - NxLecture ppt [互換モード]

Microsoft PowerPoint - NxLecture ppt [互換モード] 011-05-19 011 年前学期 TOKYO TECH 命令処理のための基本的な 5 つのステップ 計算機アーキテクチャ第一 (E) 5. プロセッサの動作原理と議論 吉瀬謙二計算工学専攻 kise_at_cs.titech.ac.jp W61 講義室木曜日 13:0-1:50 IF(Instruction Fetch) メモリから命令をフェッチする. ID(Instruction Decode)

More information

ARM gcc Kunihiko IMAI 2009 1 11 ARM gcc 1 2 2 2 3 3 4 3 4.1................................. 3 4.2............................................ 4 4.3........................................

More information

.,. 0. (MSB). =2, =1/2.,. MSB LSB, LSB MSB. MSB 0 LSB 0 0 P

.,. 0. (MSB). =2, =1/2.,. MSB LSB, LSB MSB. MSB 0 LSB 0 0 P , 0 (MSB) =2, =1/2, MSB LSB, LSB MSB MSB 0 LSB 0 0 P61 231 1 (100, 100 3 ) 2 10 0 1 1 0 0 1 0 0 100 (64+32+4) 2 10 100 2 5, ( ), & 3 (hardware), (software) (firmware), hardware, software 4 wired logic

More information

[1] #include<stdio.h> main() { printf("hello, world."); return 0; } (G1) int long int float ± ±

[1] #include<stdio.h> main() { printf(hello, world.); return 0; } (G1) int long int float ± ± [1] #include printf("hello, world."); (G1) int -32768 32767 long int -2147483648 2147483647 float ±3.4 10 38 ±3.4 10 38 double ±1.7 10 308 ±1.7 10 308 char [2] #include int a, b, c, d,

More information

Nios IIプロセッサ・リファレンス・ハンドブック、セクション I. Nios IIプロセッサ Ver. 1.2

Nios IIプロセッサ・リファレンス・ハンドブック、セクション I. Nios IIプロセッサ Ver. 1.2 I. Nios II Nios II 1 2 3 4 SOPC Builder Nios II Altera Corporation I 1 Nios II 1 4 Nios II Nios II / 1 2004 9 v1.1 Nios II 1.01 2004 5 v1.0 2 2004 12 v1.2 ctl5 2004 9 v1.1 Nios II 1.01 2004 5 v1.0 3 2004

More information

C言語によるアルゴリズムとデータ構造

C言語によるアルゴリズムとデータ構造 Algorithms and Data Structures in C 4 algorithm List - /* */ #include List - int main(void) { int a, b, c; int max; /* */ Ÿ 3Ÿ 2Ÿ 3 printf(""); printf(""); printf(""); scanf("%d", &a); scanf("%d",

More information

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf("hello World\n"); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o

18 C ( ) hello world.c 1 #include <stdio.h> 2 3 main() 4 { 5 printf(hello World\n); 6 } [ ] [ ] #include <stdio.h> % cc hello_world.c %./a.o 18 C ( ) 1 1 1.1 hello world.c 5 printf("hello World\n"); 6 } [ ] [ ] #include % cc hello_world.c %./a.out Hello World [a.out ] % cc hello_world.c -o hello_world [ ( ) ] (K&R 4.1.1) #include

More information

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v

/* do-while */ #include <stdio.h> #include <math.h> int main(void) double val1, val2, arith_mean, geo_mean; printf( \n ); do printf( ); scanf( %lf, &v 1 http://www7.bpe.es.osaka-u.ac.jp/~kota/classes/jse.html [email protected] /* do-while */ #include #include int main(void) double val1, val2, arith_mean, geo_mean; printf( \n );

More information

導入基礎演習.ppt

導入基礎演習.ppt Multi-paradigm Programming Functional Programming Scheme Haskell ML Scala X10 KL1 Prolog Declarative Lang. C Procedural Lang. Java C++ Python Object-oriented Programming / (root) bin home lib 08 09

More information

Ⅰ Report#1 Report#1 printf() /* Program : hello.c Student-ID : 095740C Author UpDate Comment */ #include int main(){ : Yuhi,TOMARI : 2009/04/28(Thu) : Used Easy Function printf() 10 printf("hello,

More information

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved (Version: 2013/5/16) Intel CPU ([email protected]) 1 Intel CPU( AMD CPU) 64bit SIMD Inline Assemler Windows Visual C++ Linux gcc 2 FPU SSE2 Intel CPU double 8087 FPU (floating point number processing unit)

More information

r03.dvi

r03.dvi 19 ( ) 019.4.0 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void... argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0 a a \0 b b b \0 c c c \0 1: // argdemo1.c ---

More information

Raspberry Pi3 / arm64 - Debian/Ubuntu ミートアップ in 札幌

Raspberry Pi3 / arm64 - Debian/Ubuntu ミートアップ in 札幌 Raspberry Pi3 / arm64 Debian/Ubuntu in 2016 6 17 : @iwamatsu Debian Project Official Developer Debian : Debian linux kernel, Debian Bluetooth, Debian Science (OpenCV), Erlang, Debian Go : Linux kernel

More information

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV [email protected] [email protected] http://www.misojiro.t.u-tokyo.ac.jp/ tutimura/sem3/ 2002 11 20 p.1/34 10/16 1. 10/23 2. 10/30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20

More information

Raspberry Pi 2 Model B に Debian Jessie / armhf をインストールする - 第125回 2015年3月度

Raspberry Pi 2 Model B に Debian Jessie / armhf をインストールする - 第125回 2015年3月度 Raspberry Pi 2 Model B Debian Jessie / armhf 125 2015 3 2015 3 7 1 Raspberry Pi 2 Model B Raspberry Pi 2 Raspberry Pi 2 Model B Debian Jessie / armhf Raspberry Pi 2 Model B Raspberry Pi Raspberry Pi 2

More information

ohp03.dvi

ohp03.dvi 19 3 ( ) 2019.4.20 CS 1 (comand line arguments) Unix./a.out aa bbb ccc ( ) C main void int main(int argc, char *argv[]) {... 2 (2) argc argv argc ( ) argv (C char ) ( 1) argc 4 argv NULL. / a. o u t \0

More information

r07.dvi

r07.dvi 19 7 ( ) 2019.4.20 1 1.1 (data structure ( (dynamic data structure 1 malloc C free C (garbage collection GC C GC(conservative GC 2 1.2 data next p 3 5 7 9 p 3 5 7 9 p 3 5 7 9 1 1: (single linked list 1

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) { double

More information

ohp07.dvi

ohp07.dvi 19 7 ( ) 2019.4.20 1 (data structure) ( ) (dynamic data structure) 1 malloc C free 1 (static data structure) 2 (2) C (garbage collection GC) C GC(conservative GC) 2 2 conservative GC 3 data next p 3 5

More information

コンピュータ概論

コンピュータ概論 4.1 For Check Point 1. For 2. 4.1.1 For (For) For = To Step (Next) 4.1.1 Next 4.1.1 4.1.2 1 i 10 For Next Cells(i,1) Cells(1, 1) Cells(2, 1) Cells(10, 1) 4.1.2 50 1. 2 1 10 3. 0 360 10 sin() 4.1.2 For

More information

橡Pascal-Tの挙動を調べる

橡Pascal-Tの挙動を調べる PROGRAM SAMPLE01(INPUT, OUTPUT); BEGIN END. PROGRAM SAMPLE02(INPUT, OUTPUT); VAR X, Y, Z : INTEGER; BEGIN X := 1; Y := 2; Z := X + Y; WRITELN(Z); END. #!/usr/local/bin/perl #PASCAL-T OBJECT MAC FILE

More information

アセンブラ入門(CASL II) 第3版

アセンブラ入門(CASL II) 第3版 CASLDV i COMET II COMET II CASL II COMET II 1 1 44 (1969 ) COMETCASL 6 (1994 ) COMETCASL 13 (2001 ) COMETCASL COMET IICASL II COMET IICASL II CASL II 2001 1 3 3 L A TEX 2 CASL II COMET II 6 6 7 Windows(Windows

More information

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * *

I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) + x * x + x x (4) * * 2015 2015 07 30 10:30 12:00 I. I VI II. III. IV. a d V. VI. 80 100 60 1 I. Backus-Naur BNF S + S S * S S x S +, *, x BNF S (parse tree) : * x + x x S * S x + S S S x x (1) * x x * x (2) * + x x x (3) +

More information

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player jp/download/player/ URL VMware Plaeyr VMware

2 1. Ubuntu 1.1 OS OS OS ( OS ) OS ( OS ) VMware Player VMware Player   jp/download/player/ URL VMware Plaeyr VMware 1 2010 [email protected] http://www.jsk.t.u-tokyo.ac.jp/~k-okada/lecture/ 2010 4 5 Linux 1 Ubuntu Ubuntu Linux 1 Ubuntu Ubuntu 3 1. 1 Ubuntu 2. OS Ubuntu OS 3. OS Ubuntu https://wiki.ubuntulinux.jp/ubuntutips/install/installdualboot

More information

ex05_2012.pptx

ex05_2012.pptx 2012 年度計算機システム演習第 5 回 2012.05.25 高水準言語 (C 言語 ) アセンブリ言語 (MIPS) 機械語 (MIPS) コンパイラ アセンブラ 今日の内容 サブルーチンの実装 Outline } ジャンプ 分岐命令 } j, jr, jal } レジスタ衝突 回避 } caller-save } callee-save 分岐命令 ( 復習 ) } j label } Jump

More information

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL 2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b

(2 Linux Mozilla [ ] [ ] [ ] [ ] URL   2 qkc, nkc ~/.cshrc (emacs 2 set path=($path /usr/meiji/pub/linux/bin tcsh b II 5 (1 2005 5 26 http://www.math.meiji.ac.jp/~mk/syori2-2005/ UNIX (Linux Linux 1 : 2005 http://www.math.meiji.ac.jp/~mk/syori2-2005/jouhousyori2-2005-00/node2. html ( (Linux 1 2 ( ( http://www.meiji.ac.jp/mind/tool/internet-license/

More information

Microsoft Word - C.....u.K...doc

Microsoft Word - C.....u.K...doc C uwêííôöðöõ Ð C ÔÖÐÖÕ ÐÊÉÌÊ C ÔÖÐÖÕÊ C ÔÖÐÖÕÊ Ç Ê Æ ~ if eíè ~ for ÒÑÒ ÌÆÊÉÉÊ ~ switch ÉeÍÈ ~ while ÒÑÒ ÊÍÍÔÖÐÖÕÊ ~ 1 C ÔÖÐÖÕ ÐÊÉÌÊ uê~ ÏÒÏÑ Ð ÓÏÖ CUI Ô ÑÊ ÏÒÏÑ ÔÖÐÖÕÎ d ÈÍÉÇÊ ÆÒ Ö ÒÐÑÒ ÊÔÎÏÖÎ d ÉÇÍÊ

More information

Java updated

Java updated Java 2003.07.14 updated 3 1 Java 5 1.1 Java................................. 5 1.2 Java..................................... 5 1.3 Java................................ 6 1.3.1 Java.......................

More information

I I / 47

I I / 47 1 2013.07.18 1 I 2013 3 I 2013.07.18 1 / 47 A Flat MPI B 1 2 C: 2 I 2013.07.18 2 / 47 I 2013.07.18 3 / 47 #PJM -L "rscgrp=small" π-computer small: 12 large: 84 school: 24 84 16 = 1344 small school small

More information

joho07-1.ppt

joho07-1.ppt 0xbffffc5c 0xbffffc60 xxxxxxxx xxxxxxxx 00001010 00000000 00000000 00000000 01100011 00000000 00000000 00000000 xxxxxxxx x y 2 func1 func2 double func1(double y) { y = y + 5.0; return y; } double func2(double*

More information

ストリーミング SIMD 拡張命令2 (SSE2) を使用した、倍精度浮動小数点ベクトルの最大/最小要素とそのインデックスの検出

ストリーミング SIMD 拡張命令2 (SSE2) を使用した、倍精度浮動小数点ベクトルの最大/最小要素とそのインデックスの検出 SIMD 2(SSE2) / 2.0 2000 7 : 248602J-001 01/10/30 1 305-8603 115 Fax: 0120-47-8832 * Copyright Intel Corporation 1999-2001 01/10/30 2 1...5 2...5 2.1...5 2.1.1...5 2.1.2...8 3...9 3.1...9 3.2...9 4...9

More information

ex01.dvi

ex01.dvi ,. 0. 0.0. C () /******************************* * $Id: ex_0_0.c,v.2 2006-04-0 3:37:00+09 naito Exp $ * * 0. 0.0 *******************************/ #include int main(int argc, char **argv) double

More information

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved

64bit SSE2 SSE2 FPU Visual C++ 64bit Inline Assembler 4 FPU SSE2 4.1 FPU Control Word FPU 16bit R R R IC RC(2) PC(2) R R PM UM OM ZM DM IM R: reserved (Version: 2013/7/10) Intel CPU ([email protected]) 1 Intel CPU( AMD CPU) 64bit SIMD Inline Assemler Windows Visual C++ Linux gcc 2 FPU SSE2 Intel CPU double 8087 FPU (floating point number processing unit)

More information

pptx

pptx iphone 2010 8 18 C [email protected] C Hello, World! Hello World hello.c! printf( Hello, World!\n );! os> ls! hello.c! os> cc hello.c o hello! os> ls! hello!!hello.c! os>./hello! Hello, World!! os>! os>

More information

gusa: Simple and Efficient User Space Atomicity Emulation with Little Kernel Modification g (AIST) , gusa( g User Space Ato

gusa: Simple and Efficient User Space Atomicity Emulation with Little Kernel Modification g (AIST) , gusa( g User Space Ato gusa: Simple and Efficient User Space Atomicity Emulation with Little Kernel Modification g (AIST) 2002 9 19, gusa( g User Space Atomicity),, gusa,, gusa, General ( ), Generic ( ), Gentle

More information

C

C C 1 2 1.1........................... 2 1.2........................ 2 1.3 make................................................ 3 1.4....................................... 5 1.4.1 strip................................................

More information

OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a))

OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a)) OpenMP (1) 1, 12 1 UNIX (FUJITSU GP7000F model 900), 13 1 (COMPAQ GS320) FUJITSU VPP5000/64 1 (a) (b) 1: ( 1(a)) E-mail: {nanri,amano}@cc.kyushu-u.ac.jp 1 ( ) 1. VPP Fortran[6] HPF[3] VPP Fortran 2. MPI[5]

More information

Microsoft PowerPoint - Lecture ppt [互換モード]

Microsoft PowerPoint - Lecture ppt [互換モード] 2012-05-31 2011 年前学期 TOKYO TECH 固定小数点表現 計算機アーキテクチャ第一 (E) あまり利用されない 小数点の位置を固定する データ形式 (2) 吉瀬謙二計算工学専攻 kise_at_cs.titech.ac.jp W641 講義室木曜日 13:20-14:50-2.625 符号ビット 小数点 1 0 1 0 1 0 1 0 4 2 1 0.5 0.25 0.125

More information

tuat1.dvi

tuat1.dvi ( 1 ) http://ist.ksc.kwansei.ac.jp/ tutimura/ 2012 6 23 ( 1 ) 1 / 58 C ( 1 ) 2 / 58 2008 9 2002 2005 T E X ptetex3, ptexlive pt E X UTF-8 xdvi-jp 3 ( 1 ) 3 / 58 ( 1 ) 4 / 58 C,... ( 1 ) 5 / 58 6/23( )

More information

listings-ext

listings-ext (6) Python (2) ( ) [email protected] 5 Python (2) 1 5.1 (statement)........................... 1 5.2 (scope)......................... 11 5.3 (subroutine).................... 14 5 Python (2) Python 5.1

More information

超初心者用

超初心者用 3 1999 10 13 1. 2. hello.c printf( Hello, world! n ); cc hello.c a.out./a.out Hello, world printf( Hello, world! n ); 2 Hello, world printf n printf 3. ( ) int num; num = 100; num 100 100 num int num num

More information

( ) ( ) HPC SPH FPGA Web http://galaxy.u-aizu.ac.jp/trac/note/ : 1 4 : 2 6 : 3 6 GPU : ~ 100 1000 : ~ 1000-100000 Google : ~ 10000 : ~ 100000000 GPU, Cell, FPGA GRAPE-DR/GRAPE-MP ( ) GPU GPU : Matsumoto,

More information

SQUFOF NTT Shanks SQUFOF SQUFOF Pentium III Pentium 4 SQUFOF 2.03 (Pentium 4 2.0GHz Willamette) N UBASIC 50 / 200 [

SQUFOF NTT Shanks SQUFOF SQUFOF Pentium III Pentium 4 SQUFOF 2.03 (Pentium 4 2.0GHz Willamette) N UBASIC 50 / 200 [ SQUFOF SQUFOF NTT 2003 2 17 16 60 Shanks SQUFOF SQUFOF Pentium III Pentium 4 SQUFOF 2.03 (Pentium 4 2.0GHz Willamette) 60 1 1.1 N 62 16 24 UBASIC 50 / 200 [ 01] 4 large prime 943 2 1 (%) 57 146 146 15

More information

01_OpenMP_osx.indd

01_OpenMP_osx.indd OpenMP* / 1 1... 2 2... 3 3... 5 4... 7 5... 9 5.1... 9 5.2 OpenMP* API... 13 6... 17 7... 19 / 4 1 2 C/C++ OpenMP* 3 Fortran OpenMP* 4 PC 1 1 9.0 Linux* Windows* Xeon Itanium OS 1 2 2 WEB OS OS OS 1 OS

More information

Microsoft PowerPoint - CproNt02.ppt [互換モード]

Microsoft PowerPoint - CproNt02.ppt [互換モード] 第 2 章 C プログラムの書き方 CPro:02-01 概要 C プログラムの構成要素は関数 ( プログラム = 関数の集まり ) 関数は, ヘッダと本体からなる 使用する関数は, プログラムの先頭 ( 厳密には, 使用場所より前 ) で型宣言 ( プロトタイプ宣言 ) する 関数は仮引数を用いることができる ( なくてもよい ) 関数には戻り値がある ( なくてもよい void 型 ) コメント

More information

橡Pro PDF

橡Pro PDF 1 void main( ) char c; /* int c; */ int sum=0; while ((c = getchar())!= EOF) if(isdigit(c) ) sum += (c-'0'); printf("%d\n", sum); main()int i,sum=0; for(i=0;i

More information

最新Linuxデバイスドライバ開発応用-修正版-PDF.PDF

最新Linuxデバイスドライバ開発応用-修正版-PDF.PDF Linux Kernel Conference 2004 Linux - / - [email protected] 2004/10/14 Device Drivers Limited 1 Device Drivers Limited 2 IF Device Drivers Limited 3 Linux Device Drivers Limited 4 2.6 2.6 2.6 Device Drivers

More information

syspro-0405.ppt

syspro-0405.ppt 3 4, 5 1 UNIX csh 2.1 bash X Window 2 grep l POSIX * more POSIX 3 UNIX. 4 first.sh #!bin/sh #first.sh #This file looks through all the files in the current #directory for the string yamada, and then prints

More information

untitled

untitled PC [email protected] muscle server blade server PC PC + EHPC/Eric (Embedded HPC with Eric) 1216 Compact PCI Compact PCIPC Compact PCISH-4 Compact PCISH-4 Eric Eric EHPC/Eric EHPC/Eric Gigabit

More information

haskell.gby

haskell.gby Haskell 1 2 3 Haskell ( ) 4 Haskell Lisper 5 Haskell = Haskell 6 Haskell Haskell... 7 qsort [8,2,5,1] [1,2,5,8] "Hello, " ++ "world!" "Hello, world!" 1 + 2 div 8 2 (+) 1 2 8 div 2 3 4 map even [1,2,3,4]

More information

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1:

[ 1] 1 Hello World!! 1 #include <s t d i o. h> 2 3 int main ( ) { 4 5 p r i n t f ( H e l l o World!! \ n ) ; 6 7 return 0 ; 8 } 1: 005 9 7 1 1.1 1 Hello World!! 5 p r i n t f ( H e l l o World!! \ n ) ; 7 return 0 ; 8 } 1: 1 [ ] Hello World!! from Akita National College of Technology. 1 : 5 p r i n t f ( H e l l o World!! \ n ) ;

More information

tutorial_lc.dvi

tutorial_lc.dvi 00 Linux v.s. RT Linux v.s. ART-Linux Linux RT-Linux ART-Linux Linux [email protected] 1 1.1 Linux Yes, No.,. OS., Yes. Linux,.,, Linux., Linux.,, Linux. Linux.,,. Linux,.,, 0..,. RT-Linux

More information

GPU GPU CPU CPU CPU GPU GPU N N CPU ( ) 1 GPU CPU GPU 2D 3D CPU GPU GPU GPGPU GPGPU 2 nvidia GPU CUDA 3 GPU 3.1 GPU Core 1

GPU GPU CPU CPU CPU GPU GPU N N CPU ( ) 1 GPU CPU GPU 2D 3D CPU GPU GPU GPGPU GPGPU 2 nvidia GPU CUDA 3 GPU 3.1 GPU Core 1 GPU 4 2010 8 28 1 GPU CPU CPU CPU GPU GPU N N CPU ( ) 1 GPU CPU GPU 2D 3D CPU GPU GPU GPGPU GPGPU 2 nvidia GPU CUDA 3 GPU 3.1 GPU Core 1 Register & Shared Memory ( ) CPU CPU(Intel Core i7 965) GPU(Tesla

More information

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 1. 1.1. 1.2. 1 PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU 2. 2.1. 2 1 2 C a b N: PC BC c 3C ac b 3 4 a F7 b Y c 6 5 a ctrl+f5) 4 2.2. main 2.3. main 2.4. 3 4 5 6 7 printf printf

More information

Microsoft PowerPoint - Lec pptx

Microsoft PowerPoint - Lec pptx Course number: CSC.T341 コンピュータ論理設計 Computer Logic Design 10. シングルサイクルプロセッサのデータパス Datapath for Single Cycle Processor 吉瀬謙二情報工学系 Kenji Kise, Department of Computer Science kise _at_ c.titech.ac.jp www.arch.cs.titech.ac.jp/lecture/cld/

More information

A Responsive Processor for Parallel/Distributed Real-time Processing

A Responsive Processor for Parallel/Distributed Real-time Processing E-mail: yamasaki@{ics.keio.ac.jp, etl.go.jp} http://www.ny.ics.keio.ac.jp etc. CPU) I/O I/O or Home Automation, Factory Automation, (SPARC) (SDRAM I/F, DMAC, PCI, USB, Timers/Counters, SIO, PIO, )

More information

( CUDA CUDA CUDA CUDA ( NVIDIA CUDA I

(    CUDA CUDA CUDA CUDA (  NVIDIA CUDA I GPGPU (II) GPGPU CUDA 1 GPGPU CUDA(CUDA Unified Device Architecture) CUDA NVIDIA GPU *1 C/C++ (nvcc) CUDA NVIDIA GPU GPU CUDA CUDA 1 CUDA CUDA 2 CUDA NVIDIA GPU PC Windows Linux MaxOSX CUDA GPU CUDA NVIDIA

More information

2016 3

2016 3 JAIST Reposi https://dspace.j Title 命令セットによるマイクロアーキテクチャへの影響に 関する研究 [ 課題研究報告書 ] Author(s) 桑田, 正明 Citation Issue Date 2016-03 Type Thesis or Dissertation Text version author URL http://hdl.handle.net/10119/13635

More information

プロセッサ・アーキテクチャ

プロセッサ・アーキテクチャ 2. NII51002-8.0.0 Nios II Nios II Nios II 2-3 2-4 2-4 2-6 2-7 2-9 I/O 2-18 JTAG Nios II ISA ISA Nios II Nios II Nios II 2 1 Nios II Altera Corporation 2 1 2 1. Nios II Nios II Processor Core JTAG interface

More information

1.ppt

1.ppt /* * Program name: hello.c */ #include int main() { printf( hello, world\n ); return 0; /* * Program name: Hello.java */ import java.io.*; class Hello { public static void main(string[] arg)

More information

untitled

untitled II 4 Yacc Lex 2005 : 0 1 Yacc 20 Lex 1 20 traverse 1 %% 2 [0-9]+ { yylval.val = atoi((char*)yytext); return NUM; 3 "+" { return + ; 4 "*" { return * ; 5 "-" { return - ; 6 "/" { return / ; 7 [ \t] { /*

More information

cpp1.dvi

cpp1.dvi 2017 c 1 C++ (1) C C++, C++, C 11, 12 13 (1) 14 (2) 11 1 n C++ //, [List 11] 1: #include // C 2: 3: int main(void) { 4: std::cout

More information

Microsoft PowerPoint - ProcML-12-3.ppt

Microsoft PowerPoint - ProcML-12-3.ppt プロセッサと 年次前次前期 ( 第 回 ) 進数の加減算 (overflow( overflow) 演習 次の ビット演算の結果は overflow か? () + + () + + 答 答 中島克人 情報メディア学科 [email protected] () - = + + 答 進数の加減算 (overflow( overflow) 演習 次の ビット演算の結果は overflow

More information

,,,,., C Java,,.,,.,., ,,.,, i

,,,,., C Java,,.,,.,., ,,.,, i 24 Development of the programming s learning tool for children be derived from maze 1130353 2013 3 1 ,,,,., C Java,,.,,.,., 1 6 1 2.,,.,, i Abstract Development of the programming s learning tool for children

More information

P05.ppt

P05.ppt 2 1 list0415.c forfor #include int i, j; for (i = 1; i

More information

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1

/ SCHEDULE /06/07(Tue) / Basic of Programming /06/09(Thu) / Fundamental structures /06/14(Tue) / Memory Management /06/1 I117 II I117 PROGRAMMING PRACTICE II 2 MEMORY MANAGEMENT 2 Research Center for Advanced Computing Infrastructure (RCACI) / Yasuhiro Ohara [email protected] / SCHEDULE 1. 2011/06/07(Tue) / Basic of Programming

More information

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf ("%s", str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i

1 # include < stdio.h> 2 # include < string.h> 3 4 int main (){ 5 char str [222]; 6 scanf (%s, str ); 7 int n= strlen ( str ); 8 for ( int i=n -2; i ABC066 / ARC077 writer: nuip 2017 7 1 For International Readers: English editorial starts from page 8. A : ringring a + b b + c a + c a, b, c a + b + c 1 # include < stdio.h> 2 3 int main (){ 4 int a,

More information