Report1 Sim-profile 을 이용한 LI 벤치마크 과목명 : 컴퓨터 구조 특론 교수님 : 이상정 교수님 팀 원 : 강명숙, 박장수
목 차목 차 간단한 C 프로그램 작성하고 컴파일 하여 어셈블리 언어를 생 성하고 Dlite! 디버거를 사용하여 실행. 두 개의 벤치마크 프로그램에 대해 sim-profile 로 시뮬레이션 결과
1. 간단한 소스 구구단 #include /* 헤더파일 불러옴 */ void main() /* 메인함수 호출 */ { int a,b; /* 변수 설정 (a- 곱하여질 수 b- 단수 )*/ clrscr(); /* 화면을 깨끗이 정리 */ for(a=1; a<=9; a++) /* 곱하여질수 1 씩 증가시킴 */ { for(b=9;b>=2;b--) /* 단수 9 에서 2 까지 1 씩 감소 */ printf("%dx%d=%-4d",b,a,b*a); /* 한 화면에 나오도록 줄을 맞추며 곱셈 출력 */ printf("\n"); /* 한줄 내려서 맨앞으로 커서이동 */ }
1-1. 컴파일 및 어셈블리코드 bin]$./sslittle-na-sstrix-gcc -o gogo.ss gogo.c bin]$./sslittle-na-sstrix-gcc -S gogo.c
1-1. 컴파일 및 어셈블리코드 ( 계속 ) .file 1 "gogo.c" # GNU C [AL 1.1, MM 40, tma 0.1] SimpleScalar running sstrix compiled by GNU C # Cc1 defaults: # -mgas -mgpOPT # Cc1 arguments (-G value = 8, Cpu = default, ISA = 1): # -quiet -dumpbase -o gcc2_compiled.: __gnu_compiled_c: .rdata .align 2 $LC0: .ascii "%dX%d=%d\t\000" .sdata .align 2
1-1. 컴파일 및 어셈블리코드 ( 계속 ) $LC1: .ascii "\n\000" .text .align 2 .globl main .text .loc 1 3 .ent main main: .frame $fp,32,$31 # vars= 8, regs= 2/0, args= 16, extra= 0 .mask 0xc ,-4 .fmask 0x ,0 subu $sp,$sp,32 sw $31,28($sp) sw $fp,24($sp) move $fp,$sp jal __main li $2,0x # 1 sw $2,16($fp)
1-1. 컴파일 및 어셈블리코드 ( 계속 ) $L2: lw $2,16($fp) slt $3,$2,10 bne $3,$0,$L5 j $L3 $L5: li $2,0x # 2 sw $2,20($fp) $L6: lw $2,20($fp) slt $3,$2,10 bne $3,$0,$L9 j $L7 $L9: lw $2,20($fp) lw $3,16($fp) mult $2,$3 mflo $2 la $4,$LC0 lw $5,20($fp) lw $6,16($fp) move $7,$2 jal printf
1-1. 컴파일 및 어셈블리코드 ( 계속 ) $L8: lw $3,20($fp) addu $2,$3,1 move $3,$2 sw $3,20($fp) j $L6 $L7: la $4,$LC1 jal printf $L4: lw $3,16($fp) addu $2,$3,1 move $3,$2 sw $3,16($fp) j $L2 $L3: $L1: move $sp,$fp # sp not trusted here lw $31,28($sp) lw $fp,24($sp) addu $sp,$sp,32 j $31 .end main
1-2. Sim-safe 수행 sim-safe: SimpleScalar/PISA Tool Set version 3.0 of August, Copyright (c) by Todd M. Austin, Ph.D. and SimpleScalar, LLC. All Rights Reserved. This version of SimpleScalar is licensed for academic non-commercial use. No portion of this work may be used by any commercial entity, or for any commercial purpose, without the prior written permission of SimpleScalar, LLC sim: command line:./sim-safe gogo.ss sim: simulation Mon Apr 26 22:54: , options follow: sim-safe: This simulator implements a functional simulator. This functional simulator is the simplest, most user-friendly simulator in the simplescalar tool set. Unlike sim-fast, this functional simulator checks for all instruction errors, and the implementation is crafted for clarity rather than speed.
1-2. Sim-safe 수행 ( 계속 ) # -config # load configuration from a file # -dumpconfig # dump configuration to a file # -h false # print help message # -v false # verbose operation # -d false # enable debug message # -i false # start in Dlite debugger -seed 1 # random number generator seed (0 for timer seed) # -q false # initialize and terminate immediately # -chkpt # restore EIO trace execution from # -redir:sim # redirect simulator output to file (non-interactive only) # -redir:prog # redirect simulated program output to file -nice 0 # simulator scheduling priority -max:inst 0 # maximum number of inst's to execute sim: ** starting functional simulation ** 2X1=2 3X1=3 4X1=4 5X1=5 6X1=6 7X1=7 8X1=8 9X1=9 2X2=4 3X2=6 4X2=8 5X2=10 6X2=12 7X2=14 8X2=16 9X2=18 2X3=6 3X3=9 4X3=12 5X3=15 6X3=18 7X3=21 8X3=24 9X3=27 2X4=8 3X4=12 4X4=16 5X4=20 6X4=24 7X4=28 8X4=32 9X4=36 2X5=10 3X5=15 4X5=20 5X5=25 6X5=30 7X5=35 8X5=40 9X5=45 2X6=12 3X6=18 4X6=24 5X6=30 6X6=36 7X6=42 8X6=48 9X6=54 2X7=14 3X7=21 4X7=28 5X7=35 6X7=42 7X7=49 8X7=56 9X7=63 2X8=16 3X8=24 4X8=32 5X8=40 6X8=48 7X8=56 8X8=64 9X8=72 2X9=18 3X9=27 4X9=36 5X9=45 6X9=54 7X9=63 8X9=72 9X9=81
1-2. Sim-safe 수행 ( 계속 ) sim: ** simulation statistics ** sim_num_insn # total number of instructions executed sim_num_refs # total number of loads and stores executed sim_elapsed_time 1 # total simulation time in seconds sim_inst_rate # simulation speed (in insts/sec) ld_text_base 0x # program text (code) segment base ld_text_size # program text (code) size in bytes ld_data_base 0x # program initialized data segment base ld_data_size 8192 # program init'ed `.data' and uninit'ed `.bss' size in bytes ld_stack_base 0x7fffc000 # program stack segment base (highest address in stack) ld_stack_size # program initial stack size ld_prog_entry 0x # program entry point (initial PC) ld_environ_base 0x7fff8000 # program environment base address address ld_target_big_endian 0 # target executable endian-ness, non-zero if big endian mem.page_count 26 # total number of pages allocated mem.page_mem 104k # total size of memory pages allocated mem.ptab_misses 26 # total first level page table misses mem.ptab_accesses # total page table accesses mem.ptab_miss_rate # first level page table miss rate
1-3. Dlit! 디버거 사용 sim: ** starting functional simulation ** [ 0] 0x : lw r16,0(r29) DLite! > dis main 0x004001f0: addiu r29,r29,-32 0x004001f8: sw r31,28(r29) 0x : sw r30,24(r29) 0x : addu r30,r0,r29 0x : jal 0x4004f8 0x : addiu r2,r0,1 0x : sw r2,16(r30) 0x : lw r2,16(r30) 0x : slti r3,r2,10 0x : bne r3,r0,0x 0x : j 0x 0x : addiu r2,r0,2 0x : sw r2,20(r30) 0x : lw r2,20(r30) 0x : slti r3,r2,10 0x : bne r3,r0,0x DLite! > break 0x
1-2. Dlit! 디버거 사용 ( 계속 ) DLite! > cont Stopping at code breakpoint 0x [ 181] 0x : addiu r2,r0,1 DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x $r0: 0/0x $r1: 0/0x $r2: 0/0x $r3: 2/0x $r4: /0x100011d8 $r5: /0x7fff8004 $r6: /0x7fff800c $r7: /0x100011d0 $r8: /0x7efefeff $r9: /0x2f2f2f2f $r10: 0/0x $r11: 0/0x $r12: 0/0x $r13: 0/0x $r14: 0/0x $r15: 0/0x $r16: 1/0x $r17: /0x7fff8004 $r18: /0x7fff800c $r19: 0/0x $r20: 0/0x $r21: 0/0x $r22: 0/0x $r23: 0/0x $r24: 0/0x $r25: 0/0x $r26: 0/0x $r27: 0/0x $r28: /0x $r29: /0x7fff7fc8 $r30: /0x7fff7fc8 $r31: /0x
1-2. Dlit! 디버거 사용 ( 계속 ) DLite! > step [ 182] 0x : sw r2,16(r30) DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x $r0: 0/0x $r1: 0/0x $r2: 1/0x $r3: 2/0x $r4: /0x100011d8 $r5: /0x7fff8004 $r6: /0x7fff800c $r7: /0x100011d0 $r8: /0x7efefeff $r9: /0x2f2f2f2f $r10: 0/0x $r11: 0/0x $r12: 0/0x $r13: 0/0x $r14: 0/0x $r15: 0/0x $r16: 1/0x $r17: /0x7fff8004 $r18: /0x7fff800c $r19: 0/0x $r20: 0/0x $r21: 0/0x $r22: 0/0x $r23: 0/0x $r24: 0/0x $r25: 0/0x $r26: 0/0x $r27: 0/0x $r28: /0x $r29: /0x7fff7fc8 $r30: /0x7fff7fc8 $r31: /0x
1-2. Dlit! 디버거 사용 ( 계속 ) DLite! > step [ 183] 0x : lw r2,16(r30) DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x $r0: 0/0x $r1: 0/0x $r2: 1/0x $r3: 2/0x $r4: /0x100011d8 $r5: /0x7fff8004 $r6: /0x7fff800c $r7: /0x100011d0 $r8: /0x7efefeff $r9: /0x2f2f2f2f $r10: 0/0x $r11: 0/0x $r12: 0/0x $r13: 0/0x $r14: 0/0x $r15: 0/0x $r16: 1/0x $r17: /0x7fff8004 $r18: /0x7fff800c $r19: 0/0x $r20: 0/0x $r21: 0/0x $r22: 0/0x $r23: 0/0x $r24: 0/0x $r25: 0/0x $r26: 0/0x $r27: 0/0x $r28: /0x $r29: /0x7fff7fc8 $r30: /0x7fff7fc8 $r31: /0x
1-3. Dlit! 디버거 사용 ( 계속 ) DLite! > step [ 184] 0x : slti r3,r2,10 DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x $r0: 0/0x $r1: 0/0x $r2: 1/0x $r3: 2/0x $r4: /0x100011d8 $r5: /0x7fff8004 $r6: /0x7fff800c $r7: /0x100011d0 $r8: /0x7efefeff $r9: /0x2f2f2f2f $r10: 0/0x $r11: 0/0x $r12: 0/0x $r13: 0/0x $r14: 0/0x $r15: 0/0x $r16: 1/0x $r17: /0x7fff8004 $r18: /0x7fff800c $r19: 0/0x $r20: 0/0x $r21: 0/0x $r22: 0/0x $r23: 0/0x $r24: 0/0x $r25: 0/0x $r26: 0/0x $r27: 0/0x $r28: /0x $r29: /0x7fff7fc8 $r30: /0x7fff7fc8 $r31: /0x
1-3. Dlit! 디버거 사용 ( 계속 ) DLite! > step [ 185] 0x : bne r3,r0,0x DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x $r0: 0/0x $r1: 0/0x $r2: 1/0x $r3: 1/0x $r4: /0x100011d8 $r5: /0x7fff8004 $r6: /0x7fff800c $r7: /0x100011d0 $r8: /0x7efefeff $r9: /0x2f2f2f2f $r10: 0/0x $r11: 0/0x $r12: 0/0x $r13: 0/0x $r14: 0/0x $r15: 0/0x $r16: 1/0x $r17: /0x7fff8004 $r18: /0x7fff800c $r19: 0/0x $r20: 0/0x $r21: 0/0x $r22: 0/0x $r23: 0/0x $r24: 0/0x $r25: 0/0x $r26: 0/0x $r27: 0/0x $r28: /0x $r29: /0x7fff7fc8 $r30: /0x7fff7fc8 $r31: /0x
1-3. Dlit! 디버거 사용 ( 계속 ) DLite! > cont 2X1=2 3X1=3 4X1=4 5X1=5 6X1=6 7X1=7 8X1=8 9X1=9 2X2=4 3X2=6 4X2=8 5X2=10 6X2=12 7X2=14 8X2=16 9X2=18 2X3=6 3X3=9 4X3=12 5X3=15 6X3=18 7X3=21 8X3=24 9X3=27 2X4=8 3X4=12 4X4=16 5X4=20 6X4=24 7X4=28 8X4=32 9X4=36 2X5=10 3X5=15 4X5=20 5X5=25 6X5=30 7X5=35 8X5=40 9X5=45 2X6=12 3X6=18 4X6=24 5X6=30 6X6=36 7X6=42 8X6=48 9X6=54 2X7=14 3X7=21 4X7=28 5X7=35 6X7=42 7X7=49 8X7=56 9X7=63 2X8=16 3X8=24 4X8=32 5X8=40 6X8=48 7X8=56 8X8=64 9X8=72 2X9=18 3X9=27 4X9=36 5X9=45 6X9=54 7X9=63 8X9=72 9X9=81
2-1 LI 벤치마크 시뮬레이션 simplesim-3.0]$./sim-profile -iclass li.ss train.lsp sim-profile: SimpleScalar/PISA Tool Set version 3.0 of August, Copyright (c) by Todd M. Austin, Ph.D. and SimpleScalar, LLC. All Rights Reserved. This version of SimpleScalar is licensed for academic non-commercial use. No portion of this work may be used by any commercial entity, or for any commercial purpose, without the prior written permission of SimpleScalar, LLC sim: command line:./sim-profile -iclass li.ss train.lsp sim: simulation Tue Apr 27 00:36: , options follow: sim-profile: This simulator implements a functional simulator with profiling support. Run with the `-h' flag to see profiling options available.
2-1 LI 벤치마크 시뮬레이션 ( 계속 ) # -config # load configuration from a file # -dumpconfig # dump configuration to a file # -h false # print help message # -v false # verbose operation # -d false # enable debug message # -i false # start in Dlite debugger -seed 1 # random number generator seed (0 for timer seed) # -q false # initialize and terminate immediately # -chkpt # restore EIO trace execution from # -redir:sim # redirect simulator output to file (non-interactive only) # -redir:prog # redirect simulated program output to file -nice 0 # simulator scheduling priority -max:inst 0 # maximum number of inst's to execute -all false # enable all profile options -iclass true # enable instruction class profiling -iprof false # enable instruction profiling -brprof false # enable branch instruction profiling -amprof false # enable address mode profiling -segprof false # enable load/store address segment profiling -tsymprof false # enable text symbol profiling -taddrprof false # enable text address profiling -dsymprof false # enable data symbol profiling -internal false # include compiler-internal symbols during symbol profiling # -pcstat # profile stat(s) against text addr's (mult uses ok)
2-1 LI 벤치마크 시뮬레이션 ( 계속 ) sim: ** starting functional simulation ** XLISP version 1.6, Copyright (c) 1985, by David Betz ; loading "train.lsp" (IMPLIES (AND (IMPLIES (F (PLUS (PLUS A B) (PLUS C (ZERO)))) (F (TIMES (TIMES A B) (PLUS C D)))) (IMPLIES (F (TIMES (TIMES A B) (PLUS C D))) (F (REVERSE (APPEND (APPEND A B) (NIL)))))) (IMPLIES (F (PLUS (PLUS A B) (PLUS C (ZERO)))) (F (REVERSE (APPEND (APPEND A B) (NIL)))))) NIL (DONE BOYER-TEST) (ALL DONE) sim: ** simulation statistics ** sim_num_insn # total number of instructions executed sim_num_refs # total number of loads and stores executed sim_elapsed_time 73 # total simulation time in seconds sim_inst_rate # simulation speed (in insts/sec)
2-1 LI 벤치마크 시뮬레이션 ( 계속 ) sim_inst_class_prof # instruction class profile sim_inst_class_prof.array_size = 7 sim_inst_class_prof.bucket_size = 1 sim_inst_class_prof.count = 7 sim_inst_class_prof.total = sim_inst_class_prof.imin = 0 sim_inst_class_prof.imax = 7 sim_inst_class_prof.average = sim_inst_class_prof.std_dev = sim_inst_class_prof.overflows = 0 # pdf == prob dist fn, cdf == cumulative dist fn # index count pdf sim_inst_class_prof.start_dist load store uncond branch cond branch int computation fp computation trap sim_inst_class_prof.end_dist
2-1 LI 벤치마크 시뮬레이션 ( 계속 ) ld_text_base 0x # program text (code) segment base ld_text_size # program text (code) size in bytes ld_data_base 0x # program initialized data segment base ld_data_size # program init'ed `.data' and uninit'ed `.bss' size in bytes ld_stack_base 0x7fffc000 # program stack segment base (highest address in stack) ld_stack_size # program initial stack size ld_prog_entry 0x # program entry point (initial PC) ld_environ_base 0x7fff8000 # program environment base address address ld_target_big_endian 0 # target executable endian-ness, non-zero if big endian mem.page_count 96 # total number of pages allocated mem.page_mem 384k # total size of memory pages allocated mem.ptab_misses 96 # total first level page table misses mem.ptab_accesses # total page table accesses mem.ptab_miss_rate # first level page table miss rate
2-2 자유벤치 RC4 sim: ** starting functional simulation ** sim: ** simulation statistics ** sim_num_insn # total number of instructions executed sim_num_refs # total number of loads and stores executed sim_elapsed_time 1 # total simulation time in seconds sim_inst_rate # simulation speed (in insts/sec) sim_inst_class_prof # instruction class profile sim_inst_class_prof.array_size = 7 sim_inst_class_prof.bucket_size = 1 sim_inst_class_prof.count = 7 sim_inst_class_prof.total = sim_inst_class_prof.imin = 0 sim_inst_class_prof.imax = 7 sim_inst_class_prof.average = sim_inst_class_prof.std_dev = sim_inst_class_prof.overflows = 0 # pdf == prob dist fn, cdf == cumulative dist fn # index count pdf sim_inst_class_prof.start_dist load store uncond branch cond branch int computation fp computation trap sim_inst_class_prof.end_dist
2-2 자유벤치 RC4 ( 계속 ) ld_text_base 0x # program text (code) segment base ld_text_size # program text (code) size in bytes ld_data_base 0x # program initialized data segment base ld_data_size # program init'ed `.data' and uninit'ed `.bs s' size in bytes ld_stack_base 0x7fffc000 # program stack segment base (highest addres s in stack) ld_stack_size # program initial stack size ld_prog_entry 0x # program entry point (initial PC) ld_environ_base 0x7fff8000 # program environment base address address ld_target_big_endian 0 # target executable endian-ness, non-zero if big endian mem.page_count 34 # total number of pages allocated mem.page_mem 136k # total size of memory pages allocated mem.ptab_misses 34 # total first level page table misses mem.ptab_accesses # total page table accesses mem.ptab_miss_rate # first level page table miss rate
3. 결 과 구현환경 CPU : P- Ⅲ 866MHz Memory : 256MB OS : Red Hat Linux 7.3 입력내용 Li.ss RC4.ss
3. 결 과 ( 계속 ) 수행결과 도표 sim_num_insnsim_num_refssim-elapsed_timesm_inst_rateId_text_sizeId_data_size LI RC Id_stack_sizemem.page_cou nt mem.page_memmem.ptab_mi sses mem.ptab_ accesses Imem.ptab_m iss_rate LI K RC K
3. 결 과 ( 계속 )