DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 5

Similar documents
ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-378:

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700:

Types of Control. Programmed Non-programmed. Program Counter Hardwired

CHAPTER FIVE - Flip-Flops and Related Devices

UNIT II: Clocked Synchronous Sequential Circuits. CpE 411 Advanced Logic Circuits Design 1

Ring Counter. 4-bit Ring Counter using D FlipFlop. VHDL Code for 4-bit Ring Counter and Johnson Counter 1. Contents

Lecture 20: Several Commercial Counters & Shift Register

Module -18 Flip flops

EASTERN MEDITERRANEAN UNIVERSITY COMPUTER ENGINEERING DEPARTMENT CMPE224 DIGITAL LOGIC SYSTEMS VHDL EXPERIMENT VII

Module-20 Shift Registers

UNIVERSITI MALAYSIA PERLIS

CSE 260 Digital Computers: Organization and Logical Design. Midterm Solutions

Page 1. Last time we looked at: latches. flip-flop

Computer Architecture: Part II. First Semester 2013 Department of Computer Science Faculty of Science Chiang Mai University

CS/EE Homework 9 Solutions

6.111 Lecture # 19. Controlling Position. Some General Features of Servos: Servomechanisms are of this form:

Adder Comparator 7 segment display Decoder for 7 segment display D flip flop Analysis of sequential circuits. Sequence detector

Written exam IE1204/5 Digital Design Friday 13/

Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 7/11/2011


DIGITAL DESIGN WITH SM CHARTS

logic system Outputs The addition of feedback means that the state of the circuit may change with time; it is sequential. logic system Outputs

Digital Logic Circuits

Chapter 4: FLIP FLOPS. (Sequential Circuits) By: Siti Sabariah Hj. Salihin ELECTRICAL ENGINEERING DEPARTMENT EE 202 : DIGITAL ELECTRONICS 1

Number system: the system used to count discrete units is called number. Decimal system: the number system that contains 10 distinguished

Chapter 5 Sequential Logic Circuits Part II Hiroaki Kobayashi 6/30/2008

EECS-140/141 Introduction to Digital Logic Design Lecture 7:Sequential Logic Basics

COMPUTER ORGANIZATION & ARCHITECTURE DIGITAL LOGIC CSCD211- DEPARTMENT OF COMPUTER SCIENCE, UNIVERSITY OF GHANA

LIST OF EXPERIMENTS. KCTCET/ /Odd/3rd/ETE/CSE/LM

DIGITAL ELECTRONICS QUESTION BANK

PE713 FPGA Based System Design

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING SEMESTER TWO EXAMINATION 2017/2018

CMOS Digital Integrated Circuits Lec 11 Sequential CMOS Logic Circuits

LOGIC DIAGRAM: HALF ADDER TRUTH TABLE: A B CARRY SUM. 2012/ODD/III/ECE/DE/LM Page No. 1

Code No: R Set No. 1

Four-Way Traffic Light Controller Designing with VHDL

Digital Circuits II Lecture 6. Lab Demonstration 3 Using Altera Quartus II to Determine Simplified Equations & Entering Truth Table into VHDL

Hardware Design with VHDL Design Example: UART ECE 443

CS302 - Digital Logic Design Glossary By

Lecture 02: Digital Logic Review

EC O4 403 DIGITAL ELECTRONICS

Topics Introduction to Microprocessors

Department of Electronics and Communication Engineering

Mohit Arora. The Art of Hardware Architecture. Design Methods and Techniques. for Digital Circuits. Springer

High Speed Binary Counters Based on Wallace Tree Multiplier in VHDL

Electronics. Digital Electronics

Brought to you by. Priti Srinivas Sajja. PS01CMCA02 Course Content. Tutorial Practice Material. Acknowldgement References. Website pritisajja.

SRV ENGINEERING COLLEGE SEMBODAI RUKMANI VARATHARAJAN ENGINEERING COLLEGE SEMBODAI

Synthesis Minimizations and Mesh Algorithm Selection: An Extension of the Ultrasonic 3D Camera

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Fan in: The number of inputs of a logic gate can handle.

1. The decimal number 62 is represented in hexadecimal (base 16) and binary (base 2) respectively as

Controller Implementation--Part I. Cascading Edge-triggered Flip-Flops

Arria V Timing Optimization Guidelines

E2 Framing / Deframing according ITU-T G.703 / G.742 : VHDL-Modules

Clocking Schedule and Writing VHDL Programs for Synthesis

Theory of Logic Circuits. Laboratory manual. Exercise 4

Preface... iii. Chapter 1: Diodes and Circuits... 1

A-PDF Split DEMO : Purchase from to remove the watermark 114 FSM

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY (AUTONOMOUS)

Microprocessor & Interfacing Lecture Programmable Interval Timer

EE 42/100 Lecture 24: Latches and Flip Flops. Rev A 4/14/2010 (8:30 PM) Prof. Ali M. Niknejad

CHAPTER III THE FPGA IMPLEMENTATION OF PULSE WIDTH MODULATION

CMOS Digital Integrated Circuits Analysis and Design

Java Bread Board Introductory Digital Electronics Exercise 2, Page 1

Computer Systems and Networks. ECPE 170 Jeff Shafer University of the Pacific. Digital Logic

HIGH LOW Astable multivibrators HIGH LOW 1:1

PWM System. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

DELD MODEL ANSWER DEC 2018

Number of Lessons:155 #14B (P) Electronics Technology with Digital and Microprocessor Laboratory Completion Time: 42 months

PROJECT LEAD The way. Quakertown community high school

NODIA AND COMPANY. Model Test Paper - I GATE Digital Electronics. Copyright By Publishers

Topics. FPGA Design EECE 277. Combinational Logic Blocks. From Last Time. Multiplication. Dr. William H. Robinson February 25, 2005

! Sequential Logic. ! Timing Hazards. ! Dynamic Logic. ! Add state elements (registers, latches) ! Compute. " From state elements

Spec. Instructor: Center

[VLSI & EMBEDDED SYSTEMS LAB]

FPGA & Pulse Width Modulation. Digital Logic. Programing the FPGA 7/23/2015. Time Allotment During the First 14 Weeks of Our Advanced Lab Course

CHAPTER 5 DESIGNS AND ANALYSIS OF SINGLE ELECTRON TECHNOLOGY BASED MEMORY UNITS

Daisy II. By: Steve Rothen EEL5666 Spring 2002

Stage report Spark Generator Board & Path Finder Robot

Additional Programs for the Electronics Module Part No

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

Sequential Logic Circuits

FILTER_0/Prog. Delay Combination Function Macrocells Pin 3 GPIO RC Oscillator. 2-bit LUT2_0 or DFF0. 3bit LUT3_0 or DFF2

Sr. No. Instrument Specifications. TTL (Transistor-Transistor Logic) based on bipolar junction transistors

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) SUMMER-16 EXAMINATION Model Answer

Practical Workbook Logic Design & Switching Theory

TCSS 372 Laboratory Project 2 RS 232 Serial I/O Interface

For reference only Refer to the latest documents for details

Hardware Flags. and the RTI system. Microcomputer Architecture and Interfacing Colorado School of Mines Professor William Hoff

DIGITAL CIRCUITS AND SYSTEMS ASSIGNMENTS 1 SOLUTIONS

Design of Microprogrammed Control Units (MCU) using VHDL Description. Arvutitehnika erikusus

A Logic Circuit Simulation for Choosing a Group or a Question using Register and Encoder

B.E. SEMESTER III (ELECTRICAL) SUBJECT CODE: X30902 Subject Name: Analog & Digital Electronics

Objective Questions. (a) Light (b) Temperature (c) Sound (d) all of these

Introduction to Digital Signal Processing

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Associate In Applied Science In Electronics Engineering Technology Expiration Date:

Transcription:

IGITAL LOGIC WITH VHL (Fall 2013) Unit 5 SEUENTIAL CIRCUITS Asynchronous sequential circuits: Latches Synchronous circuits: flip flops, counters, registers.

COMBINATORIAL CIRCUITS In combinatorial circuits, the output only depends upon the present input values. There exist another class of logic circuits whose outputs not only depend on the present input values but also on the past values of inputs, outputs, and/or internal signal. These circuits include storage elements to store those previous values. The content of those storage elements represents the circuit state. When the circuit inputs change, it can be that the circuit stays in certain state or changes to a different one. Over time, the circuit goes through a sequence of states as a result of a change in the inputs. The circuits with this behavior are called sequential circuits. Inputs Inputs COMBINATORIAL CIRCUIT Combinatorial Logic SEUENTIAL CIRCUIT Combinatorial Logic Storage elements Outputs Outputs

SEUENTIAL CIRCUITS Combinatorial circuits can be described with concurrent statement, or behavioral statements. Sequential circuits are best described with sequential statements. Sequential circuits can either be synchronous or asynchronous. In VHL, they are described with asynchronous/synchronous processes. Basic asynchronous sequential circuit: Latch Basic synchronous sequential circuits: flip flops, counters, and registers. We will now go over the VHL description of sequential circuits.

ASYNCHRONOUS PROCESS (LATCHES) SR Latch An SR Latch based on NOR gates:: R S R t+1 t+1 0 0 t t 0 1 0 1 1 0 1 0 S 1 1 0 0 restricted According to its truth table, the output can be assigned to either 0 or 1. This circuit state ( 0 or 1 ) is stored in the circuit when S=R= 0.

SR Latch: S entity latch_sr is port ( s,r: in std_logic; q, qn: out std_logic); end latch_sr; S R R architecture bhv of latch_sr is signal qt,qnt: std_logic; process (s,r) if s='1' and r='0' then qt<='1'; qnt<='0'; elsif s='0' and r='1' then qt<='0'; qnt <='1'; elsif s='1' and r='1' then qt<='0'; qnt <= '0'; -- we don't specify what happens -- if s=r='0' --> q, qn kept their -- previous values q <= qt; qn <= qnt;

SR Latch with enable E R R' entity latch_sr_e is port ( s,r, E: in std_logic; q, qn: out std_logic); end latch_sr_e; S E 0 1 1 1 1 S' S R t+1 0 0 t 0 1 0 1 0 1 1 0 Note: If E = 0, the previous output is kept. 1 t+1 x x t t t 1 0 0 architecture bhv of latch_sr_e is signal qt,qnt: std_logic; process (s,r) if E = '1' then if s='1' and r='0' then qt<='1'; qnt<='0'; elsif s='0' and r='1' then qt<='0'; qnt <='1'; elsif s='1' and r='1' then qt<='0'; qnt <= '0'; q <= qt; qn <= qnt;

Latch with enable R' E S' entity latch_ is port (, E: in std_logic; q, qn: out std_logic); end latch_; E 0 1 1 t+1 x t 0 0 1 1 architecture bhv of latch_ is signal qt: std_logic; process (,E) if E = '1' then qt <= d; q <= qt; qn <= not(qt);

SYNCHRONOUS PROCESSES Flip Flops Unlike a Latch, a flip flop only changes its outputs on the edge (rising or falling) of a signal called. A signal is an square wave with a fixed frequency. To detect a rising or falling edge, flip flops include an edge detector circuit. Input: a signal, Output: short duration pulses during the rising (or falling) edges. These pulses are then connected to the enable input in a Latch. For example, an SR flip flop is made out of: a SR Latch with an edge detector circuit. The edge detector generates enable signals during the during the rising (or falling) edges. R R' Edge etector E or S S'

SYNCHRONOUS PROCESSES Flip Flops: The edge detector circuit generates E= 1 during the edge (rising or falling). We will work with circuits activated by either rising or falling edge. We will not work with circuits activated by both edges. An example of a circuit that detects a rising edge is shown below. The redundant NOT gates cause a delay that allows a pulse to be generated during a rising edge (or positive edge). sig E sig E

SYNCHRONOUS PROCESSES SR Flip Flop S R Positive edge-triggered Edge etector R S E S R Negative edge-triggered Positive-edge triggered Negative-edge triggered entity ff_sr is port ( s,r, : in std_logic; q, qn: out std_logic); end ff_sr; architecture bhv of ff_sr is signal qt,qnt: std_logic; process (s,r,) if ('event and ='1') then --if ('event and ='0') then if s='1' and r='0' then qt<='1'; qnt<='0'; elsif s='0' and r='1' then qt<='0'; qnt <='1'; elsif s='1' and r='1' then qt<='0'; qnt <= '0'; q <= qt; qn <= qnt;

SYNCHRONOUS PROCESSES Flip Flop t+1 0 0 1 1 entity ff_d is port ( d, : in std_logic; q, qn: out std_logic); end ff_d; architecture bhv of ff_d is signal qt,qnt: std_logic; process (d,) if ('event and ='1') then qt<=d; q <= qt; qn <= not(qt); Edge etector E

SYNCHRONOUS PROCESSES T Flip Flop T t+1 0 t 1 t entity ff_t is port ( t, : in std_logic; q, qn: out std_logic); end ff_t; T T architecture bhv of ff_t is signal qt,qnt: std_logic; process (t,) if ('event and ='1') then if t = '1' then qt <= not(qt); q <= qt; qn <= not(qt);

SYNCHRONOUS PROCESSES JK Flip Flop J entity ff_jk is port ( s,r, : in std_logic; q, qn: out std_logic); end ff_jk; K J K t+1 0 0 t 0 1 0 1 0 1 1 1 t architecture bhv of ff_jk is signal qt,qnt: std_logic; process (j,k,) if ('event and ='1') then if j='1' and k='1' then qt<= not(qt); elsif j='1' and k='0' then qt<='0'; elsif j='0' and k='1' then qt<='1'; q <= qt; qn <= qnt;

SYNCHRONOUS PROCESSES Flip Flop with asynchronous inputs: clrn, prn clrn = 0 q = 0 prn = 0 q = 1 This inputs force the outputs to a value immediately. This is a useful feature if we want to initialize the circuit with no regards to the rising (or falling) edge prn clrn entity ff_dp is port ( d,clrn,prn,: in std_logic; q, qn: out std_logic); end ff_dp; architecture bhv of ff_dp is signal qt,qnt: std_logic; process (d,clrn,prn,) if clrn = '0' then qt <= '0'; elsif prn = '0' then qt <= '1'; elsif ('event and ='1') then qt <= d; q <= qt; qn <= not(qt);

SYNCHRONOUS PROCESSES Synchronous Counters Counters are very useful in digital systems. They can count the number of occurrences of a certain event, generate time intervals for task control, track elapsed time between two events, etc. Synchronous counters change their output on the edge (rising or falling). Counters are made of flip flops and combinatorial logic. Every flip flop in a synchronous counter shares the same signal. The figure shows a 4-bit synchronous counter (0000 to 1111). A resetn signal is also included to initialize the count. resetn '1' T T T T n n n n 0 1 2 3

4-bit Synchronous counter with asynchronous active-low reset The resetn signal sets the output to 0000 disregarding the edge entity my_count4b is port (, resetn: in std_logic; : out integer range 0 to 15); end my_count4b; resetn counter 4 architecture bhv of my_count4b is signal t: integer range 0 to 15; process (resetn,) if resetn = '0' then t <= 0; elsif ('event and ='1') then t <= t + 1; <= t;

4-bit Synchronous counter with asynchronous active-low reset and enable Note that the enable signal E is synchronous, thus it is only considered on the rising edge resetn E counter 4 entity my_count4b_e is port (, resetn, E: in std_logic; : out integer range 0 to 15); end my_count4b_e; architecture bhv of my_count4b_e is signal t: integer range 0 to 15; process (resetn,, E) if resetn = '0' then t <= 0; elsif ('event and ='1') then if E = '1' then t <= t + 1; <= t;

4-bit Synchronous BC counter with asynchronous active-low reset It counts from 0000 to 1001 entity my_bcd_count is port (, resetn: in std_logic; : out integer range 0 to 15); end my_bcd_count; resetn BC counter 4 architecture bhv of my_bcd_count is signal t: integer range 0 to 15; process (resetn,) if resetn = '0' then t <= 0; elsif ('event and ='1') then if t = 9 then t <= 0; else t <= t + 1; <= t;

4-bit Synchronous up/down counter with asynchronous active-low reset ud = 0 -> down ud = 1 -> up When t = 0000, then resetn ud t <= t-1 will result in t = 1111 u/d counter 4 entity my_ud_count is port (, resetn,ud: in std_logic; : out integer range 0 to 15); end my_ud_count; architecture bhv of my_ud_count is signal t: integer range 0 to 15; process (resetn,,ud) if resetn = '0' then t <= 0; elsif ('event and ='1') then if ud = '0' then t <= t - 1; else t <= t + 1; <= t;

4-bit Synchronous counter with parallel load Here, we use as vector. use ieee.std_logic_unsigned.all; entity my_lcount is port (, resetn,load: in std_logic; data: in std_logic_vector(3 downto 0); : out std_logic_vector(3 downto 0)); end my_lcount; resetn load data 4 counter 4 architecture bhv of my_lcount is signal t: std_logic_vector(3 downto 0); process (resetn,,load) if resetn = '0' then t <= "0000"; elsif ('event and ='1') then if load = '1' then t <= data; else t <= t + "0001"; <= t;

SYNCHRONOUS PROCESSES Registers These are sequential circuits that store the values of signals. There exist many register types: registers to handle interruptions in a PC, microprocessor registers, etc. A register that can hold n bits is a collection of n -type flip flops Register types: Simple Register (with/without enable) Parallel access shift register (parallel output/serial output0. Shift register (with/without enable) Serial input, parallel output Serial input, serial outputl

PARALLEL LOA, PARALLEL OUTPUT 8-bit register with enable and asynchronous reset entity reg8 is port (, resetn, E: in std_logic; : in std_logic_vector (7 downto 0); : out std_logic_vector (7 downto 0)); end reg8; 8 E resetn E n 8 architecture bhv of reg8 is process (resetn,e,) if resetn = '0' then <= (others => '0'); elsif ('event and = '1') then if E = '1' then <= ;

REGISTER: Serial Input, Serial/Parallel Output Shifting to the right. 3 2 1 0 w d_out n n n n resetn

REGISTER 4-bit register: Parallel/serial load Parallel/serial output Shifting to the right The signal L decides whether the load is parallel or serial out : serial output : parallel output L w 4 resetn L w out n 4 out entity reg_t is port (, resetn, L,w: in std_logic; out: out std_logic; : in std_logic_vector (3 downto 0); : out std_logic_vector (3 downto 0)); end reg_t; architecture bhv of reg_t is process (resetn,l,) if resetn = '0' then <= "0000"; elsif ('event and = '1') then if L = '1' then <= ; else (0) <= (1); (1) <= (2); (2) <= (3); (3) <= w; out <= (0);

REGISTER Alternative VHL code: 4-bit register: Parallel/serial load Parallel/serial output Shifting to the right The signal L decides whether the load is parallel or serial out : serial output : parallel output L w 4 resetn L w out n 4 out entity reg_t is port (, resetn, L,w: in std_logic; out: out std_logic; : in std_logic_vector (3 downto 0); : out std_logic_vector (3 downto 0)); end reg_t; architecture bhv of reg_t is process (resetn,l,) if resetn = '0' then <= "0000"; elsif ('event and = '1') then if L = '1' then <= ; else gg: for i in 0 to 2 loop (i) <= (i+1); end loop; (3) <= w; out <= (0);

REGISTER 4-bit register: Parallel/serial load Parallel/serial output Shifting to the left The signal L decides whether the load is parallel or serial out : serial output : parallel output L w 4 resetn L w out n 4 out entity reg_i is port (, resetn, L,w: in std_logic; out: out std_logic; : in std_logic_vector (3 downto 0); : out std_logic_vector (3 downto 0)); end reg_i; architecture bhv of reg_i is process (resetn,l,) if resetn = '0' then <= "0000"; elsif ('event and = '1') then if L = '1' then <= ; else (3) <= (2); (2) <= (1); (1) <= (0); (0) <= w; out <= (3);

REGISTER Alternative VHL code: 4-bit register: Parallel/serial load Parallel/serial output Shifting to the left The signal L decides whether the load is parallel or serial out : serial output : parallel output L w 4 resetn L w out n 4 out entity reg_i is port (, resetn, L,w: in std_logic; out: out std_logic; : in std_logic_vector (3 downto 0); : out std_logic_vector (3 downto 0)); end reg_i; architecture bhv of reg_i is process (resetn,l,) if resetn = '0' then <= "0000"; elsif ('event and = '1') then if L = '1' then <= ; else gg: for i in 1 to 3 loop (i) <= (i-1); end loop; (0) <= w; out <= (3);