Systems I: Computer Organization and Architecture

Similar documents
BASIC COMPUTER ORGANIZATION AND DESIGN

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

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture

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

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

PART B QUESTIONS AND ANSWERS UNIT I

Chapter 2 Logic Gates and Introduction to Computer Architecture

Computer organization

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

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

Computer Architecture

MACHINE ARCHITECTURE & LANGUAGE

8085 INSTRUCTION SET

Chapter 9 Computer Design Basics!

Microprocessor & Assembly Language

MICROPROCESSOR AND MICROCOMPUTER BASICS

Summary of the MARIE Assembly Language

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

The 104 Duke_ACC Machine

Central Processing Unit (CPU)

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

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

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

CPU Organisation and Operation

Memory Elements. Combinational logic cannot remember

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

1 Classical Universal Computer 3

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CPU Organization and Assembly Language

Counters and Decoders

CHAPTER 7: The CPU and Memory

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

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Central Processing Unit

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

Systems I: Computer Organization and Architecture

Let s put together a Manual Processor

COMPUTER ARCHITECTURE. Input/Output

TIMING DIAGRAM O 8085

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

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

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

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

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

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. COURSE CURRICULUM COURSE TITLE: COMPUTER ORGANIZATION AND ARCHITECTURE (Code: )

Z80 Instruction Set. Z80 Assembly Language

BINARY CODED DECIMAL: B.C.D.

2011, The McGraw-Hill Companies, Inc. Chapter 3

Lecture-3 MEMORY: Development of Memory:

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

Instruction Set Architecture

Module 3: Floyd, Digital Fundamental

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

CSE140 Homework #7 - Solution

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Decimal Number (base 10) Binary Number (base 2)

An Overview of Stack Architecture and the PSC 1000 Microprocessor

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: REGISTERS AND RELATED

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

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

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

Lecture 8: Synchronous Digital Systems

EECS 427 RISC PROCESSOR

Traditional IBM Mainframe Operating Principles

Instruction Set Architecture (ISA)

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

Flip-Flops, Registers, Counters, and a Simple Processor

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

Administrative Issues

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

Computer Organization. and Instruction Execution. August 22

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

DS1821 Programmable Digital Thermostat and Thermometer

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

Instruction Set Design

ASYNCHRONOUS COUNTERS

The components. E3: Digital electronics. Goals:

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

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Review: MIPS Addressing Modes/Instruction Formats

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

An Introduction to the ARM 7 Architecture

An Introduction to Computer Systems

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

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

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

CHAPTER 11: Flip Flops

The string of digits in the binary number system represents the quantity

The Little Man Computer

Interrupts. 1.Maskable interrupt request can be ignored or delayed by the microprocessor and used in telephone

Chapter 5 Instructor's Manual

Chapter 1 Computer System Overview

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

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

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

Transcription:

Systems I: Computer Organization and Architecture Lecture 1: Basic Computer Organization and Design Instruction Codes An instruction code is a group of bits that instruct the computer to perform a specific operation. The operation code of an instruction is a group of bits that define operations such as addition, subtraction, shift, complement, etc. An instruction must also include one or more operands, which indicate the registers and/or memory addresses from which data is taken or to which data is deposited.

Microoperations The instructions are stored in computer memory in the same manner that data is stored. The control unit interprets these instructions and uses the operations code to determine the sequences of microoperations that must be performed to execute the instruction. Stored Program Organization The operands are specified by indicating the registers and/or memory locations in which they are stored. k bits can be used to specify which of 2 k registers (or memory locations) are to be used. The simplest design is to have one processor register (called the accumulator) and two fields in the instruction, one for the opcode and one for the operand. Any operation that does not need a memory operand frees the other bits to be used for other purposes, such as specifying different operations.

Stored Program Organization 15 12 11 Opcode Address Memory 496 x 16 Instruction format Instructions (programs) 15 Binary operand Operands (data) Processor Register (accumulator or AC) Addressing Modes There are four different types of operands that can appear in an instruction: Direct operand - an operand stored in the register or in the memory location specified. Indirect operand - an operand whose address is stored in the register or in the memory location specified. Immediate operand - an operand whose value is specified in the instruction.

Direct addressing 15 Direct and Indirect Addressing I 14 ADD 457 Opcode 12 11 Address Instruction format 1 ADD 3 Indirect addressing 457 Operand 3 135 135 Operand + + AC AC Registers Computer instructions are stored in consecutive locations and are executed sequentially; this requires a register which can stored the address of the next instruction; we call it the Program Counter. We need registers which can hold the address at which a memory operand is stored as well as the value itself. We need a place where we can store temporary data the instruction being executed, a character being read in a character being written out.

List of Registers for the Basic Computer Register # of Bits Register Function Symbol Name DR 16 Data Register Holds memory operand AR 12 Address Register Holds mem. address AC 16 Accumulator Processor Reg. IR 16 Instruction Register Holds instruction code PC 12 Program Counter Holds instruction address TR 16 Temporary Register Holds temporary data INPR 8 Input Register Holds input character OUTR 8 Output Register Holds output character Basic Computer Registers and Memory 11 PC 11 15 IR AR Memory 496 words 16 bits per word 15 15 TR DR 7 7 15 OUTR INPR AC

The Common Bus To avoid excessive wiring, memory and all the register are connected via a common bus. The specific output that is selected for the bus is determined by S 2 S 1 S. The register whose LD (Load) is enable receives the data from the bus. Registers can be incremented by setting the INR control input and can be cleared by setting the CLR control input. The Accumulator s input must come via the Adder & Logic Circuit. This allows the Accumulator and Data Register to swap data simultaneously. The address of any memory location being accessed must be loaded in the Address Register. Basic Computer Registers Connected to a Common Bus Nb: All except INPR and Adder are connected to a clock pulse Write Read Bus Memory OUTR 496 x 16 7 S 2 S 1 S 6 TR AR 1 LD INR CLR LD INR CLR 5 IR LD E PC LD INR CLR DR 2 3 INPR Adder & Logic LD INR CLR AC LD INR CLR 4

Computer Instructions The basic computer has three instruction code formats: Memory-reference format where seven 3-bit opcodes are followed by a 12-bit memory address and preceded by a bit which indicates whether direct or indirect addressing is being used. Register-reference format where 111 2 is followed by 12 bits which indicate a register instruction. Input-output format where 1111 2 is followed by 12 bit which indicate an input-output instruction. In register-reference and I/O formats, only one of the lower 12 bits is set. Basic Computer Instruction Formats 15 14 12 11 I Opcode Address Opcode = through 11 Memory-reference instruction 15 14 12 11 1 1 1 Register operation Opcode = 111, I = Register-reference instruction 15 14 12 11 1 1 1 1 I/O operation Input-output instruction Opcode = 111, I = 1

Instruction-Set Completeness A computer instruction set is said to be complete if the computer includes a sufficient number of instructions in each of these categories: Arithmetic, logical and shift instructions Instructions for moving data from registers to memory and memory to registers. Program-control and status-checking instructions Input and output instructions Arithmetic, Logic and Shifting Completeness We have instructions for adding, complementing and incrementing the accumulator. With these we can also subtract. AND and complement provide NAND, from which all other logical operations can be constructed. We can construct logical and arithmetic shifts from the circular shift operations. We can construct multiply and divide from adding, subtracting and shifting. While this is complete, it is not very efficient; it would be to our advantage to have subtract, multiply, OR and XOR.

Instruction Set Completeness (continued) We can perform moves using the LDA and STA instructions. We have unconditional branches (BUN), subprogram calls (BSA) and conditional branches (ISZ). We also have all the instructions we need to perform input and output and handle the interrupt that they generate. Basic Memory-Reference Instructions Hexadecimal code Symbol I = I = 1 Description AND xxx 8xxx AND mem. Word to AC ADD 1xxx 9xxx ADD mem. Word to AC LDA 2xxx Axxx Load mem. Word to AC STA 3xxx Bxxx Store Content of AC in mem. BUN 4xxx Cxxx Branch unconditionally BSA 5xxx Dxxx Branch and save return address ISZ 6xxx Exxx Increment and skip if zero

Basic Register-Reference Instructions Symbol Hex. Code Description CLA 78 Clear AC CLE 74 Clear E CMA 72 Complement AC CME 71 Complement E CIR 78 Circulate right AC & E CIL 74 Circulate left AC & E INC 72 Increment AC Basic Register-Reference Instructions (continued) Symbol Hex. Code Description SPA 71 Skip next instruction if AC is positive SNA 78 Skip next instruction if AC is negative SZA 74 Skip next instruction if AC is zero SZE 72 Skip next instruction if E is zero HLT 71 Halt computer

Basic Input-Output Instructions Symbol Hex. Code Description INP F8 Input character to AC OUT F4 Output character from AC SKI F2 Skip on input flag SKO F1 Skip on output flag ION F8 Interrupt on IOF F4 Interrupt off Timing and Control The timings for all the registers is controlled a master clock generator. Its pulses are applied to all flip-flops and registers, including in the control unit. The control signals are generated in the control unit and provide control inputs for the bus s mutlitplexers and for the processor registers and provides micrroperations for the accumulator.

Control There are two types of control: Hardwired control logic is implemented with gates, flip-flops, decoders and other digital circuits. Microprogrammed control information is stored in a control program, which is programmed to perform the necessary steps to implement instructions. Timing Signals Timing signals are generated by the sequence counter (SC), which receives as inputs the clock pulse, increment and clear. The SC s outputs are decoded into 16 timing signal T through T 15, which are used to control the sequence of operations. The RTL statement D 3 T 4 : SC resets the sequence counter to zero; the next timing signal is T

Control Unit of Basic Computer Instruction Register(IR) Other inputs 15 14 13 12 11-3 x 8 decoder 7 6 5 4 3 2 1 D D7 Control Logic Gates Control outputs 15 4 x 16 decoder T 15 T 4-bit sequence counter (SC) Increment(INR) Clear (CLR) Clock Clock Examples of Control Timing Signals T T 1 T 2 T 3 T 4 T T T 1 T 2 T 3 T 4 D 3 CLR SC

Instruction Cycle The instructions of a program are carried out by a process called the instruction cycle. The instruction cycle consists of these phases: Fetch an instruction from memory Decode the instruction Read the effective address from memory if the operand has an indirect address. Execute the instruction. Fetch and Decode Initially, the PC has stored the address of the instruction about to be executed and the SC is cleared to. With each clock pulses the SC is incremented and the timing signals go through the sequence T, T 1, T 2, etc. It is necessary to load the AR with the PC s address (it is connected to memory address inputs): T : AR PC

Fetch and Decode Subsequently, as we fetch the instruction to be executed, we must increment the program counter so that it points to the next instruction: T 1 : IR M[AR], PC PC + 1 In order to carry out the instruction, we must decode and prepare to fetch the operand. In the event it is an indirect operand, we need to have the indirect addressing bit as well: T 2 : D, D 7 Decode IR(12-14), AR IR (-11), I IR(15) Register Transfers For the Fetch Phase T 1 S 2 T Read S 1 S Bus Memory unit 7 LD AR Addr 1 Clock INR LD PC IR 2 5

Type of Instruction and Addressing During time T 3, the control unit determines if this is a memory-reference, register-reference or input/output instruction. The latter two are distinguished by the I (indirect) bit. If it is a memory-reference instruction, the I bit will determine direct or indirect addressing. The four separate paths are: D 7 IT 3 : AR M[AR] D 7 I T 3 : Nothing D 7 I T 3 : Execute a register-reference instruction D 7 IT 3 : Execute an input-output instruction Flowchart For Instruction Cycle Start SC T AR PC T 1 IR M[AR}, PC PC + 1 T 2 Decode opcode in IR(12-14) AR IR(-11), I IR(15) T 3 = 1 (I/O) Exec. I/O inst. SC I (Register or I/O) = 1 = (reg.) Exec. reg.inst. SC T 3 D 7 = (Memory-ref.) T = 1 3 AR M[AR] I = (Direct) Nothing T 3 Exec. memory ref..inst. SC

Execution of Register-Reference Instructions D 7 I T 3 = r (common to all register-reference instructions) IR(I) = B i [bit in IR(-11) that specifies the operation] r SC Clear SC CLA rb11 AC Clear AC CLE rb1 E Clear E CMA rb9 AC AC' Complement AC CME rb8 E E' Complement E CIR rb7 AC shr AC, Circulate right AC(15) E E AC() CIL rb6 AC shl AC, Circulate left AC() E E AC(15) INC rb5 AC AC + 1 Increment AC Execution of Register-Reference Instructions SPA rb 4 If (AC(15) = ) then PC PC + 1 Skip if positive SNA rb 3 If (AC(15) = 1) Skip if negative Then PC PC + 1 SZA rb 2 If (AC = ) Then PC PC + 1 Skip if AC zero SZE rb 1 If (E = ) Skip if E zero Then PC PC + 1 HLT rb S (S is a start-stop flip-flop) Halt computer

Memory-Reference Instructions Symbol Op. Decoder Symb. Desc. AND D AC AC M[AR] ADD D 1 AC AC + M[AR], E C out LDA D 2 AC M[AR] STA D 3 M[AR] AC BUN D 4 PC AR BSA D 5 M[AR] PC PC AR + 1 ISZ D 6 M[AR] M[AR] + 1 If M[AR] + 1 = Then PC PC + 1 Memory-Reference Instructions All memory-reference instructions have to wait until T 4 so that the timing is the same whether the operand is direct or indirect. AND, ADD and LDA must all be performed in two steps because AC can only be access via DR: AND: D T 4 : DR M[AR] D T 5 : AC AC DR, SC ADD: D 1 T 4 : DR M[AR] D 1 T 5 : AC AC + DR, E C out, SC LDA: D 2 T 4 : DR M[AR] D T 5 : AC DR, SC

Memory-Reference Instructions (continued) STA stores the contents of the AC, which can be applied directly to the bus: D 3 T 4 : M[AR] AC, SC BUN transfers control unconditionally to theffective address indicated by the effective address: D 4 T 4 : PC AR, SC BSA is used to branch to a subprogram. This requires saving the return address, which is saved at the operand s effective address with the subprogram beginning one word later in memory: D 5 T 4 : M[AR] PC, AR AR + 1 D 5 T 5 : PC AR, SC 2 PC= 21 Example of BSA Instruction Execution Memory Memory BSA 135 2 BSA 135 Next instruction 21 Next instruction AR = 135 135 21 136 Subroutine PC = 136 Subroutine 1 BUN 135 1 BUN 135 Memory, PC, & AR at time T 4 Memory & PC after execution

Memory-Reference Instructions (continued) ISZ skips the next instruction if the operand stored at the effective address is. This requires that the PC incremented, which cannot be done directly: D 6 T 4 : DR M[AR] D 6 T 5 : DR DR + 1 D 6 T 6 : M[AR] DR, if (DR = ) then (PC PC + 1), SC Flowchart For Memory-Reference Instructions Memory -reference Instructions AND ADD LDA STA D T 4 D 1 T 4 D 2 T 4 D 3 T 4 DR M[AR] DR M[AR] DR M[AR] M[AR] AC SC D T 5 D 1 T 5 D 2 T 5 AC AC DR SC AC AC + DR E C out SC AC DR SC

Flowchart For Memory-Reference Instructions (continued) Memory -reference Instructions BUN BSA ISZ D 4 T 4 PC AR SC D 5 T 4 M[AR] PC AR AR + 1 D 5 T 5 PC AR SC DR M[AR] D 6 T 6 D 6 T 4 D 6 T 5 DR DR + 1 M[AR] DR IF (DR = ) then (PC PC+1) SC Input-Output Configuration Input-output terminal Printer Serial Comm. Interface Receiver Interface Comp. Registers and Flip-flops FGO OUTR = 1 NOP = output data AC Keyboard Transmitter Interface INPR FGI = NOP = 1 input waiting

Input-Output Instructions p SC Clear SC INP pb11 AC(-7) INPR, Input character FGI OUT pb1 OUTR AC(-7), Output character FGO SKI pb9 If (FGI = 1) Skip on input flag Then PC PC + 1 SKO pb8 If (FGO = 1) Skip on output flag Then PC PC + 1 ION pb7 IEN 1 Interrupt enable on IOF pb6 IEN Interrupt enable off Flowchart For Interrupt Cycle Instruction cycle = R = 1 Interrupt cycle Fetch & decode instruction Execute instruction = 1 IEN = 1 FGI = Store return address in location M[] PC Branch to location 1 PC 1 = 1 FGO = IEN R R 1 =

1 Demonstration of the Interrupt Cycle Memory Memory 256 BUN 112 PC = 1 BUN 112 PC = 255 256 Main Program 255 256 Main Program 112 I/O I/O Program Program 1 BUN Before Interrupt 1 BUN After Interrupt Cycle Flowchart For Computer Operation Start SC, IEN, R Instruction Cycle AR PC R T = R = 1 Interrupt Cycle RT AR, TR PC R T 1 IR M[AR], PC PC + 1 RT 1 M[AR] TR, PC R T 2 AR IR(-11), I IR(15) D D 7 Decode IR(12-14) D 7 RT 2 PC PC + 1, IEN R, SC D 7 IT 3 = 1 Execute I/O Instruction I = D 7 I T 3 Execute Reg. Instruction D 7 IT 3 = 1 AR M[AR] I = Nothing D 7 I T 3 Execute Mem.. Instruction

Control Gates Associated With AR D 7I T 3 From bus 12 LD AR 12 To bus Clock T 2 R T INR CLR D 5 T 4 Control Inputs for IEN D 7 I T 3 B 7 J Q IEN Clock B 6 K R T 2

T R Encoder for Bus Selection Inputs x 1 x 2 x 3 x 4 x 5 x 6 x 7 Encoder S 2 S 1 S Multiplexer Bus Select Inputs Encoder for Bus Selection Circuit Inputs Outputs x 1 x 2 x 3 x 4 x 5 x 6 x 7 S 2 S 1 S Register Selected for Bus None 1 1 AR 1 1 PC 1 1 1 DR 1 1 AC 1 1 1 IR 1 1 1 TR 1 1 1 1 Mem.

Circuits Associated With AC 16 From 16 DR From 8 INPR Adder & Logic Circuit 16 Accumulator Register (AC) 16 To bus LD INR CLR Clock Control Gates Gate structure for Controlling the LD, INR, CLR of AC D T 5 D 1 AND ADD From adder and logic 16 AC 16 Clock To bus D 2 T 5 p B 11 r B 9 DR INPR COM SHR B 7 SHL B 6 B 5 INC B 11 CLR

DR(i) One stage of Adder and Logic Circuit LD AND c i FA ADD C i+1 J Q AC(i) DR INPR From INPR bit (I) COM K SHR AC(i+1) Clock SHL AC(i-1)