EGC221: Digital Logic Lab

Similar documents
To design a 4-bit ALU To experimentally check the operation of the ALU

5 Arithmetic Logic Unit

REGISTER TRANSFER AND MICROOPERATIONS

Computer Architecture and Organization: L04: Micro-operations

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS II Fall 1999

Number Systems. Readings: , Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs

Institute of Engineering & Management

Register Transfer Language and Microoperations (Part 2)

ECE468 Computer Organization & Architecture. The Design Process & ALU Design

Real Digital Problem Set #6

EXPERIMENT NUMBER 11 REGISTERED ALU DESIGN

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

Advanced Computer Architecture-CS501

Chapter 4. Operations on Data

Chapter 4 Arithmetic Functions

Elec 326: Digital Logic Design

REGISTER TRANSFER LANGUAGE

Arithmetic-logic units

Computer Organization (Autonomous)

CSC 220: Computer Organization Unit 10 Arithmetic-logic units

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

Lab Assignment 2. Implementing Combinational and Sequential Logic in VHDL

Arithmetic Logic Unit

ECE2029: Introduction to Digital Circuit Design Lab 3 Implementing a 4-bit Four Function ALU

Exp#8: Designing a Programmable Sequence Detector

Computer Architecture Set Four. Arithmetic

CSE140 L. Instructor: Thomas Y. P. Lee January 18,2006. CSE140L Course Info

CAD4 The ALU Fall 2009 Assignment. Description

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS

11/22/1999 7pm - 9pm. Name: Login Name: Preceptor Name: Precept Number:

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Note that none of the above MAY be a VALID ANSWER.

Chapter 3: part 3 Binary Subtraction

Parallel logic circuits

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

Computer Organization

CHAPTER 4: Register Transfer Language and Microoperations

Basic Arithmetic (adding and subtracting)

CO Computer Architecture and Programming Languages CAPL. Lecture 9

REGISTER TRANSFER AND MICROOPERATIONS

Lab 3: Standard Combinational Components

CS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016

EKT 422/4 COMPUTER ARCHITECTURE. MINI PROJECT : Design of an Arithmetic Logic Unit

Submitted by 1

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

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

60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design

Lab Manual for COE 203: Digital Design Lab

Register Transfer and Micro-operations

378: Machine Organization and Assembly Language

Chapter 3 Arithmetic for Computers

EE 109 Unit 6 Binary Arithmetic

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers Implementation

Lab 7: RPN Calculator

ECE/CS Computer Design Lab Lab 1 - Completion by Sept 13. Lab 2 will be assigned during the 2nd week of September.

Introduction to Computer Science. Homework 1

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

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

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

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

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

Design and Implementation of IEEE-754 Decimal Floating Point Adder, Subtractor and Multiplier

Course Description: This course includes concepts of instruction set architecture,

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register

SKEE2263 Sistem Digit

Review. Steps to writing (stateless) circuits: Create a logic function (one per output)

Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

Cpr E 281 FINAL PROJECT ELECTRICAL AND COMPUTER ENGINEERING IOWA STATE UNIVERSITY. FINAL Project. Objectives. Project Selection

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

COMPUTER ORGANIZATION

Binary Adders: Half Adders and Full Adders

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

Lab Assignment 1. Developing and Using Testbenches

Chapter 4 Arithmetic

VHDL Implementation of Arithmetic Logic Unit

VHDL implementation of 32-bit floating point unit (FPU)

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

ECE2029: Introduction to Digital Circuit Design. Lab 2 Implementing Combinational Functional Blocks

Experiment 7 Arithmetic Circuits Design and Implementation

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

COMPUTER ARITHMETIC (Part 1)

ECE 313 Computer Organization EXAM 2 November 11, 2000

Implementation of Low Power High Speed 32 bit ALU using FPGA

Arithmetic for Computers

Chapter 10 - Computer Arithmetic

An FPGA based Implementation of Floating-point Multiplier

ANADOLU UNIVERSITY. EEM Digital Systems II

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

Programming in C++ 5. Integral data types

Midterm Project Design of 4 Bit ALU Fall 2001

KING FAHD UNIVERSITY OF PETROLEUM & MINERALS COMPUTER ENGINEERING DEPARTMENT

Floating Point Arithmetic

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

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

EC2303-COMPUTER ARCHITECTURE AND ORGANIZATION

Chapter 5 Design and Implementation of a Unified BCD/Binary Adder/Subtractor

ECE 645: Lecture 1. Basic Adders and Counters. Implementation of Adders in FPGAs

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

Chapter 3 Part 2 Combinational Logic Design

Transcription:

EGC221: Digital Logic Lab Experiment #7 Arithmetic Logic Unit (ALU) Schematic Implementation Student s Name: Student s Name: Reg. no.: Reg. no.: Semester: Spring 2017 Date: 04 April 2017 Assessment: Assessment Point Weight Grade Methodology and correctness of results Discussion of results Participation Assessment Points Grade: Comments: Division of Engineering Programs Page 1 of 5

Experiment #7: Arithmetic Logic Unit Objectives: The objective of this lab is: 1. To design a 4-bit ALU 2. To implement the ALU on an (Altera) FPGA Development Board 3. To verify the operation of the ALU through simulation 4. To experimentally check the operation of the ALU This lab is different from the other assignments in the sense that it is a design project which gives you more freedom to come up with your own solutions. The following write-up serves as a guideline to help you design the lab. However, if you find more efficient or more elegant ways to implement parts of the ALU, go ahead. Just make sure you justify your design and explain it clearly in the lab report write-up. Pre-lab assignment: a. Problem Statement: An Arithmetic and Logic Unit (ALU) is a combinational circuit that performs arithmetic and logic micro-operations on a pair of n-bit operands (e.g., A[3:0] and B[3:0]). The operations performed by an ALU are controlled by a set of function-select inputs. In this lab you will design a 4-bit ALU with 3 function-select inputs: Selects: S0, S1, and Mode: M. The functions performed by the ALU are specified in Table 1. Table 1: Functions of ALU Logic M S1 S0 FUNCTION OPERATION (bit wise) 0 0 0 A B AND 0 0 1 A + B OR 0 1 0 A B XOR 0 1 1 A NOT Arithmetic M S1 S0 FUNCTION OPERATION 1 0 0 A + B Addition 1 0 1 A - B Subtract 1 1 0 A + 1 Increment 1 1 1 A - 1 Decrement Division of Engineering Programs Page 2 of 5

Besides the functions, you are required to provide status bits (flags) that indicate whether or not certain conditions have taken place following an arithmetic or logic operation. For arithmetic operations you need flags for carry (C), negative (N), zero (Z), and overflow (V) conditions. For logic operations you need the carry (C), negative (N), and zero (Z) flags. A block diagram is given in Figure 1. C N Z V Figure 1: Block diagram of the 4-bit ALU. When doing arithmetic, we need to decide how to represent negative numbers. As is commonly done in digital systems, negative numbers are represented in twos complement. This has a number of advantages over the sign and magnitude representation such as easy addition or subtraction of mixed positive and negative numbers. Also, the number zero has a unique representation in twos complement. The twos complement of an n-bit number N is defined as: 2 n - N = (2 n - 1 - N) + 1 The last representation gives us an easy way to find twos complement: take the bit wise complement of the number and add 1 to it. As an example, to represent the number -5, we take twos complement of 5 (=0101) as follows, 5 0 1 0 1 --> 1 0 1 0 (bit wise complement) + 1 1 0 1 1 (twos complement) Numbers represented in twos complement lie within the range -(2 n-1 ) to +(2 n-1-1). For a 4-bit number this means that the number is in the range -8 to +7. There is a potential problem we still need to be aware of when working with two's complement, i.e. over- and underflow as is illustrated in the example below, 0 1 0 0 (=carry Ci) +5 0 1 0 1 +4 + 0 1 0 0 +9 0 1 0 0 1 = -7! Division of Engineering Programs Page 3 of 5

also, 1 0 0 0 (=carry Ci) -7 1 0 0 1-2 + 1 1 1 0-9 1 0 1 1 1 = +7! Both calculations give the wrong results (-7 instead of +9 or +7 instead of -9) which is caused by the fact that the result +9 or -9 is out of the allowable range for a 4-bit twos complement number. Whenever the result is larger than +7 or smaller than -8 there is an overflow or underflow and the result of the addition or subtraction is wrong. Overflow and underflow can be easily detected when the carry out of the most significant stage (i.e. C4) is different from the carry out of the previous stage (i.e., C3). b. Possible design strategies When designing the ALU we will follow the principle "Divide and Conquer" in order to use a modular design that consists of smaller, more manageable modules. Instead of designing the 4-bit ALU as one circuit we can first design a one-bit ALU, also called a bit-slice. These bitslices can then be put together to make a 4-bit ALU. There are different ways to design a bit-slice of the ALU. One method consists of writing the truth table for the one bit ALU. This table has 6 inputs (M, S1, S0, C0, Ai and Bi) and two outputs Fi and Ci+1. This can be done but may be tedious when it has to be done by hand. An alternative way is to split the ALU into two modules, one Logic and one Arithmetic module. A possible block diagram of the ALU is shown in Figure 2. It consists of three modules: 2:1 MUX, a Logic unit and an Arithmetic unit. Cout, N, V Z Figure 2: Block diagram of the ALU Division of Engineering Programs Page 4 of 5

This design methodology creates separate 4-bit units for each function. This method would utilize the 4-bit adder/subtractor that you have created in a previous lab, leaving you with some modifications (for increment and decrement) as well as some new designs (for your logic functions.) The 8 functions would then be selected with a 4-bit wide, 8:1 MUX, therefore directing the desired function to the (4-bit) output. Note: This lab is worth 20 points Hand-in You have to hand in a lab report that contains the following: 1. Course Title, Lab number and title, your name(s) and date (You can use the cover sheet provided with this handout.) 2. Theory of topic (ALU) 3. Section on the Pre-lab explaining the detailed design of each macro and its simulation waveform. 4. Conclusion and overall discussion. The lab report is an important part of the laboratory. Write it carefully, be clear and well organized. It is the only way to convey that you did a great job in the lab. It is necessary that you use computer tools (MS Word, Visio, Altera, etc.) to document the entire lab report. Division of Engineering Programs Page 5 of 5