Thursday, December 15, 2016

CHAPTER 6

Language Of Computer - MIPS

In MIS there have few stages. Assembly languages, Instruction, Assembly operands, Data transfer and Decision instruction.

Assembly language:

The computer job is execute lots of instruction. The set of instruction a particular CPU implement is an Instruction Set Architecture(ISA).

What is ISA?

The instruction set, also called instruction set architecture (ISA), is part of a computer that pertains to programming, which is basically machine language. The instruction set provides commands to the processor, to tell it what it needs to do.
Ex: Intel 80x86 (pentium 4).

🔸Early trend: They idea is want to add more instruction to CPU.

🔸RISC Philosophy: Change their system, It redeuse the instruction, but it increase the speed. It wants keep small and simple.


MIPS Architecture:

MIPS - Microprocessor without Interlocking Pipeline Stages.
MIPS processor: Originally used in Unix workstations, now mainly used in small devices. ( Play Station, routers, printers, robots, cameras ).

Assembly Variable is register, Register is a limited number of a special locations built in software. Register is a very fast in software. Register is a permenant number in system. It only have 32 register in MIPS.
Register is a number from 0 to 31

Ex:
   # sum = x + y
    lw      $t0, x          # Load x from memory into a CPU register
    lw      $t1, y          # Load y from memory into a CPU register
    add     $t0, $t0, $t1   # Add x and y
    sw      $t0, sum        # Store the result from the CPU register to memory

Another ways to make code is comments
[#] is used for end line in MIPS format. 

In assembly language, each statements called instruction.

 
This operation using MIPS format.













in this case, we should know the formats its use.

Register zero, can use 2 code. Zero & 💲0,

Immediates, they are no subract.

Assembly Operands:
=Memory containe such data structure. Data transfer between register and memory.

Memory to Reg: specify 2 things, register and Memory address.  REMEMBER(Load from memory)
                          >Register contain a pointer to memory.
                          > A numerical offset(in bytes)


                 ← Data flow
ex: lw 💲t0, 12(💲s0)

💲s0 called the base register,
12 is offset,                                               #### constant know at assembly time.

Reg to Memory

MIPS instruction name is sw          
 data flow ➡
sw 💲t0,12(💲s0)                                        ###store into memory.


Memory Organization

Viewed as a large single-dimension array with access by address.
In memory:

   
Big Little Indian

Big Endian
In big endian, you store the most significant byte in the smallest address. Here's how it would look:

AddressValue
100090
1001AB
100212
1003CD
Little Endian
In little endian, you store the least significant byte in the smallest address. Here's how it would look:


A
ddressValue
1000CD
100112
1002AB
100390

Notice that this is in the reverse order compared to big endian. To remember which is which, recall whether the least significant byte is stored first (thus, little endian) or the most significant byte is stored first (thus, big endian).

       

No comments:

Post a Comment