À̵¿: Home à mips0101

 

ÁÖ¼Ò: http://www.kernel.bz/mips/01/mips0101.htm

ÀÌÆäÀÌÁöÀÇ ÀúÀÛ±ÇÀº

Á¦¸ñ: MIPS ¼Ò°³

ÀúÀÚ¿¡°Ô ÀÖ½À´Ï´Ù

ÀúÀÚ: Á¤ÀçÁØ(rgbi3307@nate.com)

ÃÖ±Ù¼öÁ¤ÀÏ:2009-01-18

 

 

 

 

 

ÂüÁ¶:

MIPS Á¤º¸1: http://www.langens.eu/tim/ea/mips_en.php

MIPS Á¤º¸2: http://logos.cs.uic.edu/366/notes/index.html

¿î¿µÃ¼Á¦ °­ÀÇÀÚ·á: http://www.cs.rochester.edu/u/sandhya/csc252/

MIPS ¾î¼Àºí¸®¾ð¾î: http://chortle.ccsu.edu/AssemblyTutorial/index.html#Appendix

 

±â¼ú¼­Àû:

Çϵå¿þ¾î: (¾Æ¸¶Á¸ $38, ±³º¸ \47,000, ¹ø¿ª¼­ \20,000)

http://www.amazon.com/Designing-Embedded-Hardware-John-Catsoulis/dp/0596007558/ref=pd_sim_b_1

 

ARM °³¹ßÀÚ °¡À̵å: (¾Æ¸¶Á¸ $63)

http://www.amazon.com/ARM-System-Developers-Guide-Architecture/dp/1558608745/ref=sr_1_16?ie=UTF8&s=books&qid=1230698397&sr=1-16

 

¸®´ª½º µð¹ÙÀ̽º µå¶óÀ̹ö: (¾Æ¸¶Á¸ $36)

http://www.amazon.com/Essential-Drivers-Prentice-Software-Development/dp/0132396556/ref=sr_1_1?ie=UTF8&s=books&qid=1230859139&sr=1-1

 

 

MIPS ¶õ?

MIPS(Microprocessor without Interlocked Pipeline Stages)´Â RISC ÇÁ·Î¼¼¼­¸¦ ±â¹ÝÀ¸·Î ÇÏ¿© ½ºÅÄÆ÷µå ´ëÇб³ÀÇ John L. Hennessy¿¡ ÀÇÇØ¼­ ¹ßÇ¥µÇ¾ú´Ù.  1984³â¿¡ Hennessy´Â MIPS ÄÄÇ»ÅÍ ½Ã½ºÅÛÀ» °á¼ºÇÏ¿© R2000 À̶ó´Â ù¹øÂ° Á¦Ç°À» °³¹ßÇϰí, 1988³â¿¡´Â Á»´õ Çâ»óµÈ R3000À» ¹ßÇ¥ÇÑ´Ù.  R2000°ú R3000Àº µÑ´Ù 32ºñÆ®·Î µðÀÚÀÎ µÇ¾úÀ¸¸ç, ÀÌÈÄ¿¡´Â 64ºñÆ® CPUÀÎ R4000À» ³»³õ´Â´Ù.  ÇöÀç, MIPS ÄÄÇ»ÅÍ ½Ã½ºÅÛÀº °¡Àå Å« °í°´À̾ú´ø SGI(Silicon Graphics)¿¡ ÀÇÇØ¼­ ÀμöµÇ¾î MIPS Å×Å©³î·¯Áö·Î »ç¸íÀÌ º¯°æµÇ¾ú´Ù.

 

MIPS´Â 1970³â´ë ÈĹݿ¡ °³¹ßµÈ RISC(Reduced Instruction Set Computer) ÇÁ·Î¼¼¼­¸¦ ±â¹ÝÀ¸·Î ÇÏ¿© ¸í·É¾î´Â ÁÙÀ̰í, ·¹Áö½ºÅ͵éÀ» ´õ ¸¹ÀÌ »ç¿ëÇÏ¿© load/store¿¡ ÀÇÇÑ ¸Þ¸ð¸® Á¢±ÙÀ» ÁÙ¿©¼­ CISC(Complex Instruction Set Computer)¿¡ ºñÇØ¼­ ºü¸£°Ô µ¿ÀÛÇÑ´Ù.  MIPS´Â ÆÄÀÌÇÁ¶óÀÎ(Pipelines)À» »ç¿ëÇÏ¿© RISC¸¦ °³¼±ÇßÀ¸¸ç, ÆÄÀÌÇÁ¶óÀÎÀº ÇϳªÀÇ ¸í·ÉÀÌ ¼öÇàµÇ´Â µ¿¾È, load/store¸¦ ¿¬À̾ ¼öÇàÇϹǷΠÇÁ·Î¼¼¼­ÀÇ ¼º´ÉÀ» ³ô¿©ÁØ´Ù.

 

ÇöÀç MIPS´Â DVD Ç÷¹À̾î, ³×Æ®¿öÅ© Àåºñ, ÈÞ´ë¿ë ±â±â, ÈÞ´ë¿ë ºñµð¿À °ÔÀÓ±âµîÀÇ ´Ù¾çÇÑ ºÐ¾ß¿¡¼­ Ȱ¿ëµÇ°í ÀÖ´Ù.

 

 

MIPS ¸Þ¸ð¸®

¿À´Ã³¯ ´ëºÎºÐÀÇ ÄÄÇ»Å͵éÀº µ¥ÀÌÅ͸¦ 8ºñÆ®(1¹ÙÀÌÆ®, ¹®ÀÚ±â·ÏÀÇ ±âº»´ÜÀ§) ´ÜÀ§·Î ¸Þ¸ð¸®¿¡ ÀúÀåÇÑ´Ù.  MIPS´Â 0x00000000 ¿¡¼­ 0xFFFFFFFF ¹üÀ§¿¡ ÇØ´çÇÏ´Â 32ºñÆ® ÁÖ¼Ò °ø°£À» °¡Áö°í ÀÖ´Ù. (2^32 = 4GBytes)  ¸Þ¸ð¸®¿¡´Â ÇÁ·Î±×·¥ ¸í·É¾îµé°ú µ¥ÀÌÅ͵éÀÌ ÀúÀåµÈ´Ù.  MIPS´Â ¾Æ·¡¿Í °°ÀÌ ¸Þ¸ð¸® °ø°£À» ¿¹¾àÇÏ¿© »ç¿ëÇÑ´Ù.

 

 

0x7FFFFFFF  Stack Segment

2048MB

 

 

 

 

 

256MB       µ¥ÀÌÅ͵é

0x10000000  Data Segment

 

 

 


4MB         ÇÁ·Î±×·¥ ¸í·Éµé

0x00400000  Text Segment

 

 

 

 

MIPS ·¹Áö½ºÅ͵é

MIPS´Â ¾Æ·¡¿Í °°ÀÌ 32°³ÀÇ ¹ü¿ë ·¹Áö½ºÅ͵éÀ» °¡Áö°í ÀÖ´Ù.

 

¸íĪ

¹øÈ£

»ç¿ë¼³¸í

$zero

0

»ó¼ö 0

$at

1

¾î¼Àºí·¯¸¦ À§ÇØ ¿¹¾àµÇ¾î ÀÖÀ½

$v0

2

ÇÔ¼ö °á°úµé°ú Æò°¡Ç¥Çö

$v1

3

ÇÔ¼ö °á°úµé°ú Æò°¡Ç¥Çö

$a0

4

¸Å°³Ç׸ñ1 (argument1)

$a1

5

¸Å°³Ç׸ñ2 (argument2)

$a2

6

¸Å°³Ç׸ñ3 (argument3)

$a3

7

¸Å°³Ç׸ñ4 (argument4)

$t0

8

ÀÓ½Ã

$t1

9

ÀÓ½Ã

$t2

10

ÀÓ½Ã

$t3

11

ÀÓ½Ã

$t4

12

ÀÓ½Ã

$t5

13

ÀÓ½Ã

$t6

14

ÀÓ½Ã

$t7

15

ÀÓ½Ã

$s0

16

Àӽà ÀúÀå

$s1

17

Àӽà ÀúÀå

$s2

18

Àӽà ÀúÀå

$s3

19

Àӽà ÀúÀå

$s4

20

Àӽà ÀúÀå

$s5

21

Àӽà ÀúÀå

$s6

22

Àӽà ÀúÀå

$s7

23

Àӽà ÀúÀå

$t8

24

ÀÓ½Ã

$t9

25

ÀÓ½Ã

$k0

26

OS Ä¿³ÎÀ» À§ÇØ ¿¹¾àµÇ¾î ÀÖÀ½

$k1

27

OS Ä¿³ÎÀ» À§ÇØ ¿¹¾àµÇ¾î ÀÖÀ½

$gp

28

Àü¿ª¿µ¿ª Æ÷ÀÎÅÍ

$sp

29

½ºÅà Æ÷ÀÎÅÍ

$fp

30

ÇÁ·¹ÀÓ Æ÷ÀÎÅÍ

$ra

31

¸®ÅÏ ÁÖ¼Ò(ÇÔ¼ö È£Ãâ¿¡¼­ »ç¿ëµÊ)

 

·¹Áö½ºÅÍ »ç¿ë¿¹

lw    $t0, num1    #¸Þ¸ð¸® num1¿¡ ÀÖ´Â word(32ºñÆ®)¸¦ ·¹Áö½ºÅÍ $t0·Î Load

sw    $t0, num2    #·¹Áö½ºÅÍ $t0¿¡ ÀÖ´Â word(32ºñÆ®)¸¦ ¸Þ¸ð¸® num2·Î Store

li    $v0, 4       #immediate »ó¼ö 4¸¦ ·¹Áö½ºÅÍ $v0¿¡ Load

 

add   $t0, $t3, $t4    # $t0 := $t3 + $t4

 

 

MIPS ÇÁ·Î±×·¥ ±¸Á¶(Assembly Language)

# ÁÖ¼®¹®¿¡´Â ¼¥±âÈ£¸¦ ºÙÀδÙ.

# filename.s

# ÀÌ ÆÄÀÏÀº MIPS ¾î¼Àºí¸® ¾ð¾î ÇÁ·Î±×·¥ÀÇ ±¸Á¶ÀÌ´Ù.

 

.data    # ÀÌ ¶óÀÎ ´ÙÀ½ºÎÅÍ µ¥ÀÌÅÍ º¯¼öµéÀ» ¼±¾ðÇÑ´Ù.

 

.text    # ÀÌ ¶óÀÎ ´ÙÀ½ºÎÅÍ ¸í·É¾îµéÀ» ÄÚµùÇÑ´Ù.

 

main:    # ¸í·É Äڵ尡 ù¹øÂ°·Î ½ÃÀ۵Ǵ ÁöÁ¡ÀÌ´Ù.

 

 

MIPS ¾î¼Àºí¸®

Instruction

Operands

Description

add

d,s,t

d <-- s+t ; with overflow trap

addu

d,s,t

d <-- s+t ; without overflow trap

addi

d,s,const

d <-- s+const ; with overflow trap

      const is 16-bit two's comp

addiu

d,s,const

d <-- s+const ; without overflow trap

      const is 16-bit two's comp

and

d,s,t

d <-- bitwise AND of s with t

andi

d,s,const

d <-- bitwise AND of s with const

beq

s,t,addr

branch if s == t

A branch delay slot follows the instruction.

bgez

s,addr

Branch if the two's comp. integer

in register s is >= 0

A branch delay slot follows the instruction.

bltz

s,addr

Branch if the two's comp. integer

in register s is < 0

A branch delay slot follows the instruction.

bne

s,t,addr

branch if s != t

A branch delay slot follows the instruction.

div

s,t

lo <-- s div t ; hi <-- s mod t

   two's comp. operands

divu

s,t

lo <-- s div t ; hi <-- s mod t

   unsigned operands

j

target

after a delay of one machine cycle,

PC  <-- address of target

lb

d,off(b)

d <-- Sign-extended byte from

      memory address b+off

  off is 16-bit two's complement

lbu

d,off(b)

d <-- Zero-extended byte

      from memory address b+off

      off is 16-bit two's complement

lh

d,off(b)

t <-- Sign-extended halfword

      from memory address b+off

      off is 16-bit two's complement

lhu

d,off(b)

t <-- Zero-extended halfword

      from memory address b+off

      off is 16-bit two's complement

lui

d,const

upper two bytes of $t <-- two byte const

lower two bytes of $t <-- 0x0000

lw

d,off(b)

d <-- Word from memory address b+off

      off is 16-bit two's complement.

mfhi

d

d <-- hi ;  Move From Hi

mflo

d

d <-- lo ;  Move From Lo

mult

s,t

hi / lo < -- s * t ;  two's comp operands

multu

s,t

hi / lo < -- s * t ;  unsigned operands

nor

d,s,$0

d <-- bitwise NOT of s

nor

d,s,t

d <-- bitwise NOR of s with t

or

d,s,$0

d <-- s

or

d,s,t

d <--bitwise OR of s with t

ori

d,$0,const

d <-- zero-extended const

ori

d,s,const

d <-- s OR zero-extended const

 

sb

d,off(b)

byte at off+b <-- low-order byte

                  from register $d.

off is 16-bit two's complement

sh

d,off(b)

two bytes at off+b <-- two low-order bytes

                      from register $d.

off is 16-bit two's complement

sll

$0,$0,0

no operation

sll

d,s,shft

d <-- logical left shift of s by shft positions

      where  0 <= shft < 32

slt

d,s,t

if s < t

  d <-- 1

else

  d <-- 0

 

two's comp. operands

slti

d,s,imm

if s < imm

  d <-- 1

else

  d <-- 0

 

two's comp. operands

sltiu

d,s,imm

if s < imm

  d <-- 1

else

  d <-- 0

 

unsigned operands

sltu

d,s,t

if s < t

  d <-- 1

else

  d <-- 0

 

unsigned operands

sra

d,s,shft

d <-- arithmetic right shift of s by shft positions

      where  0 <= shft < 32

srl

d,s,shft

d <-- logical right shift of s by shft positions

      where  0 <= shft < 32

sub

d,s,t

d <-- s - t; with overflow trap

subu

d,s,t

d <-- s - t; no overflow trap

sw

d,off(b)

Word at memory address (b+off) <-- $t

b is a register. off is 16-bit twos complement.

xor

d,s,t

d <-- bitwise exclusive or of s with t

xori

d,s,const

d <-- bitwise exclusive or of s with const

 

 

 

 

 

À̵¿: Home à mips0101

 

ÁÖ¼Ò: http://www.kernel.bz/mips/01/mips0101.htm

ÀÌÆäÀÌÁöÀÇ ÀúÀÛ±ÇÀº

Á¦¸ñ: MIPS ¼Ò°³

ÀúÀÚ¿¡°Ô ÀÖ½À´Ï´Ù

ÀúÀÚ: Á¤ÀçÁØ(rgbi3307@nate.com)

ÃÖ±Ù¼öÁ¤ÀÏ:2009-01-18