• Nenhum resultado encontrado

Disciplina de. Organização de Computadores Digitais

N/A
N/A
Protected

Academic year: 2021

Share "Disciplina de. Organização de Computadores Digitais"

Copied!
16
0
0

Texto

(1)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

Out. 2014 1

Prof. Fernando Santos Osório

Email: fosorio [at] { icmc. usp. br , gmail. com }

Página Pessoal: http://www.icmc.usp.br/~fosorio/

Material on-line: Wiki ICMC:

http://wiki.icmc.usp.br/index.php/SSC-511-2014(fosorio)

USP - ICMC - SSC

SSC 0511 - Sist. Informação - 2o. Semestre 2014

Disciplina de

Organização de Computadores Digitais

Aula 10s

Lab. de Robótica Móvel

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

Out. 2014 2

Microprocessadores RISC

Conteúdos Abordados:

1. Microprocessador RISC:

MIPS e ARM

2. Arquitetura da Processador MIPS

3. Programação do Processador MIPS

4. Simulação do Processador MIPS

(2)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

3

Microprocessador RISC Comerciais

Microprocessador Comerciais: “Famosos”

MIPS e ARM => Origem

MIPS:

John L. Hennessy at Stanford University

1981: Microprocessor without Interlocked Pipeline Stages is a RISC processor

developed by MIPS Technologies (formerly MIPS Computer Systems, Inc.). The

early MIPS architectures were 32-bit, with 64-bit versions added later. Multiple

revisions of the MIPS instruction set exist, including MIPS I, MIPS II, MIPS III,

MIPS IV, MIPS V, MIPS32, and MIPS64. The current revisions are MIPS32 (for

32-bit) and MIPS64 (for 64-32-bit)

ARM:

Inspired by white papers on the Berkeley RISC proj. / Acorn Computers

1985/1990: Advanced RISC machines (ARM) spins out of Acorn & Apple

Computers collaboration efforts with a charter to create new microprocessor

standard. VLSI Technology becomes an ARM investor and the first Licensee of

ARM processor IP.

Out. 2014

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

Out. 2014 4

Microprocessador RISC

Arquitetura RISC

Processadores Comerciais: MIPS

(3)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

Agosto 2008 5

Microprocessador RISC

Arquitetura RISC

Processadores

Comerciais:

ARM

Advanced RISC Machines

ARM Core

Diagram

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

6

Microprocessador RISC Comerciais

MIPS & ARM: Características

- RISC Architetures

- Bancos de Registradores

- Instruções de tamanho fixo e regulares

- Pipeline de instrução otimizado

-

Baixo Custo

-

Baixo Consumo

-

Alto desempenho

(4)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

7

Microprocessador RISC Comerciais

Microprocessador Comerciais: “Famosos”

MIPS e ARM => Produtos

MIPS:

Processors R2000, R3000, R4000, R6000, R8000, ... MIPS32, MIPS64

Sony PS2, PS Portable, Qualcomm, Atheros, Broadcom, SGI Onyx

ARM:

Out. 2014

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

8

Microprocessador RISC Comerciais

Microprocessador Comerciais: “Famosos”

MIPS e ARM => Produtos

MIPS:

Processors R2000, R3000, R4000, R6000, R8000, ... MIPS32, MIPS64

Sony PS2, PS Portable, Qualcomm, Atheros, Broadcom, SGI Onyx

ARM:

Out. 2014

* ARM: Ver slides

complementares

(5)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

9

SIMULADOR do MIPS: SPIM

Out. 2014

Microprocessador RISC: MIPS

Windows

Linux

GUI

Line Cmd

Refs.:

• Livro: “Organização e Projeto de Computadores”

David A. Patterson & John L. Hennessy

[Apêndice B]

• Web site: James Larus

http://spimsimulator.sourceforge.net/

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

10

Microprocessador RISC: MIPS

MIPS

Registradores

(6)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

11

Microprocessador RISC: MIPS

MIPS

Instruções

Out. 2014

http://pages.cs.wisc.edu/~larus/HP_AppA.pdf

* MIPS Instruction Set

Ver Referências Complementares

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

12

Microprocessador RISC: MIPS

MIPS

Instruções

CPU

&

FPU

Out. 2014

(7)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

13

Microprocessador RISC: MIPS

MIPS

System Calls

Out. 2014

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

14

Microprocessador RISC: MIPS

MIPS

Instruções

Out. 2014

li = Load Immediate

la = Load Address

syscall = System Call (Software Interrupt Call)

b = Unconditional Branch

bgtz = Branch Greater than Zero

bltz = Branch Less than Zero

bgez = Branch Greater Equal Zero

blez = Branch Less than Equal Zero

+Infos:

> Help do SPIM

> Apendice Livro Hennessy (By Larus)

http://pages.cs.wisc.edu/~larus/HP_AppA.pdf

(8)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

15

Microprocessador RISC: MIPS

MIPS

Instruções

Out. 2014

li = Load Immediate

la = Load Address

lw = Load Word (32 bits)

syscall = System Call (Software Interrupt Call)

# helloworld.s

#

# Print out "Hello World"

# Copyright (c) 2013, James R. Larus.

.data

msg: .asciiz "Hello World"

.text

.globl main

main: li $v0, 4 # syscall 4 (print_str)

la $a0, msg # argument: string

syscall # print the string

END:

li $v0, 10

# exits program

syscall

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

16

Microprocessador MIPS

REFERÊNCIAS COMPLEMENTARES: MIPS & SPIM

Out. 2014

MIPS PROCESSOR

http://en.wikipedia.org/wiki/MIPS_instruction_set

http://en.wikipedia.org/wiki/List_of_MIPS_microarchitectures

SIMULADOR SPIM

http://spimsimulator.sourceforge.net/

http://pages.cs.wisc.edu/~larus/spim.html

DOCUMENTAÇÃO:

http://pages.cs.wisc.edu/~larus/HP_AppA.pdf

(

Apêndice Livro Hennessy

)

CODE Examples:

http://www.cs.uic.edu/~troy/spring04/cs366/

(ver em: “Information for the MIPS Simulator – SPIM”)

http://chortle.ccsu.edu/AssemblyTutorial/index.html

(9)

USP - SSC-511 – Bach. Sist Info / 2014-2 Organização de Computadores Digitais Prof. Fernando Osório

Out. 2014 17

INFORMAÇÕES SOBRE A DISCIPLINA

USP - Universidade de São Paulo - São Carlos, SP

ICMC - Instituto de Ciências Matemáticas e de Computação

SSC - Departamento de Sistemas de Computação

Prof. Fernando Santos OSÓRIO

Web institucional: http://www.icmc.usp.br/ssc/

Página pessoal: http://www.icmc.usp.br/~fosorio/

E-mail: fosorio [at] icmc. usp. br ou fosorio [at] gmail. com

Disciplina de Organização de Computadores Digitais / BSI

Web disciplina: Wiki ICMC -

Http://wiki.icmc.usp.br

> Programa, Material de Aulas, Critérios de Avaliação,

> Lista de Exercícios, Trabalhos Práticos, Datas das Provas

18 18

ARM PROCESSOR

Slides Complementares

ARM

Agosto 2008 18

(10)

19 19

Architecture Revisions

1998 2000 2002 2004 time ve rs io n ARMv5 ARMv6 1994 1996 2006 V4 StrongARM® ARM926EJ-S™ XScaleTM ARM102xE ARM1026EJ-S™ ARM9x6E ARM92xT ARM1136JF-S™ ARM7TDMI-S™ ARM720T™

XScale is a trademark of Intel Corporation

ARMv7 SC100™ SC200™ ARM1176JZF-S™ ARM1156T2F-S™ ARM PROCESSOR 20 20

Data Sizes and Instruction Sets

The ARM is a 32-bit architecture.

When used in relation to the ARM:

Byte

means 8 bits

Halfword

means 16 bits (two bytes)

Word

means 32 bits (four bytes)

Most ARM’s implement two instruction sets

32-bit ARM Instruction Set

16-bit Thumb Instruction Set

Jazelle cores can also execute Java bytecode

ARM PROCESSOR

(11)

21 21

Processor Modes

The ARM has seven basic operating modes:

User

: unprivileged mode under which most tasks run

FIQ

: entered when a high priority (fast) interrupt is raised

IRQ

: entered when a low priority (normal) interrupt is raised

Supervisor

: entered on reset and when a Software Interrupt

instruction is executed

Abort

: used to handle memory access violations

Undef

: used to handle undefined instructions

System

: privileged mode using the same registers as user mode

ARM PROCESSOR 22 22 r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 (sp) r14 (lr) r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

FIQ

IRQ

SVC

Undef

Abort

User Mode

r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 (sp) r14 (lr) r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

Current Visible Registers

Banked out Registers

FIQ

IRQ

SVC

Undef

Abort

r0 r1 r2 r3 r4 r5 r6 r7 r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

Current Visible Registers

Banked out Registers

User

IRQ

SVC

Undef

Abort

r8 r9 r10 r11 r12 r13 (sp) r14 (lr)

FIQ Mode

IRQ Mode

r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

Current Visible Registers

Banked out Registers

User

FIQ

SVC

Undef

Abort

r13 (sp) r14 (lr)

Undef Mode

r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

Current Visible Registers

Banked out Registers

User

FIQ

IRQ

SVC

Abort

r13 (sp) r14 (lr)

SVC Mode

r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

Current Visible Registers

Banked out Registers

User

FIQ

IRQ

Undef

Abort

r13 (sp) r14 (lr)

Abort Mode

r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r15 (pc) cpsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r13 (sp) r14 (lr) spsr r8 r9 r10 r11 r12 r13 (sp) r14 (lr) spsr

Current Visible Registers

Banked out Registers

User

FIQ

IRQ

SVC

Undef

r13 (sp) r14 (lr)

(12)

23 23

Program Status Registers

Condition code flags

N = Negative result from ALU

Z = Zero result from ALU

C = ALU operation Carried out

V = ALU operation oVerflowed

Sticky Overflow flag - Q flag

Architecture 5TE/J only

Indicates if saturation has occurred

J bit

Architecture 5TEJ only

J = 1: Processor in Jazelle state

Interrupt Disable bits.

I = 1: Disables the IRQ.

F = 1: Disables the FIQ.

T Bit

Architecture xT only

T = 0: Processor in ARM state

T = 1: Processor in Thumb state

Mode bits

Specify the processor mode

27 31 N Z C V Q 28 7 6 I F T mode 16 23 8 15 5 4 0 24 f s x c U n d e f i n e d J ARM PROCESSOR 24 24

When the processor is executing in ARM state:

All instructions are 32 bits wide

All instructions must be word aligned

Therefore the

pc

value is stored in bits [31:2] with bits [1:0] undefined (as

instruction cannot be halfword or byte aligned)

When the processor is executing in Thumb state:

All instructions are 16 bits wide

All instructions must be halfword aligned

Therefore the

pc

value is stored in bits [31:1] with bit [0] undefined (as

instruction cannot be byte aligned)

When the processor is executing in Jazelle state:

All instructions are 8 bits wide

Processor performs a word access to read 4 instructions at once

(13)

25 25

ARM instructions can be made to execute conditionally by postfixing them with the

appropriate condition code field.

This improves code density and performance by reducing the number of

forward branch instructions.

CMP r3,#0 CMP r3,#0

BEQ skip ADDNE r0,r1,r2

ADD r0,r1,r2

skip

By default, data processing instructions do not affect the condition code flags but

the flags can be optionally set by using “S”. CMP does not need “S”.

loop

SUBS r1,r1,#1

BNE loop

if Z flag clear then branch

decrement r1 and set flags

Conditional Execution and Flags

PROCESSOR ARM

26 26

Condition Codes

Not equal

Unsigned higher or same Unsigned lower Minus Equal Overflow No overflow Unsigned higher Unsigned lower or same Positive or Zero

Less than Greater than Less than or equal Always Greater or equal

EQ

NE

CS/HS

CC/LO

PL

VS

HI

LS

GE

LT

GT

LE

AL

MI

VC

Suffix Description Z=0 C=1 C=0 Z=1 Flags tested N=1 N=0 V=1 V=0 C=1 & Z=0 C=0 or Z=1 N=V N!=V Z=0 & N=V Z=1 or N=!V

The possible condition codes are listed below

Note AL is the default and does not need to be specified

ARM PROCESSOR

(14)

27 27

Conditional execution examples

if (r0 == 0)

{

r1 = r1 + 1;

}

else

{

r2 = r2 + 1;

}

C source code

 5 instructions

 5 words

 5 or 6 cycles

 3 instructions

 3 words

 3 cycles

CMP r0, #0

BNE else

ADD r1, r1, #1

B end

else

ADD r2, r2, #1

end

...

ARM instructions

unconditiona

l

CMP r0, #0

ADDEQ r1, r1, #1

ADDNE r2, r2, #1

...

conditional

ARM PROCESSOR 28 28

Data Processing Instructions

Consist of :

Arithmetic:

ADD ADC SUB SBC RSB RSC

Logical:

AND ORR EOR BIC

Comparisons:

CMP CMN TST TEQ

Data movement:

MOV MVN

These instructions only work on registers, NOT memory.

Syntax:

<Operation>{<cond>}{S} Rd, Rn, Operand2

Comparisons set flags only - they do not specify Rd

Data movement does not specify Rn

Second operand is sent to the ALU via barrel shifter.

ARM PROCESSOR

(15)

29 29

Register Usage

r8 r9/sb r10/sl r11 r12 r13/sp r14/lr r15/pc r0 r1 r2 r3 r4 r5 r6 r7

Register variables

Must be preserved

Arguments into function

Result(s) from function

otherwise corruptible

(

Additional parameters passed on stack)

Scratch register

(corruptible)

Stack Pointer

Link Register

Program Counter

The compiler has a set of rules known as a Procedure

Call Standard that determine how to pass parameters to

a function (see

AAPCS

)

CPSR flags may be corrupted by function call.

Assembler code which links with compiled code must

follow the AAPCS at external interfaces

The AAPCS is part of the new ABI for the ARM

Architecture

Register

- Stack base

- Stack limit if software stack checking selected

- R14 can be used as a temporary once value stacked - SP should always be 8-byte (2 word) aligned

ARM PROCESSOR

30 30

Pipeline changes for ARM9TDMI

Instruction

Fetch Shift + ALU

Memory Access Reg Write Reg Read Reg Decode

FETCH

DECODE

EXECUTE

MEMORY

WRITE

ARM9TDMI

ARM or Thumb Inst Decode

Reg Select

Reg

Read Shift ALU

Reg Write ThumbARM decompress ARM decode Instruction Fetch

FETCH

DECODE

EXECUTE

ARM7TDMI

ARM PROCESSOR

(16)

31 31

ARM10 vs. ARM11 Pipelines

ARM11

Fetch 1

Fetch

2 Decode Issue

Shift ALU Saturate

Write back MAC 1 MAC 2 MAC 3 Address Data Cache 1 Data Cache 2

Shift + ALU Memory

Access Reg

Write

FETCH

DECODE

EXECUTE

MEMORY

WRITE

Reg Read Multiply Branch Prediction Instruction Fetch

ISSUE

ARM or Thumb Instruction Decode Multiply Add

ARM10

ARM PROCESSOR 32 32

ARM

Referências:

* Slides ARM - Material disponibilizado em:

www.arm.com/files/ppt/ARM_Teaching_Material.ppt

ARM – Referências Complementares:

* History

http://www.next100billionchips.com/?page_id=281

* Company

http://www.arm.com/about/company-profile/milestones.php

* Arquitetura Processador (Wikipedia)

Referências

Documentos relacionados

• CI Contador de Instruções ou PC - Program Counter (Inglês) - armazena o endereço da próxima instrução a ser executada, tem sempre o mesmo tamanho do REM.

Os fanclipes e os inúmeros videoclipes feitos pelos fãs (recombinando imagens, ressignificando sonoridades) parecem ser a premissa para a criação neste período amplamente

No artigo contido no anexo 4, “THE INTERPLAY BETWEEN EVENT AND BACKGROUND SEDIMENTATION AND THE ORIGIN OF FOSSIL-RICH CARBONATE CONCRETIONS: A CASE STUDY IN

Outro ponto que é por vezes discutido é que o oleo bruto contem algum principio que não permanece no oleo purificado, donde se suppôr o primeiro muito mais activo.. Quando o

responsável pelo policiamento ostensivo da área onde ocorrerá o Espetáculo Público artístico, cultural, desportivo e outros, desde que realizados em ambiente fechado. ou em

■ Como organizar um sistema computacional a partir de diferentes processos que comunicam entre si. ■ Como

Informa¸ c˜ ao A Disciplina Pr´ atica Mat´ eria Novas coisas Programa¸ c˜ ao Conclus˜ ao. ORGC Apresenta¸ c˜ ao da disciplina –

Os candidatos aprovados no Concurso Público serão convocados pela TABOÃOPREV - Unidade Gestora Única do Regime Próprio de Previdência Social do Município de