Download presentation
1
SimpleScalar 설치 및 사용법 순천향대학교 정보기술공학부 이상정
2
SimpleScalar 설치 설치 내용 simulator 3.0 : 시뮬레이터 gcc-2.6.3 : C 컴파일러
gnu binutils : GNU utilities 순천향대학교 정보기술공학부 이 상 정
3
simulator 3.0 설치 cd /edu gzip -d simplesim3.0b.tar.gz
tar -xvf simplesim3.0b.tar make config-pisa pisa => Portable ISA make cd /edu/simplesim-3.0 ./sim-safe 순천향대학교 정보기술공학부 이 상 정
4
gnu binutils-2.5.2 설치 cd /edu tar -zxvf simpleutils.tar.gz
cd binutils-2.5.2 ./configure -host=i386-*-gnu/linux -target=sslittle-na-sstrix -with-gnu-as -with-gnu-ld -prefix=/edu make make install 순천향대학교 정보기술공학부 이 상 정
5
gcc-2.6.3 설치 cd /edu tar -zxvf simpletools.tar,gz cd gcc-2.6.3
./configure -host=i586-*-gnu/linux -target=sslittle-na-sstrix -with-gnu-as -with-gnu-ld -prefix=/edu make install => error cd /edu/gcc-2.6.3/bin ./sslittle-na-sstrix-gcc -o test.ss test.c ./sslittle-na-sstrix-gcc -S test.c => test.s /edu/simplesim-3.0/sim-safe test.ss 순천향대학교 정보기술공학부 이 상 정
6
gcc 설치 에러내용 예 gcc-2.6.3/cccp.c: line 191 : declaration of sys_errlist not correct -> #if changed to: #if …. || defined (__linux__) gcc-2.6.3/sdbout.c: line 58 : no syms.h -> use gsysms.h gcc-2.6.3/gcc.c : line 172 : sys_errlist : conflicting types, cft. cccp.c -> #if changed to: #if … || defined (__linux__) gcc-2.6.3/cp/g++.c line 88: sys_errlist, I -> #if changed to: #if …. || defined (__linux__) 순천향대학교 정보기술공학부 이 상 정
7
예제 프로그램 test.c #include <stdio.h> int a=3, b; main() { int x,y;
x = a; y = 4; b = x + y; printf("%d\n", b); } 순천향대학교 정보기술공학부 이 상 정
8
컴파일 예 ./sslittle-na-sstrix-gcc -o test.ss test.c
./sslittle-na-sstrix-gcc -S test.c test.s .file "test.c" gcc2_compiled.: __gnu_compiled_c: .globl a .sdata .align 2 # 22 = 4 a: # a = 3 .word 3 .align 2 순천향대학교 정보기술공학부 이 상 정
9
컴파일 예 $LC0: .ascii "%d\n\000" .text .align 2 .globl main .comm b,4 # b
.loc 1 4 .ent main main: .frame $fp,32,$31 # frame register(r30),frame size,return register .mask 0xc , # bitmask for register save .fmask 0x , # bitmask for fp register save 순천향대학교 정보기술공학부 이 상 정
10
컴파일 예 subu $sp,$sp,32 # $sp(r29), stack push for next frame
sw $31,28($sp) # save return register sw $fp,24($sp) # save frame register move $fp,$sp # set current frame register jal __main lw $2,a # x = a; sw $2,16($fp) li $2,0x # y = 4 sw $2,20($fp) lw $2,16($fp) # b = x + y lw $3,20($fp) addu $2,$2,$3 sw $2,b la $4,$LC0 # printf(“%d\n”,b); lw $5,b jal printf 순천향대학교 정보기술공학부 이 상 정
11
컴파일 예 Gas 매뉴얼 http://www.gnu.org/manual/gas-2.9.1/as.html $L1:
move $sp,$fp lw $31,28($sp) # restore return address lw $fp,24($sp) # restore frame register addu $sp,$sp,32 # stack pop j $31 # return .end main Gas 매뉴얼 순천향대학교 정보기술공학부 이 상 정
12
sim-safe 수행 예 /edu/simplesim-3.0/sim-safe test.ss
sim-safe: SimpleScalar/PISA Tool Set version 3.0 of November, 2000. Copyright (c) by Todd M. Austin. All Rights Reserved. ………………. # -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 # random number generator seed (0 for timer seed) # -q false # initialize and terminate immediately # -chkpt <null> # restore EIO trace execution from <fname> # -redir:sim <null> # redirect simulator output to file (non-interactive only) # -redir:prog <null> # redirect simulated program output to file -nice # simulator scheduling priority -max:inst # maximum number of inst's to execute sim: ** starting functional simulation ** 7 순천향대학교 정보기술공학부 이 상 정
13
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 # total simulation time in seconds sim_inst_rate # simulation speed (in insts/sec) ld_text_base x # program text (code) segment base ld_text_size # program text (code) size in bytes ld_data_base x # program initialized data segment base ld_data_size # program init'ed `.data' and uninit'ed `.bss' size in bytes ld_stack_base x7fffc000 # program stack segment base (highest address in stack) ld_stack_size # program initial stack size ld_prog_entry x # program entry point (initial PC) ld_environ_base x7fff8000 # program environment base address address ld_target_big_endian # target executable endian-ness, non-zero if big endian mem.page_count # total number of pages allocated mem.page_mem k # total size of memory pages allocated mem.ptab_misses # total first level page table misses mem.ptab_accesses # total page table accesses mem.ptab_miss_rate # first level page table miss rate 순천향대학교 정보기술공학부 이 상 정
14
sim-outorder 수행 예 /edu/simplesim-3.0/sim-outorder test.ss
sim-outorder: SimpleScalar/PISA Tool Set version 3.0 of November, 2000. ………. # -ptrace <null> # generate pipetrace, i.e., <fname|stdout|stderr> <range> -fetch:ifqsize # instruction fetch queue size (in insts) ………… -bpred bimod # branch predictor type {nottaken|taken|perfect|bimod|2lev|comb} -bpred:bimod # bimodal predictor config (<table size>) ………………. -decode:width # instruction decode B/W (insts/cycle) -issue:width # instruction issue B/W (insts/cycle) ……….. -ruu:size # register update unit (RUU) size -lsq:size # load/store queue (LSQ) size -cache:dl dl1:128:32:4:l # l1 data cache config, i.e., {<config>|none} -cache:dl1lat # l1 data cache hit latency (in cycles) ……………….. sim: ** starting performance simulation ** 7 순천향대학교 정보기술공학부 이 상 정
15
sim-outorder 수행 예 sim: ** simulation statistics **
sim_num_insn # total number of instructions committed sim_num_refs # total number of loads and stores committed ………………… sim_total_insn # total number of instructions executed sim_total_refs # total number of loads and stores executed …………………. sim_cycle # total simulation time in cycles sim_IPC # instructions per cycle sim_CPI # cycles per instruction …………. bpred_bimod.bpred_dir_rate # branch direction-prediction rate (i.e., all-hits/updates) ………….. il1.miss_rate # miss rate (i.e., misses/ref) ………. dl1.miss_rate # miss rate (i.e., misses/ref) ……………….. ul2.miss_rate # miss rate (i.e., misses/ref) ld_text_base x # program text (code) segment base …………………….. 순천향대학교 정보기술공학부 이 상 정
16
Dlite! 디버거 사용 예 $ /edu/simplesim-3.0/sim-safe -i test.ss
sim: ** starting functional simulation ** …….. [ ] 0x : lw r16,0(r29) DLite! > dis main 0x004001f0: addiu r29,r29, # stack push 0x004001f8: sw r31,28(r29) # return register save 0x : sw r30,24(r29) # frame register save 0x : addu r30,r0,r # $fp = $sp 0x : jal x # jal __main 0x : lw r2,-32768(r28) # x = a; 0x : sw r2,16(r30) 0x : addiu r2,r0, # y = 4; 0x : sw r2,20(r30) 0x : lw r2,16(r30) # b = x + y; 0x : lw r3,20(r30) 순천향대학교 정보기술공학부 이 상 정
17
Dlite! 디버거 사용 예 0x00400248: addu r2,r2,r3
0x : sw r2,-32416(r28) 0x : addiu r4,r28, # printf() 0x : lw r5,-32416(r28) 0x : jal x400670 DLite! > break 0x400218 breakpoint #1 class: exec DLite! > cont Stopping at code breakpoint 0x [ ] 0x : lw r2,-32768(r28) DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x 순천향대학교 정보기술공학부 이 상 정
18
Dlite! 디버거 사용 예 $r0: 0/0x00000000 $r1: 0/0x00000000
$r4: /0x100011c8 $r5: /0x7fff8004 ………… DLite! > step [ ] 0x : sw r2,16(r30) DLite! > iregs $r2: /0x $r3: /0x ……………… DLite! > break 0x400248 breakpoint #2 class: exec 순천향대학교 정보기술공학부 이 상 정
19
Dlite! 디버거 사용 예 DLite! > cont
Stopping at code breakpoint 0x [ ] 0x : addu r2,r2,r3 DLite! > step [ ] 0x : sw r2,-32416(r28) DLite! > iregs PC: 0x NPC: 0x HI: 0x LO: 0x FCC: 0x $r0: /0x $r1: /0x $r2: /0x $r3: /0x $r4: /0x100011c8 $r5: /0x7fff8004 $r6: /0x7fff800c $r7: /0x100011c0 순천향대학교 정보기술공학부 이 상 정
20
Dlite! 디버거 사용 예 …………… $r28: /0x $r29: /0x7fff7fc8 ……………. DLite! > step [ ] 0x : addiu r4,r28,-32764 DLite! > dump $r 0x100016a0: [ ] 0x100016b0: [ ] 0x100016c0: [ ] 0x100016d0: [ ] DLite! > cont 7 순천향대학교 정보기술공학부 이 상 정
21
Dlite! 디버거 사용 예 sim: ** simulation statistics **
sim_num_insn # total number of instructions executed sim_num_refs # total number of loads and stores executed sim_elapsed_time # total simulation time in seconds sim_inst_rate # simulation speed (in insts/sec) $ 순천향대학교 정보기술공학부 이 상 정
22
과제 간단한 테스트 C 프로그램을 작성하여 컴파일하여 어셈블리 언어를 생성하고 Dlite! 디버거를 사용하여 실행하여라.
발표자료 파워포인트 작성 제출 순천향대학교 정보기술공학부 이 상 정
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.