Lab #12: 4-Bit Arithmetic Logic Unit (ALU)

Similar documents
Lab #11: Register Files

CHAPTER 4 RESULTS & DISCUSSION

Lab #13: FPGA Circuit Realization

Lab #11: Register Files

Lab 13: FPGA Circuit Realization Ian Callahan

Ryerson University Department of Electrical and Computer Engineering COE/BME 328 Digital Systems

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

University of Pennsylvania Department of Electrical and Systems Engineering. Digital Design Laboratory. Lab8 Calculator

Electrical and Telecommunications Engineering Technology_TCET3122/TC520. NEW YORK CITY COLLEGE OF TECHNOLOGY The City University of New York

HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

ELEC 204 Digital System Design LABORATORY MANUAL

Dev Bhoomi Institute Of Technology Department of Electronics and Communication Engineering PRACTICAL INSTRUCTION SHEET

Microprocessor Design

Physics 323. Experiment # 10 - Digital Circuits

Register Transfer Level in Verilog: Part II

North Shore Community College

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Altera s Max+plus II Tutorial

Tribhuvan University Institute of Science and Technology Bachelor of Science in Computer Science and Information Technology

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

Semester III. Subject Name: Digital Electronics. Subject Code: 09CT0301. Diploma Branches in which this subject is offered: Computer Engineering

1. a) For the circuit shown in figure 1.1, draw a truth table showing the output Q for all combinations of inputs A, B and C. [4] Figure 1.

EEE130 Digital Electronics I Lecture #1_2. Dr. Shahrel A. Suandi

Digital Networks and Systems Laboratory 2 Basic Digital Building Blocks Time 4 hours

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Experiment (6) 2- to 4 Decoder. Figure 8.1 Block Diagram of 2-to-4 Decoder 0 X X

Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

Elwin Cabrera May 11, 2016 DIGITAL CLOCK. ECE271/CSC222 Final Project Report

Combinational Logic Design

CPE 200L LABORATORY 3: SEQUENTIAL LOGIC CIRCUITS UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND: SR FLIP-FLOP/LATCH

1. Convert the decimal number to binary, octal, and hexadecimal.

Laboratory Exercise 3

Computer Systems Architecture

ENGG2410: Digital Design Lab 5: Modular Designs and Hierarchy Using VHDL

DepartmentofElectronicEngineering NEDUniversity ofengineering &Technology LABORATORY WORKBOOK DIGITAL LOGIC DESIGN (TC-201)

MODULAR DIGITAL ELECTRONICS TRAINING SYSTEM

Modeling Digital Systems with Verilog

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

Review : 2 Release Date : 2019 Last Amendment : 2013 Course Code : SKEE 2742 Procedure Number : PK-UTM-FKE-(0)-10

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Fundamentals of Digital Electronics

Introduction to Digital Logic Missouri S&T University CPE 2210 Exam 3 Logistics

List of the CMOS 4000 series Dual tri-input NOR Gate and Inverter Quad 2-input NOR gate Dual 4-input NOR gate

Digital Fundamentals. Lab 5 Latches & Flip-Flops CETT Name: Date:

Minnesota State College Southeast

Lab 2: Hardware/Software Co-design with the Wimp51

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

Field Programmable Gate Arrays (FPGAs)

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

Laboratory Exercise 6

CS 261 Fall Mike Lam, Professor. Sequential Circuits

Laboratory 8. Digital Circuits - Counter and LED Display

BCN1043. By Dr. Mritha Ramalingam. Faculty of Computer Systems & Software Engineering

Today 3/8/11 Lecture 8 Sequential Logic, Clocks, and Displays

CPSC 121: Models of Computation Lab #5: Flip-Flops and Frequency Division

Part IA Computer Science Tripos. Hardware Practical Classes

Figure 7.8 Circuit Schematic with Switches, Logic Gate, and Flip-flop

A Combined Combinational-Sequential System

NEW MEXICO STATE UNIVERSITY Electrical and Computer Engineering Department. EE162 Digital Circuit Design Fall Lab 5: Latches & Flip-Flops

6.3 Sequential Circuits (plus a few Combinational)

COE328 Course Outline. Fall 2007

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

Laboratory 11. Required Components: Objectives. Introduction. Digital Displays and Logic (modified from lab text by Alciatore)

EECS 270 Midterm 2 Exam Closed book portion Fall 2014

COMP sequential logic 1 Jan. 25, 2016

Department of Electrical and Computer Engineering Mid-Term Examination Winter 2012

Chapter 5 Sequential Circuits

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

Flip Flop. S-R Flip Flop. Sequential Circuits. Block diagram. Prepared by:- Anwar Bari

TIME SCHEDULE. MODULE TOPICS PERIODS 1 Number system & Boolean algebra 17 Test I 1 2 Logic families &Combinational logic

EET 1131 Lab #10 Latches and Flip-Flops

12-bit Wallace Tree Multiplier CMPEN 411 Final Report Matthew Poremba 5/1/2009

Integrated Circuits 7

MODULE 3. Combinational & Sequential logic

TRAINING KITS ON DIGITAL ELECTRONIC EXPERIMENTS. Verify Truth table for TTL IC s AND, NOT, & NAND GATES

LogicBlocks Experiment Guide a learn.sparkfun.com

Digital Logic. ECE 206, Fall 2001: Lab 1. Learning Objectives. The Logic Simulator

Step 1 - shaft decoder to generate clockwise/anticlockwise signals

CPSC 121: Models of Computation Lab #5: Flip-Flops and Frequency Division

1. Synopsis: 2. Description of the Circuit:

Hardware Modeling of Binary Coded Decimal Adder in Field Programmable Gate Array

SIGNETICS INTEGRATED CIRCUITS Low Power Schottky TTL 54LS00-74LS00 Series. Supply Current/typmA Delay/typns Quad 2-Input NAND Gate 54LS00/C,D

Design of a Binary Number Lock (using schematic entry method) 1. Synopsis: 2. Description of the Circuit:

University of Victoria. Department of Electrical and Computer Engineering. CENG 290 Digital Design I Lab Manual

First Name Last Name November 10, 2009 CS-343 Exam 2

CSE140L: Components and Design Techniques for Digital Systems Lab. CPU design and PLDs. Tajana Simunic Rosing. Source: Vahid, Katz

DIGITAL CIRCUIT COMBINATORIAL LOGIC

Sequential Digital Design. Laboratory Manual. Experiment #7. Counters

CS302 Digital Logic Design Solved Objective Midterm Papers For Preparation of Midterm Exam

Where Are We Now? e.g., ADD $S0 $S1 $S2?? Computed by digital circuit. CSCI 402: Computer Architectures. Some basics of Logic Design (Appendix B)

STATIC RANDOM-ACCESS MEMORY

Laboratory 10. Required Components: Objectives. Introduction. Digital Circuits - Logic and Latching (modified from lab text by Alciatore)

Assignment 2b. ASSIGNMENT 2b. due at the start of class, Wednesday Sept 25.

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

Switching Circuits & Logic Design, Fall Final Examination (1/13/2012, 3:30pm~5:20pm)

Chapter 2. Digital Circuits

EXPERIMENT: 1. Graphic Symbol: OR: The output of OR gate is true when one of the inputs A and B or both the inputs are true.

Transcription:

Lab #12: 4-Bit Arithmetic Logic Unit (ALU) ECE/COE 0501 Date of Experiment: 4/3/2017 Report Written: 4/5/2017 Submission Date: 4/10/2017 Nicholas Haver nicholas.haver@pitt.edu 1 H a v e r

PURPOSE The purpose of this lab was to design and build an arithmetic logic unit, and incorporate it into our existing register file from Lab 11. In doing this, we created a simple computer capable of storing values and performing a variety of arithmetic and logic operations on the values. Each operation required two 4-bit ALU inputs, and the ALU produced a single 4-bit output. After the circuit was designed in Altera Quartus II, a series of programs were used to test circuit functionality. These programs were waveforms designed to carry out a specific operation on a specific pair of operands. Both logic operations, such as AND and XOR, and arithmetic operations, such as addition and multiplication, were carried out in the test programs. METHOD 1) After examining the provided block diagram in Figure 1, the 4-bit latch was designed on paper, then using Altera Quartus II with 2 7474 D flip-flops, and was then tested using a vector waveform. Figures 2 and 3 show the 4-bit latch schematic and test waveform. 2) Based on the block diagram, the Altera Quartus schematic was revised to include the latch, 74181 arithmetic logic unit (ALU), and 4x2:1 74157 data selector. A writeback datapath between the ALU output and data selector was also added. The Quartus schematic can be seen in Figure 4. 3) Using a vector waveform, shown in Figure 5, schematic functionality was verified by simulating four operations, two logic and two arithmetic. For each operation, two operands were loaded into two different registers, and the output was written to a third register. Operations, function select codes, mode control inputs, data inputs, and data outputs are shown in Table 1. 4) The next program, implemented in the form of a vector waveform, allowed the ALU to sum four hexadecimal digits, and store the result in one of the registers. Table 2 shows the function select code, mode control input, data inputs, data output and final register values of this operation. Figure 6 shows the vector waveform generated used for this simulation. 5) The final program allowed the ALU to multiply two hexadecimal numbers ad store the lower four bits of the result to a register. Prior to implementing this operation in the form of a vector waveform, a pseudo-assembly code was written to improve the accuracy and efficiency of the waveform inputs to be implemented. Table 3 shows the pseudo-assembly code and final register values for the multiplication process. 6) Based on the pseudo-assembly code, a vector waveform file, shown in Figure 7, was constructed to implement the multiplication. Periodic checkpoints in which all register values were read out were included to simplify any necessary debugging. Table 4 shows the function select code, mode control input, data inputs, data output and final register values of this operation. Due to laboratory time constraints, the schematic was only simulated to calculate the first partial product. However, based on the pseudo-assembly code, the method used could be continued with each additional bit of the first multiplicand, and the values could be summed to complete the multiplication. 7) Based on the Quartus schematic, the ALU circuit was implemented on a protoboard, adding to the register file constructed in Lab 11. All of the control inputs were implemented using de-bounced switches using 7400 Quad NAND integrated circuits. The de-bounced switch schematic is shown in Figure 8. Table 5 details the integrated circuits used in implementing the ALU/register file. Specification for the integrated circuits are shown in Figures 9-16. 8) The operations discussed in Steps 3, 4, and 6 were carried out on the circuit, and evaluated using an Intronix LogicPort logic analyzer. Logic analyzer waveforms are shown in Figures 17-21. 2 H a v e r

RESULTS Figure 1: ALU/Register Block Diagram for Lab #12 Figure 2: Altera Quartus 4-Bit Latch Schematic 3 H a v e r Figure 3: Altera Quartus 4-Bit Latch Test Waveform

Figure 4: Altera Quartus ALU Schematic Figure 5: Vector Waveform for ALU Functionality Verification 4 H a v e r

Operation Function Select Mode Control Input A Input B Output A OR B 1110 1 1101 0110 1111 A XOR B 0110 1 1001 0100 1101 A plus B 1001 0 0101 0001 0110 (A AND B) minus 1 1011 0 0011 0010 0001 Table 1: Inputs, Outputs, and Control Signals for ALU Functionality Verification Operation Function Select Mode Control Data Inputs Data Output Final Register Values A plus B plus C plus D 1001 0 0011 (3) 1011 (11) 1011 (11) 0101 (5) 0101 (5) 0010 (2) 0010 (2) 0001 (1) 0001 (1) Table 2: Inputs, Outputs, and Control Signals for ALU 4 Hex Sum Program Figure 6: Vector Waveform for ALU 4 Hex Sum Program 5 H a v e r

Data Input: A R0 Data Input: B R1 Data Input: 0001 R2 R2 latch ALU OP: R1 AND latch 000b 0 R2 R2 latch ALU OP: R0 AND latch 000 a 0b 0 R3 R2 latch ALU OP: A plus A*: R2 / latch 00 b 0 0 R2 //shift 000b 0 left R2 latch ALU OP: R0 AND R2 00 a 1b 0 0 R2 R2 latch ALU OP: R2 OR R3 00 a 1b 0 a 0b 0 R2 Data Input 0001 R3 //This value remains on DIP switches ALU OP: R1 AND R3 000 b 0 R3 ALU OP: A plus A*: R3 / latch 00 b 0 0 R3 //shift 000b 0 left ALU OP: A plus A*: R3 / latch 0 b 0 00 R3 // shift 00b 00 left ALU OP: R0 AND R3 0 a 2b 0 00 R3 ALU OP: R3 OR R2 0 a 2b 0 a 1b 0 a 0b 0 R2 ALU OP: R3 AND R1 000 b 0 R3 ALU OP: A plus A*: R3 / latch 00 b 0 0 R3 ALU OP: A plus A*: R3 / latch 0 b 0 00 R3 ALU OP: A plus A*: R3 / latch b 0 000 R3 ALU OP: R0 AND R3 a 3b 0 000 R3 ALU OP: R2 OR R3 a 3b 0 a 2b 0 a 1b 0 a 0b 0 R2 //First Partial Product! ALU OP: A plus A*: R3 / latch 0010 R3 ALU OP: R1 AND R3 R3 R0 latch ALU OP: A plus A*: R0 / latch a 2a 1a 00 R0 //A is shifted left permanently ALU OP: R3 AND R0 00 a 0b 1 0 R3 ALU OP: R3 OR R2 R2 ALU OP: A plus A*: R3 / latch 0010 R3 ALU OP: R3 AND R1 00b 10 R3 ALU OP: A plus A*: R3 / latch 0b 100 R3 ALU OP: R0 AND R3 0 a 1b 1 00 R3 ALU OP: R2 OR R3 R2 ALU OP: A plus A*: R3 / latch 0010 R3 ALU OP: R3 AND R1 00b 10 R3 ALU OP: A plus A*: R3 / latch 0b 100 R3 ALU OP: A plus A*: R3 / latch b 1000 R3 ALU OP: R3 AND R0 a 2b 1 000 R3 ALU OP: R3 OR R2 R2 ALU OP: A plus A*: R3 / latch 0010 R3 ALU OP: A plus A*: R3 / latch 0100 R3 R0 latch ALU OP: A plus A*: R0 / latch a 1a 000 R0 ALU OP: R1 AND R3 0 b 2 00 R3 ALU OP: R0 AND R3 0 a 0b 2 00 R3 ALU OP: R2 OR R3 R2 ALU OP: A plus A*: R3 / latch 0010 R3 ALU OP: A plus A*: R3 / latch 0100 R3 ALU OP: R3 AND R1 0b 200 R3 ALU OP: A plus A*: R3 / latch b 2000 R3 ALU OP: R3 AND R0 a 1b 2 000 R3 ALU OP: R3 OR R2 R2 ALU OP: A plus A*: R3 / latch 0010 R3 ALU OP: A plus A*: R3 / latch 0100 R3 ALU OP: A plus A*: R3 / latch 1000 R3 ALU OP: R3 AND R1 b 3000 R3 R0 latch ALU OP: A plus A*: R0 / latch a 0000 R0 ALU OP: R0 AND R3 a 0b 3 000 R3 ALU OP: R3 OR R2 R2 //RESULT: R2 = R0 x R1 ***Final Register Values*** R0: a 0000 R1: B R2: (a 3b 0+a 2b 1+a 1b 2+a 0b 3) (a 1b 1 + a 2b 0+a 0b 2) (a 1b 0 + a 0b 1) a 0b 0 R3: a 0b 3 000 Table 3: Pseudo-Assembly Code for Hexadecimal Value Multiplication 6 H a v e r

Figure 7: Vector Waveform for First Partial Product of Hexadecimal Multiplication Operation Function Selects Mode Control Data Inputs Data Output Final Register Values A x B 1011 (A AND B) 1 0101 (5) 0101 (5) 0101 (5) 1100 (A plus A*) 0 0011 (3) 0011 (3) 1001 (A plus B) 0 0101 (5) 0000 (0) Table 4: Inputs, Output, and Control Signals for First Partial Product of ALU Hex Multiplication Program Figure 8: De-Bounced Switch Control Input Schematic 7 H a v e r

Integrated Circuit Use in ALU/Register File 74157 Quad 2/1 Data Selector (Multiplexor) Select register input between user data input and ALU output 74670 4x4 Register File Store 4 hexadecimal (4-bit) data inputs, ALU operands, and ALU outputs 74193 4-Bit Up/Down Binary Counter Cycle through register addresses to read and write 74247 BCD to 7-Segment Decoder Drive 7-segment LED displays at register output and ALU output 74181 Arithmetic Logic Unit Perform logic or arithmetic operations based on function select inputs 7474 Dual D Flip-Flop 4-Bit latch for ALU operand input 7400 Quad 2-Input NAND Gate De-bounced switch for control inputs 7-Segment LED Display Display hexadecimal values at register output and ALU output Table 5: Integrated Circuits Used to Implement ALU and Register File Figure 9: Quad 2/1 Data Selector (Multiplexor) Pin Diagram and Descriptions Figure 10: 4x4 Register File Pin Diagram and Descriptions 8 H a v e r

Figure 11: 4-Bit Up/Down Binary Counter Pin Diagram and Descriptions Figure 12: BCD to 7-Segment Decoder Pin Diagram and Descriptions Figure 13: Arithmetic Logic Unit Pin Diagram and Descriptions 9 H a v e r

Figure 14: Dual D Flip-Flop Pin Diagram and Logic Diagram Figure 15: Quad 2-Input NAND Gate Pin Diagram and Logic Diagram Figure 16: 7-Segment LED Display Wiring Diagram 10 H a v e r

Figure 17: Logic Analyzer Waveform for "1101 OR 0110 = 1111" Figure 18: Logic Analyzer Waveform for "1001 XOR 0100 = 1101" As with the Quartus simulation, four operations were carried out to verify circuit functionality. Figure 17 shows that 1101 (13) OR 0110 (6) = 1111 (15). In Figure 18, 1001 (9) XOR 0100 (4) = 1101 (13). Figure 19 shows that 0101 (5) plus 0001 (1) = 0110 (6). Lastly, in Figure 20, [0011 (3) AND 0010 (2)] minus 1 = 0001 (1). Figure 19: Logic Analyzer Waveform for "0101 plus 0001 = 0110" 11 H a v e r

Figure 20: Logic Analyzer Waveform for "(0011 AND 0010) minus 1 = 0001" Figure 21: Logic Analyzer Waveform for First Partial Product of Hexadecimal Multiplication "0101 x 0011 = 1111" 12 H a v e r

CONCLUSION The purpose of this lab was to design and build an arithmetic logic unit, and incorporate it into our existing register file from Lab 11. In doing this, we created a simple computer capable of storing values and performing a variety of arithmetic and logic operations on the values. Using Altera Quartus, a schematic was tested using programs in the form of vector waveforms with inputs and control signals. Logic operations and arithmetic operations, such as addition and multiplication were carried out both in Quartus and on the protoboard. The time consumption and complexity of these operations, particularly multiplication, is a testament to the marvel that is modern computing. In Lab 13, the circuit constructed in Labs 11 and 12 will be realized on a field programmable gate array, or FPGA. Circuit characteristics will be established in PC software, which will then be downloaded onto the FPGA. REFERENCES Dr. Alex Jones s laboratory instructions ECE/COE 0501 Lab Manual Data sheets for 74157, 74670, 74193, 74247, 74181, 7474, and 7400 integrated circuits 7-Segment LED display wiring diagram Lab Partner: Jenn Gingerich 13 H a v e r