Instructions

instruction: words(commands) of computer’s language

Instruction set: the vocabulary of commands understood by a given architecture

MIPS

microprocessor without interlocked pipeline stages

Instruction set Architecture의 일종

컴파일러가 high level 언어를 MIPS Assembly instruction으로 바꾼다

Arithmetic Operations

add, subtract instruction

한 줄에는 한개의 Instruction만 사용할 수 있다.

하나의 instruction은 3개의 피연산자(operand)를 갖는다.

add a, b, c # sum of b and c is placed in a

맨 앞이dest, 뒤의 두개가 source. 모든 산술연산은 이 form을 따른다.

세 개의 operand로 사용되는 것은 32개의 register이다.

레지스터는 CPU안에 있는 speical location이다. 프로세서 안에 32개의 레지스터가 있고 각 레지스터 사이즈는 32비트이다. 32비트를 하나로 단위로 만든것이 word이다. 32비트 = 1word

레지스터 표현할때는 $을 쓴다. $s0 , $s1 등은 saved = 전역변수나 variable등을 저장함.

$t0은 temporary = function안에서 잃어버려도 되는 지역변수 등을 저장함.

operand로 사용되는 레지스터는 0번부터 31번까지 넘버링되어있음

레지스터가 너무 많아지면 CPU의 크기가 커져 clock cycle time을 증가시키기 때문에 32개만 사용함.

무제.png