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

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

DIGITAL REGISTERS. Serial Input Serial Output. Block Diagram. Operation

Contents Circuits... 1

CHAPTER 4 RESULTS & DISCUSSION

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

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

Universal Asynchronous Receiver- Transmitter (UART)

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

ELEC 204 Digital System Design LABORATORY MANUAL

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

Logic Devices for Interfacing, The 8085 MPU Lecture 4

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

Chapter 5 Sequential Circuits

Chapter 2. Digital Circuits

Computer Systems Architecture

Introduction. Serial In - Serial Out Shift Registers (SISO)

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

INC 253 Digital and electronics laboratory I

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

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

Counter dan Register

ASYNCHRONOUS COUNTER CIRCUITS

Midterm Exam 15 points total. March 28, 2011

LATCHES & FLIP-FLOP. Chapter 7

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

CSE 352 Laboratory Assignment 3

MUHAMMAD NAEEM LATIF MCS 3 RD SEMESTER KHANEWAL

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Microprocessor Design

Digital Electronics II 2016 Imperial College London Page 1 of 8

1. Synopsis: 2. Description of the Circuit:

Chapter 4. Logic Design

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science. EECS 150 Spring 2000

Laboratory 4. Figure 1: Serdes Transceiver

ELEN Electronique numérique

Lab #10: Building Output Ports with the 6811

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

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

Digital Circuits I and II Nov. 17, 1999

LAB #4 SEQUENTIAL LOGIC CIRCUIT

LSN 12 Shift Registers

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Serial In/Serial Left/Serial Out Operation

Laboratory Exercise 7

Chapter 6 Registers and Counters

CSE 275 Digital Design Lab Lab 8 Serial Adder/Subtractor Penn State Erie, The Behrend College Fall Semester 2007 Number of Lab Periods: 2

Experiment # 12. Traffic Light Controller

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

A Combined Combinational-Sequential System

Dr. Shahram Shirani COE2DI4 Midterm Test #2 Nov 19, 2008

CHAPTER1: Digital Logic Circuits

ECT 224: Digital Computer Fundamentals Digital Circuit Simulation & Timing Analysis

Registers and Counters

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Register Transfer Level in Verilog: Part II

Main Design Project. The Counter. Introduction. Macros. Procedure

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Administrative issues. Sequential logic

Chapter 9 MSI Logic Circuits

ECE Lab 5. MSI Circuits - Four-Bit Adder/Subtractor with Decimal Output

COMP2611: Computer Organization Building Sequential Logics with Logisim

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Registers

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

Counters

Registers and Counters

Modeling Digital Systems with Verilog

Chapter Contents. Appendix A: Digital Logic. Some Definitions

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

Report on 4-bit Counter design Report- 1, 2. Report on D- Flipflop. Course project for ECE533

Physics 323. Experiment # 10 - Digital Circuits

Main Design Project. The Counter. Introduction. Macros. Procedure

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

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

Physics 217A LAB 4 Spring 2016 Shift Registers Tri-State Bus. Part I

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

Digital Fundamentals: A Systems Approach

Computer Organization & Architecture Lecture #5

BUSES IN COMPUTER ARCHITECTURE

Logic. Andrew Mark Allen March 4, 2012

MODULAR DIGITAL ELECTRONICS TRAINING SYSTEM

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

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.

STATIC RANDOM-ACCESS MEMORY

Laboratory 9 Digital Circuits: Flip Flops, One-Shot, Shift Register, Ripple Counter

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

Asynchronous (Ripple) Counters

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

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

PHYS 3322 Modern Laboratory Methods I Digital Devices

EE292: Fundamentals of ECE

CprE 281: Digital Logic

DIGITAL CIRCUIT LOGIC UNIT 9: MULTIPLEXERS, DECODERS, AND PROGRAMMABLE LOGIC DEVICES

QUICK GUIDE COMPUTER LOGICAL ORGANIZATION - OVERVIEW

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

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

Solution to Digital Logic )What is the magnitude comparator? Design a logic circuit for 4 bit magnitude comparator and explain it,

Universidad Carlos III de Madrid Digital Electronics Exercises

Transcription:

University of Pennsylvania Department of Electrical and Systems Engineering Digital Design Laboratory Purpose Lab Calculator The purpose of this lab is: 1. To get familiar with the use of shift registers 2. To design a stack using a customized shift register 3. To design and implement a calculator using the stack and the previously designed ALU Background Information 1. Reverse Polish Notation (RPN) and its stack implementation In this lab you will design a fully functional RPN calculator. RPN is a particular format for representing mathematical expressions. Calculators with RPN were once very popular among the engineering community. In RPN, an expression is written by putting the operands first, then followed by the operator. For example, one plus two in RPN would be written as: 1 2 + An RPN expression with multiple operators is organized in the following way: the operators are read from left to right. The leftmost operator is executed first. It operates on the numbers immediately precede (i.e. to the left of) it. The result of the first operation becomes the operand of the second operation (i.e. the second leftmost operator), and so on. For example, the RPN expression 3 6 4 - * would represent: (6-4)*3 Notice that the number which appeared first (e.g. 3) is used last (e.g. in the multiplication). This first-in, last-out behavior is similar to that of a stack. For our purposes, think of a stack as a bidirectional shift register with only one serial input (e.g. LSI) and one stage output (e.g. Q0). Only the top of the stack is visible, that is, through Q0. The input to the stack is the LSI, where data can be pushed onto the stack. The output of the stack is the Q0, where data is popped out every time the register shifts up. In an electronic RPN calculator, when an operand is entered, it is pushed to the stack. In the previous example, the stack would contain 4, 6, 3, top-down, after the numbers are entered. When an operator is entered, two operands are popped from the stack, the Upenn-ESE201 1

operation is carried out, and the result is pushed back onto the stack. E.g. after - is entered, the stack contains 2 and 3, where 2 is the result of 6-4. After * is entered, the stack contains only 6 on the top, which is the final result of the calculation. With RPN, the execution order of operators is defined by the order they are entered, without using parenthesis. A complex expression such as ((1+2)*3+4)*(5+6) is much simplified in RPN, as: 1 2 + 3 * 4 + 5 6 + * Notice that some operations are commutative in nature, i.e. their left- and right-operands are interchangeable. As a result there can be multiple ways to write an RPN expression. An equivalent expression for the previous example is: 6 5 + 4 3 2 1 + * + * 2. Problem specification You are asked to design a -bit RPN calculator in this lab. The calculator has 7 push buttons, labeled Enter, Pop, +,,, /, and XOR. It also has slide switches for inputting -bit binary operands. It uses 4 7-segment displays, in the same way as the ALU lab, for displaying the result. Operands are entered by setting them on the slide switches and pushing the Enter button. Each time the button is pressed, the number represented by the slide switches is pushed onto the stack. Operators are entered by pushing the corresponding +,,, / or XOR button. Each time the button is pressed, the two operands of the operation are popped out, and the result of the operation is pushed back onto the stack. The stack has a depth of 4, which should be implemented with a 4-stage shift register. The stack can be cleared by continuously pressing the Pop button. Each time the button is pressed, the number 0 is shifted up from the bottom of the stack. Negative numbers are represented in two s complement, which is the same as in the ALU lab. The 7-segment displays should always show the sign and magnitude of the number on the top of the stack. A typical sequence of operation with the calculator is like this: Your action Calculator displays 1. Set slide switches to 2 0 (initial number in the stack) 2. Press Enter 2 3. Press Enter again 2 4. Set switches to 1 2 5. Press Enter 1 6. Press + 3 Upenn-ESE201 2

3. Circuit Implementation 7. Press * 6 (result of 2 2 1 + *). Press Pop 0 Table 1. Interaction with the calculator. A suggested block diagram of the circuit is given below. Your main task will be designing the control unit and the stack. You may reuse the one-pulse circuit, the ALU, the 7-segment decoder and switcher from previous labs. Enter Pop 100 MHz SYSCLK CLOCK DIVIDER Clock to, stack, LED switch + XOR Control Unit 2 4 LED DECODER sign 7 Display Switch circuit 7 Anodes Cathodes SW 1 - L T Stack S Q0 Q1 S3S2S1S0 ALU Q2 B Q3 Figure 1. The overall system We will implement the stack using a customized bi-directional shift register that contains three -bit data inputs: T (top), B (bottom), and D (data to load). It will have 4 modes of operations, selected by the 2-bit S input: 00 (no change), 01 (push), 10 (pop) and 11 (popand-load). At each clock cycle, the stack will operate in one of the 4 modes, depending on the user s input: User Input Register operation for this clock cycle Mode Control (S) No input No change 00 Enter Shift down, taking input from T 01 Pop Shift up, taking input from B 10 +,,, /, XOR Shift up all stages except the top one, replace (load) the top stage with input from D. Note: this is equivalent to: shift up twice, then shift down once, taking input from D. Table 2. Function table for the stack 11 Upenn-ESE201 3

The stack is very similar to a bi-directional shift register with parallel load (textbook Figure 7-11). The schematic of one stage in the stack is given below. Figure 2. One register stage in the stack The control unit is a combinational circuit that generates control signals (2-bit stack mode-select, and 4-bit ALU operation-select) based on which one of the buttons has been pushed. We can assume that only one of the 7 buttons could be pushed at a time. Therefore, the control unit is simply a custom 7-to-6 encoder. Prelab questions Before coming to the lab answer these questions, and have them signed off by a TA at the beginning of the lab. 1. Write the following expression in RPN: (1+2)*(3+(4*5)+6) 2. What is the result of the following RPN expression: 4 3 + 2 1 - - 3. Should Q0 connect to the A-input or the B-input of the ALU? 4. Duplicate Fig. 2 four times. Add interconnections to make a complete 1-bit version of the stack as described in Table 2. Label the data inputs (T, B, D), and the mode control (S1 and S0). In-lab procedures These steps here are given only as recommendation. You are free to come up with your own approach. 1. Start a new project with a schematic top-level. Leave this top-level schematic empty for now. Add a new schematic source to the project containing a 1-bit register stage (Fig. 2), and create a symbol for it. There is no need to use a flip-flop with asynchronous reset, since we can always empty the stack by pressing the Pop button a few times. Upenn-ESE201 4

2. Add a new schematic source containing 4 instances of the 1-bit register stages. Add connections and I/O pins to create a 1-bit stack. This would be the bit-slice of the - bit stack. Connect the bottom input (B) to ground. Create its symbol. 3. Do a behavioral simulation of the bit-slice. Use a stimulus that shows each of the 4 modes is working. 4. Add a new schematic source containing 1-bit stacks just created. Make -bit buses for the two data inputs (T and D) and the two outputs (Q0 and Q1). Create its symbol. 5. Add a new source for the control unit. You can use either HDL or schematic entry. Create its symbol. 6. Do a behavioral simulation of the control unit. 7. In the top-level schematic connect the following: The clock divider, 7 one-pulse circuits, the control unit, the stack and the ALU. Connect the Q0 output from the stack directly to an -bit output pin, which will go to LED s for debugging purposes (similar to the ALU lab). Assign package pin locations; using the main board buttons for Enter and Pop, and the extension board buttons for the operators. Implement and test the design on the board.. Complete the top-level schematic with the 7-segment decoder and the display switcher. Implement and download the design, and demo it to a TA. Hand-in (at the start of the next lab) You have to hand in a report that contains the following (See guidelines for reports): 1. Course title, Lab number, Lab title, Your names, and date 2. Brief description of the experiment including the goals and theory 3. Circuit schematics (screenshots, include your names) 4. Waveform simulations (screenshots) 5. Discussion of the results indicating proper function. 6. Conclusion Updated: November 9, 2007 Upenn-ESE201 5