Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder

Similar documents
cs281: Introduction to Computer Systems Lab03 K-Map Simplification for an LED-based Circuit Decimal Input LED Result LED3 LED2 LED1 LED3 LED2 1, 2

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 09 MULTIPLEXERS

GEORGIA INSTITUTE OF TECHNOLOGY School of Electrical and Computer Engineering ECE 2020 Fall 2017 Lab #1: Digital Logic Module

A B A+B

Finite State Machine Lab

Overview. Exploration: LED Ramp Light. cs281: Introduction to Computer Systems Lab04 K-Maps and a Sensor/Actuator Circuit

PART 1. Simplification Using Boolean Algebra

LAB #3: ADDERS and COMPARATORS using 3 types of Verilog Modeling

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 04. Boolean Expression Simplification and Implementation

A3 A2 A1 A0 Sum4 Sum3 Sum2 Sum1 Sum

Experiment 9: Binary Arithmetic Circuits. In-Lab Procedure and Report (30 points)

EECS 140 Laboratory Exercise 5 Prime Number Recognition

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018

Arduino - DigitalReadSerial

This tutorial will show you how to take temperature readings using the Freetronics temperature sensor and an Arduino Uno.

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

Experiment # 5 Debugging via Simulation using epd

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

Experiment 3: Logic Simplification

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS

Combinational Digital Design. Laboratory Manual. Experiment #3. Boolean Algebra Continued

Combinational Logic Worksheet

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Laboratory 1 Introduction to the Arduino boards

CprE 281: Digital Logic

The Alarm System: The alarm system to be designed has the following inputs.

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

Programmable Logic Design Techniques I

CSC 101: Lab #5 Boolean Logic Practice Due Date: 5:00pm, day after lab session

COMP combinational logic 1 Jan. 18, 2016

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

A3 A2 A1 A0 Sum4 Sum3 Sum2 Sum1 Sum

CMPE 413/ CMSC 711. Project Specification: 16 bit 2 s complement Adder and 8 bit 2 s complement multiplier. GND. Input bus. Latches I[8]-I[15]

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

MODULE 5 - COMBINATIONAL LOGIC

ECSE-323 Digital System Design. Lab #1 Using the Altera Quartus II Software Fall 2008

Standard Logic Chips and National Instruments ELVIS Breadboarding for Combinational Logic Circuits

(Refer Slide Time 3:31)

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

COS 116 The Computational Universe Laboratory 7: Digital Logic I

Counter & LED (LED Blink)

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

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

CTEC 1802 Embedded Programming Labs

Specification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3.

CARLETON UNIVERSITY. Laboratory 2.0

EE 1315 DIGITAL LOGIC LAB EE Dept, UMD

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

QUESTION BANK FOR TEST

Sten-SLATE ESP Kit. Description and Programming

Lesson 8: Digital Input, If Else

CS140 Lecture 03: The Machinery of Computation: Combinational Logic

Boolean Logic CS.352.F12

IME-100 Interdisciplinary Design and Manufacturing

Physics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5

Digital Design through. Arduino

TUTORIAL #2 HIERARCHICAL DESIGNS AND TEST FIXTURES

Introduction To Arduino

Create your own wireless motion sensor with

Propositional Calculus. Math Foundations of Computer Science

Lab 2 - Powering the Fubarino, Intro to Serial, Functions and Variables

Software Engineering 2DA4. Slides 2: Introduction to Logic Circuits

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

University of Hull Department of Computer Science C4DI Interfacing with Arduinos

CSCB58 - Lab 0. Intro to The Lab & The DE2 Board. Prelab /4 Part I (in-lab) /1 Part II (in-lab) /1

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S

Fall Harris & Harris

Halloween Pumpkinusing. Wednesday, October 17, 12

University of Florida EEL 3701 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering Revision 0 12-Jun-16

Elec 326: Digital Logic Design

Procedure: Determine the polarity of the LED. Use the following image to help:

LAB #1 BASIC DIGITAL CIRCUIT

Computer Organization and Levels of Abstraction

Combinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs

1 Discussion. 2 Pre-Lab

Physics 364, Fall 2012, reading due your answers to before the end of Wednesday s lab.

Chapter 3. Boolean Algebra and Digital Logic

EE 231 Fall Lab 1: Introduction to Verilog HDL and Altera IDE

Rotary Encoder Basics

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

Drexel University Electrical and Computer Engineering Department ECE 200 Intelligent Systems Spring Lab 1. Pencilbox Logic Designer

EMT1250 LABORATORY EXPERIMENT. EXPERIMENT # 10: Implementing Binary Adders. Name: Date:

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

EECS 140 Laboratory Exercise 4 3-to-11 Counter Implementation

Adafruit 1-Wire GPIO Breakout - DS2413

Digital Circuits. Page 1 of 5. I. Before coming to lab. II. Learning Objectives. III. Materials

keyestudio Keyestudio MEGA 2560 R3 Board

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

Engineering 303 Digital Logic Design Fall 2018

EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Midterm Exam Review. CS 2420 :: Fall 2016 Molly O'Neil

E40M Useless Box, Boolean Logic. M. Horowitz, J. Plummer, R. Howe 1

Robotics/Electronics Review for the Final Exam

Logic Gates and Boolean Algebra ENT263

Physics 364, Fall 2014, reading due your answers to by 11pm on Sunday

4Serial SIK BINDER //77

CSE370 TUTORIAL 3 - INTRODUCTION TO USING VERILOG IN ACTIVE-HDL

Transcription:

cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder Overview The objective of this lab is to understand two basic combinational circuits the multiplexor and the adder. It also completes the second step of the design process, wherein you go from boolean algebra expressions that solve a particular computation defining outputs for each expression, realize the boolean expression with gates and wires, and also use the Arduino to assist in testing and validating your circuits. This Lab assumes you have already completed the associated Prelab. You should answer any questions asked below and turn in your lab response at the end of the lab. For each completed circuit, you will also demonstrate its correct operation for your instructor or TA. Multiplexor A multiplexer (aka mux) is a combinational circuit that selects one of its n input lines and provides it on the output. A 1 bit 2-1 mux has an n of 2, has 1 output, and the width of the input lines and output line are a single bit wide. Every mux requires additional input known as the select lines, which control which of the n inputs is selected for the output. The figure below shows, on the left, a 1-bit 2-1 mux, with its 2 selectable input lines labeled A and B, its select line labeled S, and its output labeled Y, On the right is a 1-bit 4-1 mux with its 4 selectable input lines labeled A, B, C, D, its select lines labeled S 1, S 0, and its output labeled Y. Q1 Consider the truth table from Q9 of the prelab. Is there a relationship between the boolean function described in Q9 and the boolean function of a mux as described above? If so, precisely describe the mapping between the inputs of one and the inputs of the other. Q2 Given the description and picture of a 1 bit, 4-1 mux, how many rows would be present in a truth table for this function? 1

Q3 A partial truth table is given below. For the given rows/inputs, fill in the corresponding values of Y. row A B C D S 1 S 0 Y 0 0 0 0 0 0 0 1 0 0 0 0 0 1 2 0 0 0 0 1 0 3 0 0 0 0 1 1 4 0 0 0 1 0 0 5 0 0 0 1 0 1 6 0 0 0 1 1 0 7 0 0 0 1 1 1 8 0 0 1 0 0 0 9 0 0 1 0 0 1 10 0 0 1 0 1 0 11 0 0 1 0 1 1 12 0 0 1 1 0 0 13 0 0 1 1 0 1 14 0 0 1 1 1 0 15 0 0 1 1 1 1 The adept reader should realize that the truth tables from Q9 of the prelab, Q17 of the prelab, and the 1 bit 2-1 mux described above are all describing the same boolean function. When we realize a function as a digital logic circuit, we want to use as few gates as possible, and this translates to the simplest boolean expression equivalent to the desired function. For the mux, the equation given in section 1.5 of the prelab gives us this simplest form, and so the next section of this lab will build and test this 2-1 mux circuit. Y = AS + BS Breadboard Initial Setup For the purposes of the remainder of the mux portion of this lab, we will use A, B, and S to refer to the 3 inputs to the circuit, and Y to refer to the output. We also need to refer to elements of the breadboard, so S 1 through S 8 will refer to the breadboard s Logic Switches at the lower left side of the board. 1. Pick three of the 5 pin rows on the breadboard to be designated for the three inputs A, B, and S. Wire Logic Switch S 1 to A, S 2 to B, and S 3 to S. 2. Wire A to Logic Monitor/Logic Indicator 1, B to Logic Indicator 2, and S to Logic Indicator 3. This will give us the ability to visualize the inputs to the mux circuit. 2

3. Designate another row on the breadboard to be Y, and wire Y to Logic Indicator 8 (to give separation from the 3 inputs). 4. Obtain from your instructor or TA three logic chips, a 7404, 7408, and 7432 and insert all three on the breadboard such that the input pins are all independent of each other and of your designated rows for A, B, S, and Y. Make sure when you place the chips that the physical notch on the chip is oriented to the North/top of the breadboard. 5. Using the IC schematic for each of the three chips, find the pins that feed GND and Vcc (+5 V) to the chip and wire these to GND and +5V respectively. The 2-1 Mux On the prepared breadboard, wire the following boolean algebra expression for Y : Y = AS + BS From the IC schematics, we can see that the 7404 chip provides six independent inverters (NOT gates), the 7408 provides four AND gates, and the 7432 provides four OR gates, so you will not need any more than the three provided chips. You will have to figure out the correct pins on the chips to use for inputs and outputs to realize the circuit. Once you have completed the circuit, use the manual switches to check the output given different input combinations and convince yourself of its correct operation. If it does not function properly, work your way from the original inputs through intermediate wires (by connecting to another Logic Indicator) to track down the problem. Arduino-based Testing/Validation Using manual switches to drive the inputs of circuits and visually checking the outputs and comparing to expected values in a truth table is a cumbersome and error prone approach to the testing and validation of a circuit. So we will make use of the programmability of the Arduino and use it to drive the circuit through the input combinations and to check and validate the output of the circuit. If you have not already done so, get an Arduino controller, and hook up your laptop, running the Arduino Sketch IDE, to the Arduino via the USB cable. 1. Wire GND and +5V on the breadboard to the Arduino. 2. Remove the wires from the Logic Switches S 1, S 2, S 3 to A, B, S and instead wire Arduino pins 11 to A, 12 to B, and 13 to S on the breadboard. 3. Wire Y on the breadboard to Arduino pin 10. 4. From the course web page or this PDF, copy the MuxValidate sketch below into the Arduino IDE as a new sketch, and Verify (i.e. compile) the sketch. const int A[] = {0, 0, 0, 0, 1, 1, 1, 1}; const int B[] = {0, 0, 1, 1, 0, 0, 1, 1}; 3

const int S[] = {0, 1, 0, 1, 0, 1, 0, 1}; const int Y[] = {0, 0, 0, 1, 1, 0, 1, 1}; const int WAIT0 = 300; const int WAIT1 = 2000; int index = 0; int x; void setup() { Serial.begin(9600); pinmode(11, OUTPUT); pinmode(12, OUTPUT); pinmode(13, OUTPUT); } pinmode(10, INPUT); void loop() { digitalwrite(11, A[index]); digitalwrite(12, B[index]); digitalwrite(13, S[index]); } delay(wait0); x = digitalread(10); Serial.print(index); if (x == Y[index]) { Serial.println(": OK"); } else { Serial.println(": BAD"); } delay(wait1); index = (index + 1) % 8; 5. Perform a code walk-through and explain to your lab partner the logic of the sketch. 6. Upload the sketch and validate your circuit. You can see the validation output from the Serial.println() invocations by clicking the document-looking icon in the top right of the Arduiono sketch window. This opens a window that displays any Serial.println() output generated onboard the Arduino and sent (through the USB interface) back to the laptop. If the circuit does not work properly for all input combinations, debug your circuit. Because the Arduino is going to continue changing the inputs, you may need to go back to the switch-based inputs to give yourself the control you need to debug. Q4 Demonstrate the circuit for the instructor or assistant. 4

Full Adder Sum Output A full adder is a circuit with three single bit inputs, often labeled A, B, and C in that performs the computation for one column of the binary addition process add the two 1-bit inputs A and B, along with a possible carry in, C in, resulting in two output bits, the sum bit, labeled S, and the carry out bit, labeled C out. Described slightly differently, the prelab definition of the truth table in Q10 is the same full adder definition, where X 2 and X 1 are A and B, X 0 is C in, Y 1 is C out, and Y 0 is S. Circuit Design Q5 Rewrite the truth table with inputs and outputs as described above: row C in A B C out S 0 0 0 0 1 0 0 1 2 0 1 0 3 0 1 1 4 1 0 0 5 1 0 1 6 1 1 0 7 1 1 1 Q6 Fill in the boolean expression defining the sum bit, S, in terms of A, B, and C in in SOP form: S = Q7 : If we assume 2-input AND and OR gates, and single bit NOT gates, how many gates would you use to create an implementation of S? Q8 : Does your answer change if you look for common sub terms (such as the negation of an input used in multiple places in Y )? 5

Q9 : In the above, we need to AND together more than 2 input variables (or their negation), and then we need to OR together more than 2 of these AND-terms. Draw a picture of a digital logic circuit that accomplishes this only using AND and OR gates with 2 inputs each. The focus of the next lab, lab3, is one of simplification, so that we can reduce the number of gates required for any given combinational circuit. In the remainder of this section, we will lead you through a different means of simplification and focus our energies on the sum (S) bit. This will expose us to an additional boolean logic gate and will also make an implementation of the S bit much more manageable for the purposes of the current lab. Q10 : We can draw a partial truth table that includes just A and B as inputs and is the truth table for the case where C in is 0. This partial truth table corresponds to the first four rows of the full truth table above. Fill in this truth table: row A B S for C in = 0 (denote by X) 0 0 0 1 0 1 2 1 0 3 1 1 Q11 : Look carefully at this truth table. What boolean function has this characteristic that it is 1 if one or the other of the inputs is 1, but is 0 if both are 0 or if both are 1? 6

Q12 : Look at the values of S in the original truth table for the last four rows (when C in is 1). Given your characterization from the last question, describe in English what is happening when C in is 1. Q13 : If we denote by the variable X the result of this two-input truth table, we can imagine a sub circuit that realizes X, dependent only on A and B, and can then use X in an aggregate circuit to solve a bigger problem. Say that in this new truth table we have input C in and X, and we are still designing a circuit to compute S. Using your original truth table and using the derived X instead of the individual inputs A and B, we define our aggregate circuit: row C in X S 0 0 0 1 0 1 2 1 0 3 1 1 So row 0 in this truth table corresponds to both rows 0 and 3 in the original truth table, since we have the same resultant value based on C in and X. Row 1 corresponds to both rows 1 and 2, and so forth. If the multiple rows did not yield the same value for each of these cases, we might not be able to replace two input variables (A and B) with our computed value of X. Q10 : Look carefully at this truth table. What boolean function captures S in terms of C in and X? Q11 : Based on the two truth tables, we should now be able to define S in terms of C in and A and B: S = Q12 : If we assume 2-input gates, how many gates would you use to create an implementation of S? 7

Q13 : We can double check our derivation above by using a truth table to prove the equivalence on your definition of Y. Fill in the columns of the following truth table: row C in A B S A B C in (A B) 0 0 0 0 1 0 0 1 2 0 1 0 3 0 1 1 4 1 0 0 5 1 0 1 6 1 1 0 7 1 1 1 Q14 :Argue the equivalence between the original S (which could be realized by the original SOP) and the simplified expression: Circuit Implementation Implementation is Optional, for Extra Credit Your steps from here are as follows: 1. Using switches for input, build and manually check a circuit for the S output bit of the full adder. Debug if necessary. 2. By modifying the mapping of inputs to outputs, use the Sketch from the prior validation step to drive validation of your S bit full adder circuit. Debug if necessary. 3. Demonstrate your working circuit for your instructor or TA. 8