Elementos de Lógica Digital II

Similar documents
Reconfigurable Computing Systems ( L) Fall 2012 Tiny Register Machine (TRM)

Assembly Language Programming of 8085

Practical Malware Analysis

Basic Processor Design

Assembly Language Programming of 8085

10-1 C D Pearson Education, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 4e

TYPES OF INTERRUPTS: -

INSTRUCTION SET OF 8085


Lecture 4: MIPS Instruction Set

Registers. Registers

Architecture & Instruction set of 8085 Microprocessor and 8051 Micro Controller

TABLE 9-1. Symbolic Convention for Addressing Modes. Register indirect LDA (R1) ACC M[ R1] Refers to Figure 9-4. Addressing mode. Symbolic convention

Computer Organization and Technology Processor and System Structures

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

8085 INSTRUCTION SET INSTRUCTION DETAILS

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Programming of 8085 microprocessor and 8051 micro controller Study material

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

It is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.

COMPUTER HARDWARE. Instruction Set Architecture

(2) Explain the addressing mode of OR What do you mean by addressing mode? Explain diff. addressing mode for 8085 with examples.

SOEN228, Winter Revision 1.2 Date: October 25,

Chapter 4. The Processor

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

omputer Design Concept adao Nakamura

COMPUTER ORGANIZATION & ARCHITECTURE

Computer Organization and Architecture, Pt. 2

EN164: Design of Computing Systems Lecture 24: Processor / ILP 5

Understand the factors involved in instruction set

Introduction. 3 major parts of CPU : Fig Design Examples of simple CPU. In this chapter : Chap. 8. Chap. 8 Central Processing Unit

Architecture. Digital Computer Design

Lecture 7: Instruction Set Architectures - IV. Last time - MIPS ISA (a visual)

Second Part of the Course

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

Review Questions. 1 The DRAM problem [5 points] Suggest a solution. 2 Big versus Little Endian Addressing [5 points]

COS 140: Foundations of Computer Science

Chapter 4. The Processor

Its Assembly language programming

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

ECE232: Hardware Organization and Design

Microcontroller Intel [Instruction Set]

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

OSIAC Read OSIAC 5362 posted on the course website

Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE

Lectures 3-4: MIPS instructions

Chapter 2 Data Manipulation

Computer Organization

Unsigned Binary Integers

Unsigned Binary Integers

Chapter 3 : Control Unit

Real instruction set architectures. Part 2: a representative sample

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

3.0 Instruction Set. 3.1 Overview

Virtual Machine Tutorial

THE MICROPROCESSOR Von Neumann s Architecture Model

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs

Microprocessors 1. The 8051 Instruction Set. Microprocessors 1 1. Msc. Ivan A. Escobar Broitman

Tutorial 1: Programming Model 1

The Processor: Datapath and Control. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

This simulated machine consists of four registers that will be represented in your software with four global variables.

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

CPU: SOFTWARE ARCHITECTURE INSTRUCTION SET (PART

Machine code. Nils Jansen December 12, 2017

SCRAM Introduction. Philipp Koehn. 19 February 2018

CSC 8400: Computer Systems. Machine-Level Representation of Programs

Architecture 6.1 INTRODUCTION

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

Hardware Level Organization

Part II Instruction-Set Architecture. Jan Computer Architecture, Instruction-Set Architecture Slide 1

16.1. Unit 16. Computer Organization Design of a Simple Processor

Introduction to Computers & Programming

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

A Bit of History. Program Mem Data Memory. CPU (Central Processing Unit) I/O (Input/Output) Von Neumann Architecture. CPU (Central Processing Unit)

Fig: Computer memory with Program, data, and Stack. Blog - NEC (Autonomous) 1

The Stored Program Computer

Computers in Engineering COMP 208. Computer Structure. Computer Architecture. Computer Structure Michael A. Hawker

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

EC 413 Computer Organization

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

UNIT 8C Computer Organization: The Machine s Language. von Neumann Architecture

Computer Organization MIPS ISA

Towards the Hardware"

Processor (I) - datapath & control. Hwansoo Han

Chapter 3 MIPS Assembly Language. Ó1998 Morgan Kaufmann Publishers 1

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

SN8F5000 Family Instruction Set

8051 Microcontroller

Introduction to Assembly Language Programming (Instruction Set) 1/18/2011 1

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Computer Organization CS 206 T Lec# 2: Instruction Sets

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

Processor Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Computer Science and Engineering 331. Midterm Examination #1. Fall Name: Solutions S.S.#:

PESIT Bangalore South Campus

Transcription:

Elementos de Lógica Digital II COMP09 μprocessor Vanderlei Bonato Eduardo Simões 07/11/2010 1

Introduction Architecture: the programmer s view of the computer Defined by instructions (operations) and operand locations Microarchitecture: how to implement an architecture in hardware Application Software Operating Systems Architecture Microarchitecture Logic Digital Circuits Analog Circuits Devices programs device drivers instructions registers datapaths controllers adders memories AND gates NOT gates amplifiers filters transistors diodes Physics electrons 07/11/2010 2

Assembly Language To command a computer, you must understand its language. Instructions: words in a computer s language Instruction set: the vocabulary of a computer s language Instructions indicate the operation to perform and the operands to use. Assembly language: human-readable format of instructions Machine language: computer-readable format Computers only understand 1 s and 0 s Binary representation of instructions 07/11/2010 3

Stored Program Sequence of instructions: only difference between two applications (for example, a text editor and a video game) To run a new program: No rewiring required Simply store new program in memory The processor hardware executes the program: fetches (reads) the instructions from memory in sequence performs the specified operation The program counter (PC) keeps track of the current instruction 07/11/2010 4

What needs to be stored in memory? Instructions (also called text) Data Global/static: allocated before program begins Dynamic: allocated within program How big is memory? At most 2 32 = 4 gigabytes (4 GB) From address 0x00000000 to 0xFFFFFFFF 07/11/2010 5

Ada Lovelace, 1815-1852 Wrote the first computer program Her program calculated the Bernoulli numbers on Charles Babbage s Analytical Engine She was the only legitimate child of the poet Lord Byron 07/11/2010 6

Programming High-level languages: e.g., C, Java, Python Written at more abstract level Common high-level software constructs: if/else statements for loops while loops array accesses procedure calls Other useful instructions: Arithmetic/logical instructions Branching 07/11/2010 7

How do we compile & run an application? High Level Code Compiler Assembly Code Assembler Object File Object Files Library Files Linker Executable Loader Memory 07/11/2010 8

Grace Hopper, 1906-1992 Graduated from Yale University with PhD in mathematics Developed first compiler Helped develop the COBOL programming language Highly awarded naval officer Received World War II Victory Metal and National Defense Service Medal, among others 07/11/2010 9

RISC x CISC architecture - RISC (Reduced Instruction Set Computer) - A small number of simple instructions - Hardware to decode and execute the instruction can be simple, small, and fast. - More complex instructions (that are less common) can be performed using multiple simple instructions. - Other architectures, such as Intel s IA-32 found in many PC s, are complex instruction set computers (CISC). They include complex instructions that are rarely used, such as the string move instruction that copies a string (a series of characters) from one part of memory to another. 07/11/2010 10

The COMP09 μprocessor COMP09 architecture: Developed by Eduardo do Valle Simões and Vanderlei Bonato at ICMC/USP. RISC architecture type 16-bit instructions Four instruction formats: R-type: register operands JB-type: jump and branch instruction type C-type: system control S-type: stack operations 07/11/2010 11

The ucomp09 register set Name Qtt Purpose R n 0-7 General purpose FR 1 Bits of flag SP 1 Stack pointer PC 1 Program counter IR (interno) 1 Instruction register MAR (interno) 1 Memory address buffer MBR (interno) 1 Data memory buffer 07/11/2010 12

Instruction format Register operands (R-type) op = opcode rx, ry, rz: registers c: bit of carry op rx ry rz c 6 bits 3 bits 3 bits 3 bits 1 bit 07/11/2010 13

Data manipulation instructions Direct address mode STORE END RX MEM(END) <- RX 110001 RX xxx xxx x END LOAD RX END RX <- MEM(END) 110000 RX xxx xxx x END Immediate address mode STOREIMED RX NR MEM(RX) <- #NR 111001 RX xxx xxx x NR LOADIMED RX NR RX <- #NR 111000 RX xxx xxx x NR Indexed address mode STOREINDEX RY RX MEM(RY) <- RX 111101 RX RY xxx x LOADINDEX RX RY RX <- MEM(RY) 111100 RX RY xxx x MOV RX RY RX <- RY 110011 RX RY xxx x 07/11/2010 14

Arithmetic instructions ADD RX RY RZ RZ<-RX+RY 100000 RX RY RZ 0 ADDC RX RY RZ RZ<-RX+RY+C 100000 RX RY RZ 1 SUB RX RY RZ RZ<-RX-RY 100001 RX RY RZ 0 SUBC RX RY RZ RZ<-RX-RY+C 100001 RX RY RZ 1 MULT RX RY RZ RZ<-RX*RY 100010 RX RY RZ 0 MULTC RX RY RZ RZ<-RX*RY+C 100010 RX RY RZ 1 DIV RX RY RZ RZ<-RX/RY 100011 RX RY RZ 0 DIVC RX RY RZ RZ<-RX/RY+C 100011 RX RY RZ 1 INC RX RX++ 100100 RX xxx xxx 0 DEC RX RX-- 100100 RX xxx xxx 1 07/11/2010 15

Logic instructions LAND RX RY RZ RZ<-RX AND RY 010010 RX RY RZ x LOR RX RY RZ RZ<-RX OR RY 010011 RX RY RZ x LXOR RX RY RZ RZ<-RX XOR RY 010100 RX RY RZ x LNOT RX RX<-NOT(RX) 010101 RX RY xxx x ROT L RX ROTATE TO LEFT 010000 RX xxx x1x 0 ROT R RX ROTATE TO RIGHT 010000 RX xxx x1x 1 SHIFT L0 RX SHIFT TO LEFT (FILL 0) 010000 RX xxx x00 0 SHIFT L1 RX SHIFT TO LEFT (FILL 1) 010000 RX xxx x01 0 SHIFT R0 RX SHIFT TO RIGHT (FILL 0) 010000 RX xxx x00 1 SHIFT R1 RX SHIFT TO RIGHT (FILL 1) 010000 RX xxx x01 1 CMP RX RY FR<-COND 010110 RX RY xxx x 07/11/2010 16

Input and Output (I/O) instructions Input INCHAR RX RX<- 00000000 &key 110101 RX xxx xxx x Output OUTCHAR RX RY VIDEO(RY)<-CHAR(RX) 110001 RX RY xxx x 07/11/2010 17

Instruction format Jump and Branch (JB-type) op op <cond> +/- inc 6 bits 4 bits 1 bit 5 bits 07/11/2010 18

Branch instructions Branches only if the condition is true BRA +/-INC PC<-PC +/- INC 000001 0000 +/- INC BEQ +/-INC PC<-PC +/- INC 000001 0011 +/- INC BNE +/-INC PC<-PC +/- INC 000001 0101 +/- INC BZ +/-INC PC<-PC +/- INC 000001 1010 +/- INC BNZ +/-INC PC<-PC +/- INC 000001 1011 +/- INC BC +/-INC PC<-PC +/- INC 000001 0111 +/- INC BNC +/-INC PC<-PC +/- INC 000001 1000 +/- INC BGR +/-INC PC<-PC +/- INC 000001 0010 +/- INC BLE +/-INC PC<-PC +/- INC 000001 0001 +/- INC BEG +/-INC PC<-PC +/- INC 000001 0100 +/- INC BEL +/-INC PC<-PC +/- INC 000001 0101 +/- INC BOV +/-INC PC<-PC +/- INC 000001 1001 +/- INC BNOV +/-INC PC<-PC +/- INC 000001 1100 +/- INC 07/11/2010 19

Jump instructions (all with END) Jumps to END only if the condition is true JMP END PC<-END 000010 0000 x xxxxx END JEQ END PC<-END 000010 0000 x xxxxx JNE END PC<- END 000010 0101 x xxxxx JZ END PC<- END 000010 1010 x xxxxx JNZ END PC<- END 000010 1011 x xxxxx JC END PC<- END 000010 0111 x xxxxx JNC END PC<- END 000010 1000 x xxxxx JGR END PC<- END 000010 0010 x xxxxx JLE END PC<- END 000010 0001 x xxxxx JEG END PC<- END 000010 0100 x xxxxx JEL END PC<- END 000010 0101 x xxxxx JOV END PC<- END 000010 1001 x xxxxx JNOV END PC<- END 000010 1100 x xxxxx 07/11/2010 20

Call instructions (all with END) Calls the procedure only of the condition is true CALL END MEM(SP)<-PC 000011 0000 x xxxxx PC<-END END SP-- CEQ END idem 000010 0000 x xxxxx CNE END idem 000010 0101 x xxxxx CZ END idem 000010 1010 x xxxxx CNZ END idem 000010 1011 x xxxxx CC END idem 000010 0111 x xxxxx CNC END idem 000010 1000 x xxxxx CGR END idem 000010 0010 x xxxxx CLE END idem 000010 0001 x xxxxx CEG END idem 000010 0100 x xxxxx CEL END idem 000010 0101 x xxxxx COV END idem 000010 1001 x xxxxx CNOV END idem 000010 1100 x xxxxx 07/11/2010 21

Return instruction RTS SP++ 000100 xxxx x xxxxx PC<=MEM(SP) 07/11/2010 22

Instruction format System control (C-type) op op not used 6 bits 1 bit 9 bits 07/11/2010 23

Control instructions CLEARC C<-0 001000 0 xxxxxxxxx SETC C<-1 001000 1 xxxxxxxxx HALT STOP EXECUTION 001111 x xxxxxxxxx NOP NO OPERATION 000000 x xxxxxxxxx 07/11/2010 24

Instruction format Stack operations (S-type) op RX op not used 6 bits 3 bits 1 bit 6 bit 07/11/2010 25

Stack instructions PUSH RX MEM(SP) <- RX 000101 RX 0 xxxxxx SP-- PUSH FR MEM(SP) <- FR 000101 xxx 1 xxxxxx SP-- POP RX RX <- MEM(SP) 000110 RX 0 xxxxxx SP++ POP FR FR <- MEM(SP) 000110 xxx 1 xxxxxx SP++ 07/11/2010 26

The COMP09 processor microarchitecture 07/11/2010 27

Exercises Convert the following COMP09 assembly code into machine language. Write the instructions in hexadecimal INCHAR 0 INCHAR 1 OUTCHAR 0 1 07/11/2010 28