Computer organization



Similar documents
MICROPROCESSOR AND MICROCOMPUTER BASICS

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

CPU Organisation and Operation

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

(Refer Slide Time: 00:01:16 min)

Review: MIPS Addressing Modes/Instruction Formats

Microprocessor & Assembly Language

Central Processing Unit (CPU)

CHAPTER 7: The CPU and Memory

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

PART B QUESTIONS AND ANSWERS UNIT I

The 104 Duke_ACC Machine

Instruction Set Architecture

Summary of the MARIE Assembly Language

Instruction Set Design

BASIC COMPUTER ORGANIZATION AND DESIGN

Design of Digital Circuits (SS16)

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Solutions. Solution The values of the signals are as follows:

Let s put together a Manual Processor

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

Systems I: Computer Organization and Architecture

Generating MIF files

Memory Elements. Combinational logic cannot remember

Register File, Finite State Machines & Hardware Control Language

1 Classical Universal Computer 3

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

LSN 2 Computer Processors

MACHINE ARCHITECTURE & LANGUAGE

Pipeline Hazards. Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. Based on the material prepared by Arvind and Krste Asanovic

Computer Organization and Components

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

CS352H: Computer Systems Architecture

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

Central Processing Unit

TIMING DIAGRAM O 8085

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

CHAPTER 4 MARIE: An Introduction to a Simple Computer

More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.

Chapter 9 Computer Design Basics!

Introducción. Diseño de sistemas digitales.1

Pipeline Hazards. Structure hazard Data hazard. ComputerArchitecture_PipelineHazard1

16-bit ALU, Register File and Memory Write Interface

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

Reduced Instruction Set Computer (RISC)

Q. Consider a dynamic instruction execution (an execution trace, in other words) that consists of repeats of code in this pattern:

Chapter 2 Logic Gates and Introduction to Computer Architecture

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Overview. CISC Developments. RISC Designs. CISC Designs. VAX: Addressing Modes. Digital VAX

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

Design of Pipelined MIPS Processor. Sept. 24 & 26, 1997

Instruction Set Architecture (ISA)

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

5 Combinatorial Components. 5.0 Full adder. Full subtractor

VLIW Processors. VLIW Processors

EC 362 Problem Set #2

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

CPU Organization and Assembly Language

Registers & Counters

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

CSCI 4717 Computer Architecture. Function. Data Storage. Data Processing. Data movement to a peripheral. Data Movement

Z80 Microprocessors Z80 CPU. User Manual UM Copyright 2014 Zilog, Inc. All rights reserved.

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Intel 8086 architecture

Computer Organization. and Instruction Execution. August 22

CSE 141L Computer Architecture Lab Fall Lecture 2

CSE 141 Introduction to Computer Architecture Summer Session I, Lecture 1 Introduction. Pramod V. Argade June 27, 2005

8085 INSTRUCTION SET

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Digital Design with VHDL

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

Building a computer. Electronic Numerical Integrator and Computer (ENIAC)

A SystemC Transaction Level Model for the MIPS R3000 Processor

Addressing The problem. When & Where do we encounter Data? The concept of addressing data' in computations. The implications for our machine design(s)

The WIMP51: A Simple Processor and Visualization Tool to Introduce Undergraduates to Computer Organization

路 論 Chapter 15 System-Level Physical Design

İSTANBUL AYDIN UNIVERSITY

A3 Computer Architecture

Sequential Circuit Design

Instruction Set Architecture (ISA) Design. Classification Categories

Programmer s Model = model of µc useful to view hardware during execution of software instructions

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Using Graphics and Animation to Visualize Instruction Pipelining and its Hazards

Computer Organization and Architecture

Computer Organization and Components

Transcription:

Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs = machine, datapath conditions outputs = register transfer control signals, ALU operation codes interpretation = fetch, decode, execute Datapath = functional units + registers functional units = ALU, multipliers, dividers, etc. registers = program counter, shifters, storage registers Autumn 2003 CSE370 - XI - Computer Organization 1 Structure of a computer Block diagram view address central processing unit (CPU) Processor read/write data Memory System Control control signals Data Path data conditions unit fetch and interpretation FSM execution unit functional units and registers Autumn 2003 CSE370 - XI - Computer Organization 2

Registers Selectively loaded EN or LD input Output enable OE input Multiple registers group 4 or 8 in parallel LD D7 D6 D5 D4 D3 D2 D1 D0 CLK OE Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 OE asserted causes FF state to be connected to output pins; otherwise they are left unconnected (high impedance) LD asserted during a lo-to-hi clock transition loads new data into FFs Autumn 2003 CSE370 - XI - Computer Organization 3 Register transfer Point-to-point connection dedicated wires muxes on inputs of each register MUX rs MUX rt MUX rd MUX R4 Common input from multiplexer load enables for each register control signals for multiplexer rs rt rd R4 MUX Common bus with output enables output enables and load enables for each register rs rt rd R4 BUS Autumn 2003 CSE370 - XI - Computer Organization 4

Register files Collections of registers in one package two-dimensional array of FFs address used as index to a particular word can have separate read and write addresses so can do both at same time 4 by 4 register file D-FFs organized as four words of four bits each write-enable (load) read-enable (output enable) RE RB RA WE WB WA D3 D2 D1 D0 Q3 Q2 Q1 Q0 Autumn 2003 CSE370 - XI - Computer Organization 5 Memories Larger collections of storage elements implemented not as FFs but as much more efficient latches high-density memories use 1 to 5 switches (transitors) per memory bit Static RAM 1024 words each 4 bits wide once written, memory holds forever (not true for denser dynamic RAM) address lines to select word (10 lines for 1024 words) read enable same as output enable often called chip select permits connection of many A9 A8 chips into larger array IO3 A7 IO2 A6 write enable (same as load enable) IO1 A5 IO0 bi-directional data lines A4 A3 output when reading, input when writing A2 A2 A1 A0 Autumn 2003 CSE370 - XI - Computer Organization 6 RD WR

Instruction sequencing Example an to add the contents of two registers (Rx and Ry) and place result in a third register (Rz) Step 1: get the ADD from memory into an register Step 2: decode in IR has the code of an ADD register indices used to generate output enables for registers Rx and Ry register index used to generate load signal for register Rz Step 3: execute enable Rx and Ry output and direct to ALU setup ALU to perform ADD operation direct result to Rz so that it can be loaded into register Autumn 2003 CSE370 - XI - Computer Organization 7 Instruction types Data manipulation add, subtract increment, decrement multiply shift, rotate immediate operands Data staging load/store data to/from memory register-to-register move Control conditional/unconditional branches in program flow subroutine call and return Autumn 2003 CSE370 - XI - Computer Organization 8

Elements of the control unit (aka unit) Standard FSM elements state register next-state logic output logic (datapath/control signalling) Moore or synchronous Mealy machine to avoid loops unbroken by FF Plus additional "control" registers register (IR) program counter (PC) Inputs/outputs outputs control elements of data path inputs from data path used to alter flow of program (test if zero) Autumn 2003 CSE370 - XI - Computer Organization 9 Instruction execution Control state diagram (for each diagram) reset fetch decode execute Instructions partitioned into three classes branch load/store register-to-register Different sequence through diagram for each type Branch Taken Branch Branch Not Taken Init Fetch Instr. Load/ Store Incr. PC Reset Initialize Machine XEQ Instr. Registerto-Register Autumn 2003 CSE370 - XI - Computer Organization 10

Data path (hierarchy) Arithmetic circuits constructed in hierarchical and modular fashion each bit in datapath is functionally identical 4-bit, 8-bit, -bit, 32-bit datapaths Ain Bin Cin FA Cout Sum Ain Bin Cin HA HA Sum Cout Autumn 2003 CSE370 - XI - Computer Organization 11 Data path (ALU) ALU block diagram input: data and operation to perform output: result of operation and status information A B Operation N S Z Autumn 2003 CSE370 - XI - Computer Organization 12

Data path (ALU + registers) Accumulator special register one of the inputs to ALU output of ALU stored back in accumulator One-address s operation and address of one operand other operand and destination is accumulator register AC < AC op Mem[addr] "single address s (AC implicit operand) Multiple registers OP REG AC part of used to choose register operands N Z Autumn 2003 CSE370 - XI - Computer Organization 13 Data path (bit-slice) Bit-slice concept replicate to build n-bit wide datapaths CO ALU CI CO ALU ALU CI AC AC AC R0 R0 R0 rs rs rs rt rt rt rd rd rd from memory from memory from memory 1 bit wide 2 bits wide Autumn 2003 CSE370 - XI - Computer Organization 14

Instruction path Program counter (PC) keeps track of program execution address of next to read from memory may have auto-increment feature or use ALU Instruction register (IR) current includes ALU operation and address of operand also holds target of jump immediate operands Relationship to data path PC may be incremented through ALU contents of IR may also be required as input to ALU immediate operands Autumn 2003 CSE370 - XI - Computer Organization 15 Data path (memory interface) Memory separate data and memory (Harvard architecture) two address busses, two data busses single combined memory (Princeton architecture) single address bus, single data bus Separate memory ALU output goes to data memory input register input from data memory output data memory address from register register from memory output memory address from program counter Single memory address from PC or IR memory output to and data registers memory input from ALU output Autumn 2003 CSE370 - XI - Computer Organization

Block diagram of processor (Harvard) Register transfer view of Harvard architecture which register outputs are connected to which register inputs arrows represent data-flow, other are control signals from control FSM two MARs (PC and IR) two MBRs (REG and IR) load path load control for each register Control FSM OP OP N Z REG AC IR PC store path rd wr data Data Memory (-bit words) addr data Inst Memory (8-bit words) addr Autumn 2003 CSE370 - XI - Computer Organization 17 Block diagram of processor (Princeton) Register transfer view of Princeton architecture which register outputs are connected to which register inputs arrows represent data-flow, other are control signals from control FSM MAR may be a simple multiplexer rather than separate register MBR is split in two (REG and IR) load path load control for each register Control FSM OP N Z REG 8 AC store path rd wr data Data Memory (-bit words) addr MAR IR PC OP Autumn 2003 CSE370 - XI - Computer Organization 18

A simplified processor data-path and memory Princeton architecture Register file Instruction register PC incremented through ALU Modeled after MIPS rt000 (used in 378 textbook by Patterson & Hennessy) really a 32-bit machine we ll do a -bit version Autumn 2003 CSE370 - XI - Computer Organization 19 Processor control Synchronous Mealy or Moore machine Multiple cycles per Autumn 2003 CSE370 - XI - Computer Organization 20

Processor s Three principal types ( bits in each ) type op rs rt rd funct R(egister) 3 3 3 3 4 I(mmediate) 3 3 3 7 J(ump) 3 13 Some of the s R I J add 0 rs rt rd 0 rd = rs + rt sub 0 rs rt rd 1 rd = rs - rt and 0 rs rt rd 2 rd = rs & rt or 0 rs rt rd 3 rd = rs rt slt 0 rs rt rd 4 rd = (rs < rt) lw 1 rs rt offset rt = mem[rs + offset] sw 2 rs rt offset mem[rs + offset] = rt beq 3 rs rt offset pc = pc + offset, if (rs == rt) addi 4 rs rt offset rt = rs + offset j 5 target address pc = target address halt 7 - stop execution until reset Autumn 2003 CSE370 - XI - Computer Organization 21 Tracing an 's execution Instruction: r3 = r1 + r2 R 0 rs=r1 rt=r2 rd=r3 funct=0 1. fetch move address from PC to memory address bus assert memory read move data from memory data bus into IR configure ALU to add 1 to PC configure PC to store new value from ALUout 2. decode op-code bits of IR are input to control FSM rest of IR bits encode the operand addresses (rs and rt) these go to register file Autumn 2003 CSE370 - XI - Computer Organization 22

Tracing an 's execution (cont d) Instruction: r3 = r1 + r2 R 0 rs=r1 rt=r2 rd=r3 funct=0 3. execute set up ALU inputs configure ALU to perform ADD operation configure register file to store ALU result (rd) Autumn 2003 CSE370 - XI - Computer Organization 23 Tracing an 's execution (cont d) Step 1 Autumn 2003 CSE370 - XI - Computer Organization 24

Tracing an 's execution (cont d) Step 2 Autumn 2003 CSE370 - XI - Computer Organization 25 to controller Tracing an 's execution (cont d) Step 3 Autumn 2003 CSE370 - XI - Computer Organization 26

Register-transfer-level description Control transfer data between registers by asserting appropriate control signals Register transfer notation - work from register to register fetch: mabus PC; memory read; IR memory; op add move PC to memory address bus (PCmaEN, ALUmaEN) assert memory read signal (mr, RegBmdEN) load IR from memory data bus (IRld) send PC into A input, 1 into B input, add (srca, srcb0, scrb1, op) load result of incrementing in ALU into PC (PCld, PCsel) PC ALUout decode: IR to controller values of A and B read from register file (rs, rt) execution: op add send rega into A input, regb into B input, add (srca, srcb0, scrb1, op) rd ALUout store result of add into destination register (regwrite, wrdatasel, wrregsel) Autumn 2003 CSE370 - XI - Computer Organization 27 Register-transfer-level description (cont d) How many states are needed to accomplish these transfers? data dependencies (where do values that are needed come from?) resource conflicts (ALU, busses, etc.) In our case, it takes three cycles one for each step all operation within a cycle occur between rising edges of the clock How do we set all of the control signals to be output by the state machine? depends on the type of machine (Mealy, Moore, synchronous Mealy) Autumn 2003 CSE370 - XI - Computer Organization 28

Review of FSM timing fetch decode execute step 1 step 2 step 3 IR mem[pc]; PC PC + 1; A rs B rt rd A + B to configure the data-path to do this here, when do we set the control signals? Autumn 2003 CSE370 - XI - Computer Organization 29 FSM controller for CPU (skeletal Moore FSM) First pass at deriving the state diagram (Moore machine) these will be further refined into sub-states reset fetch decode LW SW ADD J execution Autumn 2003 CSE370 - XI - Computer Organization 30

FSM controller for CPU (reset and inst. fetch) Assume Moore machine outputs associated with states rather than arcs Reset state and fetch sequence On reset (go to Fetch state) start fetching s PC will set itself to zero reset mabus PC; memory read; IR memory data bus; PC PC + 1; Fetch fetch Autumn 2003 CSE370 - XI - Computer Organization 31 FSM controller for CPU (decode) Operation decode state next state branch based on operation code in read two operands out of register file what if the doesn t have two operands? branch based on value of Inst[15:13] and Inst[3:0] Decode decode add Autumn 2003 CSE370 - XI - Computer Organization 32

FSM controller for CPU ( execution) For add configure ALU and store result in register rd A + B other s may require multiple cycles add execution Autumn 2003 CSE370 - XI - Computer Organization 33 FSM controller for CPU (add ) Putting it all together and closing the loop the famous fetch decode execute cycle reset Fetch Decode fetch decode add execution Autumn 2003 CSE370 - XI - Computer Organization 34

FSM controller for CPU Now we need to repeat this for all the s of our processor fetch and decode states stay the same different execution states for each some may require multiple states if available register transfer paths require sequencing of steps Autumn 2003 CSE370 - XI - Computer Organization 35