Microsoft Word Huong dan thuc hanh mips asm tren pcspim doc



tải về 0.57 Mb.
Chế độ xem pdf
trang5/10
Chuyển đổi dữ liệu02.11.2023
Kích0.57 Mb.
#55526
1   2   3   4   5   6   7   8   9   10
huong dan thuc hanh mips asm tren pcspim 5652
MIPSSSS, 5
5.4 Các lệnh nhảy 
Thiết lập các tham số trong menu Simulator -> Settings: 
Bare Machine ON, Allow Pseudo Instructions OFF, Load Trap File OFF, Delayed 
Branches ON, Delayed Loads ON, Mapped IO OFF, Quiet OFF 

bne 
slti 
beq 
bltz 
sltu 
bgez 
slt 
sltiu 
## Find the Significant bits in a pattern 
## The significant bits are the leftmost one bit and
## all its to its right 
## Approach: Count the number of right shifts needed 
## before the pattern becomes all zeros 
##
## Register Use: 
## $7 --- shift count 
## $8 --- the bit pattern, 0x00298D7D for example. 
.text 
.globl main 
main:
ori $8,$0,0x0029 # load $8 with the pattern 
sll $8,$8,16 # shift into MSBs 
ori $8,$8,0x8D7D # or in the LSBs 
## copy $9 to memory in big-endian form 
## 
## Register Use: 
## $8 --- first byte of the tape block 
## $9 --- 4-byte integer 
.text 
.globl main 
main:
lui $9,0x1234 # put data in $9 
ori $9,0x5678 # 
lui $8,0x1000 # $8 is base register 
sb $9,3($8) # least significant byte 
srl $9,$9,8 # move next byte to low order 
sb $9,2($8) # bits 8-15
srl $9,$9,8 # move next byte to low order 
sb $9,1($8) # bits 16-23
srl $9,$9,8 # move next byte to low order 
sb $9,0($8) # most significant byte 
.data 
tape: # base register points here 
.space 1024 # tape buffer (1K bytes) 
## End of file 


5.5 Các ví dụ xử lý chuỗi, xử lý mảng 
Các lệnh đã biết cho đến giờ: 
Thiết lập các tham số trong menu Simulator -> Settings: 
Bare Machine ON, Allow Pseudo Instructions OFF, Load Trap File OFF, Delayed
Branches ON, Delayed Loads ON, Mapped IO OFF, Quiet OFF 
loop: beq $8,$0,exit # done when pattern == 00 
sll $0,$0,0 # 
delay or nop after a branch

or jump instruction
srl $8,$8,1 # shift right one bit 
addu $7,$7,1 # increment shift count
j loop # repeat 
sll $0,$0,0 
exit: j exit # sponge for extra cycles
sll $0,$0,0 
## End of file 
add
div
mflo
slt, slti 
addi
divu
mult
sltu, sltiu 
addiu
j
multu
sra 
addu
lb
nor
srl 
and
lbu
or
sub 
andi
lh
ori
subu 
beq
lhu
sb
sw 
bgez
lui
sh
xor 
bltz
lw
sll
xori 
bne
mfhi 
## To Lower Case 
## 
## 
## Write a program that converts the string to all lower case 
## characters. Do this by adding 0x20 to each character in the string. 
## Register Use: 
## 
## $8 --- current character 
## $10 --- character pointer 



tải về 0.57 Mb.

Chia sẻ với bạn bè của bạn:
1   2   3   4   5   6   7   8   9   10




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương