Computer Architecture (4)

김동규·2023년 10월 8일
0

Computer Architecture

목록 보기
4/16

In this time, I learned about MIPS Instruction Set Architecture.

In the MIPS architecture, there is three types of instruction set.

  1. Arithmetic / Logic Instruction
  2. Data Transfer Instruction
  3. Control Insturction

Arithmetic / Logic Instruction

This insturction related to calculation of some numbers and logical calculations. If the number used to calculate bigger than register can store, or have to do division, we can use High register and Low register. In addition, we can use many instruction likes ADD, ADDI, AND, OR, etc.

For example, f = (g + h) - (i + j) this instruction can do MIPS instruction set.

Data transfer instruction

This concept is important to computer architecture. All of the data are stored in memory, so we need to load and save data in memory to register of register to memory. In this aspect, we should use instructions related to data transfer. However, MIPS has only two instructions (load / save) for memory access because MIPS use RISC(removed) architecture.

This is load word instruction to get data from the memory. This instruction means "visit memory number 8 + value of $s0, and load it to $s1".


This is save word instruction to save data to the memory. This instruction means "visit memroy number 12 + value of $s0, and save data from $s1".

By using this instructions, we can access memory and use the data.

Control Instruction

This instruction is usually used in our codes. We are create some codes using high-level programming language. In this language, there is some logic likes for-loop, if-condition, etc. These are move to other place in codes and do some actions. However, assembly language doesn't have this logic, so it just does some instructions like jump, beq, etc. This insturctions move other line and do some actions.

Instruction Format

There is three types of insturction R-type instruction, I-type instruction, and J-type instruction.

R-type instruction

This is the form of R-type insturction. In the R-type instruction, all Operation code is 0 and there is three section rs, rt, and rd. They are source operand and destination operand.

Shamt is shift amount. It is related to shift instruction. Finally, funct is function code that is related to kind of calculation.

I-type instruction

R-type insturctions are allowed just 5-bits to get constant value. In this way, if we want to get number bigger than 5-bits, we can not do that. So, MIPS implemented this I-type instruction concept.

It give 16-bits to get constant or address, so we can get more numbers rather than R-type insturctions.

It just give 16-bits to get constant or address, we can't get more size than 16-bits. This can be weak point in MIPS architecture. To resolve this problem, MIPS use LUI(Loading Upper Immediate). By breaking large number to small number, we can use load big number.

LUI(Load Upper Immediate) load 16-bits upper point and set lower point to 0. Next, by using ORI, ADDI, we can set lower point.

J-type instruction


This instruction assign 26-bits to jump other address.

Stored Program Concept

There is two principles about stored program concept.

  • Instructions are represented as numbers.
  • Programs are stored in memory.

Computer just know about 0 and 1, so we should express every instruction by using numbers and all of the instructions are stored in memory. For that reason, we just convery high-level language to assembly language and store it in memory and use them.

Fetch & Execute Cycle

All insturctions are stored in memory. Because of that, instructions are fetched and put into a special register(IR, instruction register).

Control Transfer Instruction

We can use PC(Program Counter) to move other instructions by changing the next instruction to be excuted.

Pseudo Instruction

This concept is used in MIPS architecture. Pseudo instruction is not instruction, but we can use it likes real instructions.

profile
안녕하세요 :)

0개의 댓글