• Nenhum resultado encontrado

#4 : Encoding MIPS Instructions

N/A
N/A
Protected

Academic year: 2023

Share "#4 : Encoding MIPS Instructions"

Copied!
9
0
0

Texto

(1)

#4 : Encoding MIPS Instructions

Computer Architecture 2021/2022 Computer Architecture 2021/2022

Ricardo Rocha

Computer Science Department, Faculty of Sciences, University of Porto

(2)

Instruction Set

The words of a computer’s language are called instructions and the

vocabulary of commands understood by a given architecture is called an instruction set. Common groups of instructions are:

• Arithmetic instructions

• Logical instructions

• Logical instructions

• Data transfer instructions

• Conditional branch instructions

• Unconditional jump instructions

(3)

Registers

MIPS has 32 registers, numbered from 0 to 31, each with 32 bits.

To identify a register in MIPS we thus need 5 bits (2

5

=32).

2

#2 : Representação em Vírgula Flutuante

Computer Architecture 2019/2020 #4 : Encoding MIPS Instructions 2

Computer Architecture 2021/2022

(4)

Instruction Format

MIPS instructions are encoded in binary, as 32-bit instruction words, called machine code. The layout of an instruction is called the

instruction format. Only 3 different formats exist.

(5)

Instruction Fields

MIPS fields have names to make them easier to discuss:

4

#2 : Representação em Vírgula Flutuante

Computer Architecture 2019/2020 #4 : Encoding MIPS Instructions 4

Computer Architecture 2021/2022

op – basic operation of the instruction, traditionally called the opcode

rs – the first register source operand

rt – the second register source operand

rd – the register destination operand, which gets the result of the operation

shamt – shift amount to be used in shift instructions, zero otherwise

funct – often called the function code, selects the specific variant of the

operation in the opcode field

(6)

Instruction Opcodes

(7)

R-format Function Codes

6

#2 : Representação em Vírgula Flutuante

Computer Architecture 2019/2020 #4 : Encoding MIPS Instructions 6

Computer Architecture 2021/2022

(8)

From Assembly to Machine Code

Consider the instruction: add $t0, $s1, $s2. Its decimal representation is:

op = 0 (arithmetic)

rs = 17 ($s1)

rt = 18 ($s2)

• rd = 8 ($t0)

shamt = 0 (not used)

shamt = 0 (not used)

funct = 32 (add)

And the binary representation is:

(9)

From Assembly to Machine Code

In branch (I-format) and jump (J-format) instructions, the address and

8

#2 : Representação em Vírgula Flutuante

Computer Architecture 2019/2020 #4 : Encoding MIPS Instructions 8

Computer Architecture 2021/2022

target address fields need to be shifted left 2 bits to correctly represent a valid instruction address (32-bits aligned).

beq $s1, $s2, 25 (25<<2 = 100)

j 2500 (2500<<2 = 10000)

Referências

Documentos relacionados

(...) não deveriam se dedicar a especializar os educadores em tipo de incapacidade, em uma categoria de alunos, mas estar voltados para o aprofundamento

Hoje, a Catedral Metropolitana de Campinas abriga em seu interior o Museu Arquidiocesano de Campinas, criado em 1969 por Dom Paulo de Tarso, e o Museu da

Em caso de morte da Pessoa Segura durante a viagem, o Segurador garante o pagamento, até ao limite fixado no Quadro de Garantias, do tratamento das formalidades no local e das

Neste breve ensaio, procura-se refletir sobre como a razão consagrou a divisão do homem em corpo e alma e sobre como essa dualidade se revelou na tradição hierárquica

Este relatório descreve todas as atividades realizadas durante o estágio curricular realizado no departamento de Logística da COFICAB Portugal, empresa multinacional que

Finalizado o processamento do jerked beef pela empresa, emi u-se novo termo de apreensão (14567913), referente aos produtos acabados. O relato evidencia, no que concerne

A proposta desta pesquisa é contribuir para o debate em torno dos livros didáticos escritos durante a Ditadura Militar em nosso país, trabalhando e decodificando suas imagens,

No 1T21, a companhia lançou 03 empreendimentos, totalizando R$221 milhões em VGV sendo 241% superior ao realizado no 1T20. Esses lançamentos i) Garden RNI, PCVA horizontal lançado