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

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

Logic Design II (17.342) Spring Lecture Outline

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

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

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

CprE 281: Digital Logic

Laboratory 4. Figure 1: Serdes Transceiver

MODULE 3. Combinational & Sequential logic

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

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

MODULAR DIGITAL ELECTRONICS TRAINING SYSTEM

Computer Organization & Architecture Lecture #5

Combinational Logic Design

Registers and Counters

1. Synopsis: 2. Description of the Circuit:

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Registers and Counters

Contents Circuits... 1

Lab #6: Combinational Circuits Design

Laboratory Exercise 7

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.

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

Registers and Counters

Registers and Counters

ASYNCHRONOUS COUNTER CIRCUITS

Digital Electronics II 2016 Imperial College London Page 1 of 8

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

Inside Digital Design Accompany Lab Manual

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

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

Experiment # 12. Traffic Light Controller

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

Universal Asynchronous Receiver- Transmitter (UART)

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

MC9211 Computer Organization

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

Programmable Logic Design Techniques II

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

AIM: To study and verify the truth table of logic gates

ECE 263 Digital Systems, Fall 2015

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

MODU LE DAY. Class-A, B, AB and C amplifiers - basic concepts, power, efficiency Basic concepts of Feedback and Oscillation. Day 1

CS3350B Computer Architecture Winter 2015

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

CARLETON UNIVERSITY. Facts without theory is trivia. Theory without facts is bull 2607-LRB

Engineering College. Electrical Engineering Department. Digital Electronics Lab

OFC & VLSI SIMULATION LAB MANUAL

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

Experiment: FPGA Design with Verilog (Part 4)

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

Experiment 8 Introduction to Latches and Flip-Flops and registers

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

Chapter 6 Registers and Counters

Chapter 4: One-Shots, Counters, and Clocks

ELEC 204 Digital System Design LABORATORY MANUAL

Midterm Exam 15 points total. March 28, 2011

CS 110 Computer Architecture. Finite State Machines, Functional Units. Instructor: Sören Schwertfeger.

DIGITAL SYSTEM DESIGN UNIT I (2 MARKS)

Logic Design. Flip Flops, Registers and Counters

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

CS 151 Final. Instructions: Student ID. (Last Name) (First Name) Signature

EXPERIMENT 13 ITERATIVE CIRCUITS

Administrative issues. Sequential logic

Find the equivalent decimal value for the given value Other number system to decimal ( Sample)

Chapter 9 MSI Logic Circuits

1. True/False Questions (10 x 1p each = 10p) (a) I forgot to write down my name and student ID number.

Altera s Max+plus II Tutorial

LAB #6 State Machine, Decoder, Buffer/Driver and Seven Segment Display

Analogue Versus Digital [5 M]

Registers and Counters

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

Synchronous Sequential Logic

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

Unit-5 Sequential Circuits - 1

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

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

Register Transfer Level in Verilog: Part II

CHAPTER 4 RESULTS & DISCUSSION

CHAPTER 4: Logic Circuits

TSIU03, SYSTEM DESIGN. How to Describe a HW Circuit

North Shore Community College

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

Logic Design Viva Question Bank Compiled By Channveer Patil

CS6201 UNIT I PART-A. Develop or build the following Boolean function with NAND gate F(x,y,z)=(1,2,3,5,7).

EE 210. LOGIC DESIGN LAB.

Registers & Counters. Logic and Digital System Design - CS 303 Erkay Savaş Sabanci University

Digital Circuits I and II Nov. 17, 1999

ECE 270 Lab Verification / Evaluation Form. Experiment 9

CSC Computer Architecture and Organization

EECS150 - Digital Design Lecture 3 - Timing

Laboratory Exercise 7

CS61C : Machine Structures

Modeling Digital Systems with Verilog

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

Counter dan Register

CprE 281: Digital Logic

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

LAB 3 Verilog for Combinatorial Circuits

Lecture 12. Amirali Baniasadi

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

Transcription:

University of Texas at El Paso Electrical and Computer Engineering Department EE 2169 Laboratory for Digital Systems Design I Lab #10 Hexadecimal-to-Seven-Segment Decoder, 4-bit Adder-Subtractor and Shift Register. Fall 2017 Adder-Subtractor Subtraction of binary numbers is most easily accomplished by adding the complement of the number to be subtracted. To compute A B, add the complement of B to A. This gives the correct answer because A + ( B) = A B. Either 1 s or 2 s complement is used depending on the type of adder employed. The 2 s complement can be obtained by taking the 1 s complement and adding 1 to the least significant pair of bits. The 1 s complement can be implemented with inverters, and a 1 can be added to the sum through the input carry. 4-bit Adder-Subtractor (with overflow detection) The circuit for subtracting A - B consists of an adder with inverters placed between each data input B and the corresponding input of the full adder. The input carry C0 must be equal to 1 when subtraction is performed. The operation thus performed becomes A, plus the 1 s complement of B, plus 1.This is equal to A plus the 2 s complement of B. Registers Several D flip-flops may be grouped together with a common clock to form a register. Because each flip-flop can store one bit of information, this register can store four bits of information. This register has a load signal that is ANDed with the clock. When Load = 0, the register is not clocked, and it holds its present value. When it is time to load data into the register, Load is set to 1 for one clock period. When Load = 1, the clock signal (Clk) is transmitted to the flip-flop clock inputs and the data applied to the D inputs will be loaded into the flip-flops on the falling edge of the clock. 1

4-bit D Flip-Flop Registers with Data, Load, Clear, and Clock Inputs Shift Register A shift register is a register in which binary data can be stored, and this data can be shifted to the left or right when a shift signal is applied. Bits shifted out one end of the register may be lost, or if the shift register is of cyclic type, bits shifted out one end are shifted back in the other end. 4-bit Right-Shift Register with Serial Input and Output Constructed from D Flip-Flops When Shift = 1, the clock is enabled and shifting occurs on the rising clock edge. When Shift = 0, no shifting occurs and the data in the register is unchanged. The serial input (SI) is loaded into the first flip-flop (Q3) by the rising edge of the clock. At the same time, the output of the first flip-flop is loaded into the second flip-flop, the output of the second flip-flop is loaded into the third flip-flop, and the output of the third flip-flop is loaded into the last flip-flop. Because of the propagation delay of the flip-flops, the output value loaded into each flip-flop 2

is the value before the rising clock edge. The timing when the shift register initially contains 0101 and the serial input sequence is 1, 1, 0, 1. The sequence of shift register states is 0101, 1010, 1101, 0110, 1011. Register Data Transfer Communications The datapath of a digital system is said to operate in serial mode when information is transferred and manipulated one bit at a time. Information is transferred one bit at a time by shifting the bits out of the source register and into the destination register. This type of transfer is in contrast to parallel transfer, whereby all the bits of the register are transferred at the same time. Parallel Data Transfer 3

Serial Data Transfer For this laboratory assignment you will continue working with the code developed on the laboratory 6 assignment. The modifications are as it follows: 1. The 3-bit inputs will become 4-bit inputs 2. The BCD-to-seven-segment decoder will become a Hexadecimal-to-seven-segment decoder. 3. You will add the subtraction operation to the code 4. You will design and show the operation of a 4-bit shift register Pre-Lab Part 1 (HEX to SSD) A Hexadecimal-to-seven-segment decoder is a combinational circuit that converts a hexadecimal digit to an appropriate code for the selection of segments in an indicator used to display the decimal digit in a familiar form. The seven outputs of the decoder (a, b, c, d, e, f, g) select the corresponding LEDs in the display, as shown in figure below. The numeric display chosen to represent the hexadecimal digit is shown as well. Write the truth table relating the four binary inputs to the 7 LED outputs of the BCD-to-seven-segment decoder. DO NOT use K-Maps. There s no need for logic expressions. Draft the Verilog code using behavioral modeling. Use a Case Statement relating the binary number input to it seven-segment representation. Part 2 (SHIFT LEFT REGISTER) Draft the Verilog code for a 4-bit shift left register with Positive-Edge Clock, Serial In, and Serial Out. Don t forget to properly define the input and sum registers. Hint: Register Verilog Code Examples: http://www.csit-sun.pub.ro/courses/masterat/xilinx%20synthesis%20technology/toolbox.xilinx.com/docsan/xilinx4/data/docs/xst/hdlcode8.html Online Compiler: http://www.tutorialspoint.com/compile_verilog_online.php 4

Lab Part A Start a new project on Xilinx and named it EE2169Lab7A_Lastname. Use your code from the previous lab exercise as a template. Implement the 4-bit adder-subtractor and seven segment hexadecimal display decoder using Verilog HDL on the NI Digital Electronics FPGA Board (DEFB). Assign switches SW7 SW4 as your binary inputs for one number (LEFT) and SW3 SW0 for the other (RIGHT). The NI FGPA Board has two independent, seven segment displays; assign each input to display the number to be added or subtract. Use the BTN0 for the addition operation and BTN1 for the subtraction operation. Modify the constraints file as necessary. The sum of the two numbers, including the carry over bit, should be displayed on the LED displays. Be aware that if A < B in A-B you will get a negative binary value. Hint: Use If-Else statements for the addersubtractor section. Part B Start a new project on Xilinx and named it EE2169Lab7B_Lastname. Implement an 8-bit Shift-Left Register with Positive-Edge Clock, Synchronous Parallel Load, Parallel In, and Serial Out. Use the code below to setup the system inputs and outputs. Display the loaded data on the LED section of the FPGA Board. Use switches SW3 SW0 for your data. Use BTN3 for your load input and SW7 for your shift left operation. Hint: Use your code from Part 2 of the Prelab as a reference and the constraints file will be provided on the Wiki page. Shift Register Figure 1: Serial Transmitter with Parallel Load //HEADER FILE module EE2169Lab7B_Lastname ( input [3:0] sw, // input switches SW0-SW3 input load, // load BTN3 input shift, // shift input SW7 input clk, // clock input from GPIO29 or GPIO31 5

//output out, // Serial data output to GPIO0 output [7:0] ld // LED outputs ); // Internal Registers reg [7:0] shiftreg; reg [3:0] Q; // Serial register outputs // Parallel load register outputs Board Connections: Using the provided jumper cables connect the clock according to the figure below. DO NOT TURN THE DEFB ON UNTIL YOU HAVE SHOWN THE TEACHING ASSISTANT YOUR CONNECTIONS! or clk (GPIO29) The clock (clk) signal: The clock pulse (clock) will be generated by a program called the NI ELVISmx Function Generator on the PC, then routed to the DEFB, we first have to set up the generator to produce the approximately 1Hz TTL square wave needed by the digital circuit. 1. Open the function generator by typing NI ELVISmx Function Generator in the Start Menu. 2. Once, open Select the Square wave button, set the Amplitude to 5Vpp, the DC Offset to 2.5V, and the Frequency to 1Hz. Your set up should look like the figures below. Once ready, hit the Run button. 3. The function generator will look like the image to the right while running. To physically verify you have a 1 sec clock, connect pin 6 on BB4 (FGEN) to any LED pin in BB3 (seven segment LEDs). You should see the LED flash about 1 time per second. 6

Extra Challenge (Transmitting the adder-subtractor data) For an Extra Point combine Part A and Part B. Load to the register the result from your adder-subtractor and simulate its transmission on the LEDs using the shift left operation at every clock cycle. It will require the addition of an external LED (under the TAs supervision) to simulate the transmitting bit through GPIO0. Use the switches to input the numbers data and the buttons for the addition, subtraction, load and shift left operations. Hint: Try using only behavioral coding to avoid issues with the FPGA resources. 7