ac 12 orgarqarc imp

21
ARC ARCTools Arquitectura de Computadoras Organizaci´ on y Arquitectura del ARC Oscar Alvarado Nava [email protected] Departamento de Electr´ onica Divisi´ on de Ciencias B´ asicas e Ingenier´ ıa Universidad Aut´ onoma Metropolitana, Azcapotzalco 08O, octubre de 2008 Oscar Alvarado Nava UAM Azcapotzalco Organizaci´ on y Arquitectura del ARC 1/21

Upload: nazarenolazarte

Post on 12-Mar-2015

98 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura de ComputadorasOrganizacion y Arquitectura del ARC

Oscar Alvarado Nava

[email protected]

Departamento de ElectronicaDivision de Ciencias Basicas e Ingenierıa

Universidad Autonoma Metropolitana, Azcapotzalco

08O, octubre de 2008

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 1/21

Page 2: Ac 12 OrgArqARC Imp

ARCARCTools

Contenido

ARCArquitectura y OrganizacionARC

ARCToolsLinux

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 2/21

Page 3: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Arquitectura y Organizacion

I Arquitectura: Punto de vista del programadorI Conjunto de instruccionesI Registros de proposito general y proposito especıficoI Representacion de informacion y estructura de datos (tipos de

datos)I Acceso a memoria

I Organizacion: Punto de vista del disenadorI Unidades funcionalesI InterconexionI Microarquitectura

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 3/21

Page 4: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Estructura de bus

Chapter 4: The Instruction Set Architecture4-4

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

The System Bus Model of a ComputerSystem, Revisited

• A compiled program is copied from a hard disk to the memory.The CPU reads instructions and data from the memory, executesthe instructions, and stores the results back into the memory.

Syst

em B

us

Data Bus

Address Bus

Control Bus

(ALU, Registers,

and Control)

Memory Input and Output (I/O)

CPU

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 4/21

Page 5: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Ruta de datos y Unidad de control

Chapter 4: The Instruction Set Architecture4-8

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

Abstract View of a CPU• The CPU consists of a data section containing registers and an

ALU, and a control section, which interprets instructions and ef-fects register transfers. The data section is also known as thedatapath .

Control Unit

Control Section

Registers

ALU

Datapath(Data Section)

System

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 5/21

Page 6: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Ciclo fetch-decode-execute

1. Busqueda (fetch) de la siguiente instruccion en la memoria, lacual es llevada al registro de instruccion (IR)

2. Actualizacion de contador de programa (PC) para apuntar ala siguiente instruccion

3. Determinacion (decode) del tipo de instruccion

4. Si la instruccion requiere de operandos, determinar suubicacion

5. Si es necesario, llevar los parametros a los registros

6. Ejecucion (execute) de la instruccion y almacenamiento delresultado

7. Ir a 1

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 6/21

Page 7: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Ruta de datos tıpico

A + B

A + B

A

A

B

B

Registers

ALU input register

ALU output register

ALU

ALU input bus

Fig. 2-2. The data path of a typical von Neumann machine.

I Tipos de instruccion:registros-memoria,registro-registro

I Palabra: unidad de datosque puede ser movido entrela memoria y los registros

I Ciclo de ruta de datos:proceso de llevar dosoperandos a la ALU yalmacenar el resultado

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 7/21

Page 8: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Organizacion de memoria

Address 1 Cell

0

(c)

1

2

3

4

5

6

7

8

9

10

11

Address

0

Address

1

2

3

4

5

6

7

0

1

2

3

4

516 bits

(b)

12 bits

(a)

8 bits

Fig. 2-9. Three ways of organizing a 96-bit memory.Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 8/21

Page 9: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Datos multibyte con gcc y en i386

I En una maquina direccionable por byte, el menor tipo de datodireccionable en la memoria es un byte

I Una palabra es una secuencia de bytes en la memoriaI Los diferentes tipos de datos son creados por secuencias de

bytesI Caracter charI Entero intI Real float, double, long doubleI Apuntador a caracter char *I Apuntador a entero int *I Apuntador a real float *I Estructura con 1 caracter, 2 entero y 3 reales struct

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 9/21

Page 10: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Almacenamiento de datos multibyte

I Considere 0x12345678

I Se puede almacenar en 4 bytes, ¿En cualquier orden?

00

01

02

03

04

05

1 2

3 4

5 6

7 8

00

01

02

03

04

05

7 8

5 6

3 4

1 2

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 10/21

Page 11: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Endian

I Big Endian: el byte mas significativo en la direccion mas baja

I Little Endian: el byte menos significativo en la direccion masbaja

I ¿Como se podrıa saber si una maquina es big-endian olittle-endian?

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 11/21

Page 12: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

El CPU ARC

I El ARC esta basado en la arquitectura del SPARCI Scalable Processor ARChitectureI Desarrollado por Sun a mediados de los 80’s

I ARC: A RISC Computer

I El ARC es de 32 bits

I ISA: SPARC V8, V9

I Arquitectura abierta: LEON 2 y LEON 3 (IP)http://www.gaisler.com/leonmain.html

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 12/21

Page 13: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Ruta de datos del ARCChapter 4: The Instruction Set Architecture4-10

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

An ExampleDatapath

• The ARC datapath is made up of a collection of registers knownas the register file and the arithmetic and logic unit (ALU).

Register File

ALU

From Data Bus

To Data Bus

To Address Bus

Register Source 1

(rs1)

Register Source 2

(rs2)

Register Destination (rd)

Control Unit selects registers and ALU

function

Status to Control Unit

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 13/21

Page 14: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Formato de datos multibyte

I Varıan segun su interpretacionI Los numeros (negativos y positivos) se almacenan en

complemento a 2I Caracteres 8 bitsI Enteros signados de 8, 16 y 32 bits

I Numeros de punto flotante (8 y 32 bits) (HW y SW)

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 14/21

Page 15: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Mapa de memoria

Chapter 4: The Instruction Set Architecture4-7

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

Memory Map for the ARC• Memory loca-

tions are ar-ranged linearlyin consecutiveorder. Eachnumbered loca-tions corre-sponds to anARC word. Theunique numberthat identifieseach word isreferred to asits address .

Reserved for operating system

User Space

I/O space

0

2048

Stack pointerSystem Stack

Top of stack

Bottom of stack

DiskTerminal

Printer

232 – 4

231 – 4

32 bits

Address Data

232 – 1byte

MEMORY

Address Control

Data Out

Data In

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 15/21

Page 16: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Conjunto de registros del ARC

I 32 registros de 32 bits de proposito general ( %r0 - %r31)I Apuntador a la pila %sp y registro de enlace (link) %r15

I Registro de instruccionIR y contador de programa PC

I Registro de estado del procesador PSR (banderas aritmeticas ocodigos de condicion)

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 16/21

Page 17: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Registros del ARC Chapter 4: The Instruction Set Architecture4-13

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

ARC User-Visible RegistersRegister 00 %r0 [= 0]

Register 01 %r1

Register 02 %r2

Register 03 %r3

Register 04 %r4

Register 05 %r5

Register 06 %r6

Register 07 %r7

Register 08 %r8

PSR %psr PC %pc

Register 09 %r9

Register 10 %r10

Register 11 %r11

Register 12 %r12

Register 13 %r13

Register14 %r14 [%sp]

Register 15 %r15 [link]

32 bits 32 bits

Register 16 %r16

Register 17 %r17

Register 18 %r18

Register 19 %r19

Register 20 %r20

Register 21 %r21

Register 22 %r22

Register 23 %r23

Register 24 %r24

Register 25 %r25

Register 26 %r26

Register 27 %r27

Register 28 %r28

Register 29 %r29

Register 30 %r30

Register 31 %r31

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 17/21

Page 18: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Conjunto de instrucciones ISA

I Todas las instrucciones se conforman de una palabra, 32 bits

I El conjunto instrucciones del SPARC tiene aproximadamente200 instrucciones

I Arquitectura load-store

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 18/21

Page 19: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Conjunto de instrucciones ISAChapter 4: The Instruction Set Architecture4-11

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

The ARC ISA• The ARC ISA is a subset of the SPARC ISA.

ld Load a register from memory

Mnemonic Meaning

st

sethi

andcc

addcc

call

jmpl

be

orcc

orncc

Store a register into memory

Load the 22 most significant bits of a register

Bitwise logical AND

Add

Branch on overflow

Call subroutine

Jump and link (return from subroutine call)

Branch if equal

Bitwise logical OR

Bitwise logical NOR

bneg

bcs

Branch if negative

Branch on carry

srl Shift right (logical)

bvs

ba Branch always

Memory

Logic

Arithmetic

Control

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 19/21

Page 20: Ac 12 OrgArqARC Imp

ARCARCTools

Arquitectura y OrganizacionARC

Formato de lenguaje ensamblador Chapter 4: The Instruction Set Architecture4-12

© 1999 M. Murdocca and V. HeuringPrinciples of Computer Architecture by M. Murdocca and V. Heuring

ARC Assembly Language Format• The ARC assembly language format is the same as the SPARC as-

sembly language format.

lab_1: addcc %r1, %r2, %r3 ! Sample assembly code

Label MnemonicSource

operands CommentDestination

operand

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 20/21

Page 21: Ac 12 OrgArqARC Imp

ARCARCTools

Linux

ARC en linux

$ wget http://java.sun.com/downloads/jdk-6u2-linux-i586.bin

# mkdir /usr/java

# cd /usr/java

# chmod +x ∼/jdk-6u2-linux-i586.bin# ∼/jdk-6u2-linux-i586.bin$ wget ftp://schof.colorado.edu/pub/CAO/Tools/ARCToolsv2.1.2.zip

$ mkdir ARCTools

$ cd ARCTools

$ unzip ARCToolsv2.1.2.zip

$ /usr/java/jdk1.6.0 02/bin/java -jar ARCToolsv2.1.2.jar

Oscar Alvarado Nava UAM Azcapotzalco Organizacion y Arquitectura del ARC 21/21