Parallel logic circuits

Similar documents
CS 31: Intro to Systems Digital Logic

REGISTER TRANSFER LANGUAGE

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Register Transfer and Micro-operations

CHAPTER 4: Register Transfer Language and Microoperations

Reference Sheet for C112 Hardware

ECE 341 Midterm Exam

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

Digital Logic Design Exercises. Assignment 1

REGISTER TRANSFER AND MICROOPERATIONS

Introduction to Boole algebra. Binary algebra

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

END-TERM EXAMINATION

Combinational and sequential circuits (learned in Chapters 1 and 2) can be used to create simple digital systems.

REGISTER TRANSFER AND MICROOPERATIONS

Philadelphia University Student Name: Student Number:

Lecture 10: Combinational Circuits

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design

UNIT - V MEMORY P.VIDYA SAGAR ( ASSOCIATE PROFESSOR) Department of Electronics and Communication Engineering, VBIT

Computer Organization (Autonomous)

CS 24: INTRODUCTION TO. Spring 2015 Lecture 2 COMPUTING SYSTEMS

ECE 331: N0. Professor Andrew Mason Michigan State University. Opening Remarks

Code No: R Set No. 1

Department of Electrical Engineering McGill University ECSE 221 Introduction to Computer Engineering Assignment 2 Combinational Logic

For Example: P: LOAD 5 R0. The command given here is used to load a data 5 to the register R0.

Arithmetic Logic Unit. Digital Computer Design

Injntu.com Injntu.com Injntu.com R16

Computer Organization and Levels of Abstraction

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR

IA Digital Electronics - Supervision I

CAD4 The ALU Fall 2009 Assignment. Description

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

Sequencing and control

UPY14602-DIGITAL ELECTRONICS AND MICROPROCESSORS Lesson Plan

Chapter 4. Combinational Logic

Chapter 10 Binary Arithmetics

Levels in Processor Design

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

Computer Architecture and Organization: L04: Micro-operations

KING FAHD UNIVERSITY OF PETROLEUM & MINERALS COMPUTER ENGINEERING DEPARTMENT

1. Draw general diagram of computer showing different logical components (3)

Real Digital Problem Set #6

Revision: August 31, E Main Suite D Pullman, WA (509) Voice and Fax

EE 3170 Microcontroller Applications

Let s put together a Manual Processor

UC Berkeley College of Engineering, EECS Department CS61C: Combinational Logic Blocks

UC Berkeley College of Engineering, EECS Department CS61C: Combinational Logic Blocks

Von Neumann Architecture

Digital Fundamentals. Lab 6 2 s Complement / Digital Calculator

ELCT 501: Digital System Design

ALU Design. 1-bit Full Adder 4-bit Arithmetic circuits. Arithmetic and Logic Unit Flags. Add/Subtract/Increament/Decrement Circuit

ECE260: Fundamentals of Computer Engineering

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Code No: R Set No. 1

Basic Arithmetic (adding and subtracting)

ECEN 468 Advanced Logic Design

SIR C.R.REDDY COLLEGE OF ENGINEERING, ELURU DEPARTMENT OF INFORMATION TECHNOLOGY LESSON PLAN

*Instruction Matters: Purdue Academic Course Transformation. Introduction to Digital System Design. Module 4 Arithmetic and Computer Logic Circuits

CS222: Processor Design

Chapter 3: part 3 Binary Subtraction

Combinational Circuits

Arithmetic Logic Unit (ALU)

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

Arithmetic-logic units

Combinational Logic II

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Introduction to Computer Science. Homework 1

LECTURE 4. Logic Design

Combinational Circuits

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6302 DIGITAL ELECTRONICS

Computer Organization and Levels of Abstraction

EE292: Fundamentals of ECE

HANSABA COLLEGE OF ENGINEERING & TECHNOLOGY (098) SUBJECT: DIGITAL ELECTRONICS ( ) Assignment

COMPUTER ORGANIZATION

COMBINATIONAL LOGIC CIRCUITS

R10. II B. Tech I Semester, Supplementary Examinations, May

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Logic Design (Part 2) Combinational Logic Circuits (Chapter 3)

Digital Design with FPGAs. By Neeraj Kulkarni

ECE 341 Midterm Exam

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Instructions. Philipp Koehn. 16 February 2018

Chapter 3. Boolean Algebra and Digital Logic

Chapter 4 Arithmetic Functions

II/IV B.Tech (Regular/Supplementary) DEGREE EXAMINATION. Answer ONE question from each unit.

B.Tech II Year I Semester (R13) Regular Examinations December 2014 DIGITAL LOGIC DESIGN

Mark Redekopp, All rights reserved. EE 352 Unit 8. HW Constructs

COMPUTER ORGANIZATION AND DESIGN

Experiment 7 Arithmetic Circuits Design and Implementation

QUESTION BANK FOR TEST

COS 140: Foundations of Computer Science

Transcription:

Computer Mathematics Week 9 Parallel logic circuits College of Information cience and Engineering Ritsumeikan University

last week the mathematics of logic circuits the foundation of all digital design oolean logic when 0 and 1 represent true and false oolean algebra oolean functions canonical forms Central Processing Unit IR increment PC CU operation select PR Mouse DR PC registers LU Universal erial us R Input / Output Controller address bus Random ccess Memory PCI us Keyboard HDD GPU udio D et 0 4 8 16 20 24 28 data bus simplification of oolean expressions de Morgan s laws 2

this week combinational digital circuits signals and busses logic gates and, or, not nand, nor, xor gate-level multi-bit logical operations bitwise: and, or, not Central Processing Unit IR increment PC CU operation select PR Mouse DR PC registers LU Universal erial us R Input / Output Controller address bus Random ccess Memory PCI us Keyboard HDD GPU udio D et 0 4 8 16 20 24 28 data bus gate-level multi-bit arithmetic operations addition, subtraction (unsigned, 2 s complement) 1-of- selection multiplexers 3

single-bit addition of three inputs review: addition (single-bit) sum is 1 if an odd number of inputs are 1 carry is 1 if two or more inputs are 1 canonical form of each output, simplified, translated into gates s = c i ab + c i a b + c i a b + c i ab = c i (ab + a b) + c i (a b + ab) = c i (a b) + c i(a b) = c i a b c o = c i ab + c ia b + c i ab + c i ab = (c i + c i)ab + c i (a b + ab ) = ab + c i (a b) C I Β sum c i a b c o s 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 C I C I ( Β) Β C I ( Β)+Α Β this is a full adder = C I 4

two full adders make a two-bit adder addition (multi-bit) 1 0 1 0 C I C I C I 1 + 0 to make a -bit adder, just daisy chain single-bit full adders together -1-2 1 0-1 -2 1 0 C I C I C I C I C I -1-2 1 0 + (this is called a ripple-carry adder is there a limit to?) 5

abstraction busses writing the seperate wires (and adders) for each bit is tedious all wires carrying i spend most of their time going to the same places similarly for and a bus carries many individuals in parallel between two points collect all the i together and put them on a single bus called similarly for and -1-2 1 0-1 -2 1 0 = C I C I C I C I C I C I C I -1-2 0 1 6

busses busses are thicker than wires U WIRE busses make wide turns wires joining or leaving a bus do so at an angle connecting two busses sometimes uses strange symbols to indicate what is happening we will just draw a dot, as with wires 7

bitwise (multi-bit) logic operations bitwise logical operations apply a logical operation in parallel to all the bits in a word e.g., whereas not inverts a single logical value 0 1 and 1 0 bitwise not inverts all the bits in a word 01101001 it is the one s complement operation 10010110 similarly for D, OR, and XOR D OR XOR D clears (or selects) bits 11110000 11110000 11110000 & 00110011 00110011 00110011 OR sets bits 00110000 11110011 11000011 XOR inverts bits 8

subtraction combine an adder with a bitwise complement to make a subtractor C I 0 C I C I 1 0 + ~ + ~ = --1 - but for correct results, we need to add the 2 s complement of to turn a 1 s complement into a 2 s complement negation, just add 1 e.g., by setting C I = 1 C I = not borrow when performing subtraction 9

selection are separate adder and subtractor required? they are almost identical, except for the complemented input if we could choose between and, one adder would be enough ~ 1 multiplexer (from instruction decoder) U / DD 0 MUX input select or ~ a multiplexer connects one of several inputs to its output a select input specifies the input to choose C I C I n-bit select input can choose between 2 n inputs 1 select bit chooses between input 0 or 1 2 select bits choose between inputs 0... 3, etc. +, - 10

multiplexers 2-input multiplexer EL OUT truth table Karnaugh map circuit functional block MUX EL 0 1 Q 00 01 11 1 10 1 1 1 P P = EL Q = EL 0 x x 1 y y ( = don t care ) OUT = EL + EL = EL OUT 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 EL OUT 1 0 MUX OUT EL 11

arithmetic and logic unit from registers, IR, DR 1 0 MUX from registers U / DD OP RE C I from PR C I Carry out Carry in from instruction decoder OP 2 OPERTIO 3 2 0 + 1 & 2 3 4-5 &~ 6 ~ 7 ~ OP 0, OP 1 00 01 10 11 MUX to registers REULT Carry out to PR 12

a typical machine program search an array to find the index of a particular value, assuming that the variable array holds the address of the start of the array the variable length holds the length of the array the variable value holds the target value that we are searching for the index of the element should be returned in register r0 if the target is not found, -1 should be returned in r0 label operation operands comment load r1, array load array address into register 1 load r2, length load array length into register 2 load r3, value load target value into register 3 set r0, 0 the next index to check is held in r0 next: compare r0, r2 check if we reached the end of the array jump_if_equal fail if so, target was not found load r4, r1[r0] fetch next element from array compare r4, r3 compare it to the target value jump_if_equal done if found, return the corresponding index in r0 add r0, r0, 1 increment the index jump next continue searching at the next index fail: set r0, -1 index -1 means target not found done: halt r0 contains index of target element, or -1 13

instruction execution machine ( fetch-execute ) cycle: repeat 1. fetch instruction copy PC to address bus read from memory into IR 2. decode instruction CU inspects the IR 3. fetch operand(s) move data from memory into DR, if required present DR and/or registers to LU 4. execute instruction LU performs operation on data 5. store result write LU output into register or memory 6. update PC with the address of the next insutruction forever Central Processing Unit IR increment PC CU operation select PR DR PC registers LU R Data us ddress us DR: data register, holds data read from memory while LU performs an operation R: address register, holds address for memory read/write operation 14

a typical machine instruction add register 1 to register 2, putting the result in register 3 operation destination operand1 operand2 add r3, r2, r1 CU IR decode 00101010 00000011 00000010 00000001 opcode dest reg src1 reg src2 reg registers source and destination operation PR R2 R1 + R3 r0 r1 r2 r3 r4 r5 31 11 123 31 11 42 C=0,.=0, O=0, Z=0 15

processor status results also of interest: flags for updating the processor status register was the result zero, or negative? did unsigned or signed overflow occur? the result was zero if none of the result bits is 1 the result was negative if the most-significant result bit is 1 REULT 0... REULT -1 circle = invert, OT OR = OR REULT -1 Zero egative unsigned arithmetic overflow (carry) occured in the adder if the carry out of the M bit of the result was 1-1 Carry signed arithmetic overflow occured in the adder if the carry in to the M bit of the result the carry out of it the condition for signed overflow is maybe a little subtle? -2-1 Overflow 16

processor status results signed overflow signed arithmetic overflow occured in the adder if the carry in to the M bit of the result the carry out of it the sign of the result is wrong (?) consider a signed, 8-bit, 2 s complement addition: 0xxxxxxx both positive: carry out of M bit is always 0 + 0xxxxxxx if carry in is 1, the sign will change overflow 0 0 0 = ok 0 1 1 = overflow 1xxxxxxx both negative: carry out of M bit is always 1 + 1xxxxxxx if carry in is 0, the sign will change overflow 1 1 1 = ok 1 0 0 = overflow 0xxxxxxx if carry in to M bit is 0, carry out is also 0 + 1xxxxxxx if carry in to M bit is 1, carry out is also 1 0 1 0 (overflow never occurs with numbers of opposite signs) 1 0 1 17

from registers, IR, DR LU with processor status outputs 1 0 MUX from registers U / DD OP RE C I from PR from instruction decoder OPERTIO 3 2 0 + 1 & 2 3 4-5 &~ 6 ~ 7 ~ U / DD C I 2 00 01 10 11 MUX RE -1 to registers REULT egative Carry out egative Overflow Zero Carry in -1 Carry out -2 Overflow to PR Zero 18

optimised 4-bit LU slice with 32 operations 19

things we did not consider shift and rotate instructions moving patterns of bits to the left or right, with or without wrap-around left as an exercise multiply instructions usually requires synchronous logic (next week) divide instructions always requires synchronous logic (next week) tri-state logic logic that can be 0, 1, or high-impedance used for bi-directional signals beyond the scope of this introductory course 20

next week sequential digital circuits stateful logic level-triggered devices latches Central Processing Unit IR increment PC CU operation select PR DR PC registers LU R address bus 0 4 8 16 20 24 28 data bus Random ccess Memory clocks edge-triggered devices Universal erial us Input / Output Controller PCI us Mouse Keyboard HDD GPU udio D et synchronous logic flip-flops registers and memory CPU operation according to the clock cycle 21

homework practice drawing logic circuits for oolean functions consider some of the gates we did not study in detail how many of the logic circuits of this week can you make using only D gates? using only OR gates? reinforce your understanding write a Python program to simulate a multi-bit adder consider the logical operations affecting each signal compute the output of each gate based on its input(s) propagate outputs to inputs at every simulation time step ask about anything you do not understand from any of the classes so far this semester (or the lecture notes) it will be too late for you to try to catch up later! I am always happy to explain things differently and practice examples with you 22

glossary active-low a signal that is considered true when 0. active-high a signal that is considered true when 1. adder a logic circuit that implements 2 s complement addition between two words of data. bus a collection of signals all travelling between the same two points. carry a processor status bit indicating that the last arithmetic operation generated an unsigned overflow (a carry out of the M bit). complement a bitwise logical operation that inverts every bit in a word. daisy chain connecting two or more devices or circuits in a linear fashion so that some output from one feeds into the input of the next. exclusive-or an or operation that does not allow both inputs to be the same value. flag a single bit in the processor status register. full adder an adder that takes three single-bit inputs (two digits and a carry in) and produces two single-bit outputs (a sum and a carry out). functional block a high-level abstract component in a digitl circuit that represents a reusable pattern of lower-level components or gates. gate an logic circuit component that implements a fundamental oolean operation. half adder an adder that takes two single-digit inputs and produces a sum and carry output. multiplexer a digital circuit that connectes one of 2 n input signals to its output according to a n-bit select input. negative a processor status bit indicating that the result of the last arithmetic operation was negative, assuming the values involved were 2 s complement integers. 23

overflow a processor status bit indicating that the result of the last arithmetic operation generated a signed overflow (the result has the wrong sign), assuming the values involved were 2 s complement integers. processor status register a register in the CPU holding several flags indicating whether the last arithmetic operation produced a zero or negative result, or whether an unsigned or signed overflow occured. ripple-carry adder an adder constructed by daisy chaining several single-bit full adders together. The name arises because the sum and carry out at each bit position n cannot be computed until the carry out at position n 1 has been computed. select an input to a multiplexer that selects which of several other inputs should be connected to the output. signal anything that conveys a logic value from one place to another. In logic circuits, a signal is carried by a wire. subtractor a logic circuit that implements 2 s complement subtraction between two words of data. wire a connection between several points in a circuit that forces them to all have the same logical value. zero a processor status bit indicating that the result of the last arithmetic operation generated a zero result (none of the result bits was 1). 24