CS/EE Homework 6

Similar documents
Feedback Sequential Circuits

Flip-flop and Registers

hochschule fu r angewandte wissenschaften hamburg Prof. Dr. B. Schwarz FB Elektrotechnik/Informatik

ECE 263 Digital Systems, Fall 2015

Synchronous Sequential Logic

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

Sequential Design Basics

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

D Latch (Transparent Latch)

Digital Fundamentals: A Systems Approach

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

ECE 341. Lecture # 2

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

CHAPTER 1 LATCHES & FLIP-FLOPS

ELE2120 Digital Circuits and Systems. Tutorial Note 7

Lecture 8: Sequential Logic

LAB #4 SEQUENTIAL LOGIC CIRCUIT

(CSC-3501) Lecture 7 (07 Feb 2008) Seung-Jong Park (Jay) CSC S.J. Park. Announcement

Logic Design. Flip Flops, Registers and Counters

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

Eng. Mohammed Samara. Fall The Islamic University of Gaza. Faculty of Engineering. Computer Engineering Department

ACS College of Engineering. Department of Biomedical Engineering. HDL pre lab questions ( ) Cycle-1

MODULE 3. Combinational & Sequential logic

Multiplexor (aka MUX) An example, yet VERY useful circuit!

Module 4:FLIP-FLOP. Quote of the day. Never think you are nothing, never think you are everything, but think you are something and achieve anything.

IS1500 (not part of IS1200) Logic Design Lab (LD-Lab)

Sequential logic circuits

6.3 Sequential Circuits (plus a few Combinational)

Ryerson University Department of Electrical and Computer Engineering EES508 Digital Systems

COMP sequential logic 1 Jan. 25, 2016

Chapter 1: Switching Algebra Chapter 2: Logical Levels, Timing & Delays. Introduction to latches Chapter 9: Binary Arithmetic

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

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

VeriLab. An introductory lab for using Verilog in digital design (first draft) VeriLab

CHAPTER 4 RESULTS & DISCUSSION

Sequential Logic Circuits

Sequential circuits. Same input can produce different output. Logic circuit. William Sandqvist

Chapter 8 Registers & Counters

ECE 3401 Lecture 12. Sequential Circuits (II)

RS flip-flop using NOR gate

Midterm Exam 15 points total. March 28, 2011

CS 261 Fall Mike Lam, Professor. Sequential Circuits

Flip-Flops and Registers

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

Logic Design II (17.342) Spring Lecture Outline

Synchronous Sequential Logic

Outline. CPE/EE 422/522 Advanced Logic Design L04. Review: 8421 BCD to Excess3 BCD Code Converter. Review: Mealy Sequential Networks

SEQUENTIAL CIRCUITS THE RELAY CIRCUIT

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

Microprocessor Design

Advanced Digital Logic Design EECS 303

Chapter 3. Boolean Algebra and Digital Logic

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

Introduction to Sequential Circuits

Logic Design II (17.342) Spring Lecture Outline

STATIC RANDOM-ACCESS MEMORY

INTRODUCTION TO SEQUENTIAL CIRCUITS

CprE 281: Digital Logic

6. Sequential Logic Flip-Flops

CHAPTER 4: Logic Circuits

LATCHES & FLIP-FLOP. Chapter 7

Experiment # 9. Clock generator circuits & Counters. Digital Design LAB

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

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

CHAPTER 4: Logic Circuits

EECS 270 Midterm 1 Exam Closed book portion Winter 2017

EEC 118 Lecture #9: Sequential Logic. Rajeevan Amirtharajah University of California, Davis Jeff Parkhurst Intel Corporation

CS/ECE 250: Computer Architecture. Basics of Logic Design: ALU, Storage, Tristate. Benjamin Lee

Combinational vs Sequential

CprE 281: Digital Logic

Physics 323. Experiment # 10 - Digital Circuits

Modeling Latches and Flip-flops

Chapter 4. Logic Design

Unit 11. Latches and Flip-Flops

VLSI DESIGN LAB (EE-330-F) VI SEMESTER. Electrical and Electronics Engineering

Unit 9 Latches and Flip-Flops. Dept. of Electrical and Computer Eng., NCTU 1

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

R13 SET - 1 '' ''' '' ' '''' Code No: RT21053

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

Chapter. Synchronous Sequential Circuits

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING

Latches, Flip-Flops, and Registers. Dr. Ouiem Bchir

RS flip-flop using NOR gate

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

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Figure 1: segment of an unprogrammed and programmed PAL.

CprE 281: Digital Logic

Asynchronous (Ripple) Counters

Other Flip-Flops. Lecture 27 1

Slide 1. Flip-Flops. Cross-NOR SR flip-flop S R Q Q. hold reset set not used. Cross-NAND SR flip-flop S R Q Q. not used reset set hold 1 Q.

MODEL QUESTIONS WITH ANSWERS THIRD SEMESTER B.TECH DEGREE EXAMINATION DECEMBER CS 203: Switching Theory and Logic Design. Time: 3 Hrs Marks: 100

Sequential Circuits: Latches & Flip-Flops

More on Flip-Flops Digital Design and Computer Architecture: ARM Edition 2015 Chapter 3 <98> 98

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.

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

Switching Circuits & Logic Design

COMP12111: Fundamentals of Computer Engineering

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

CHAPTER 11 LATCHES AND FLIP-FLOPS

A Review of logic design

Transcription:

CS/EE 260 - Homework 6 Due 3/16/2000 1. Use VHDL to design the 4 bit arithmetic unit specified in problem 4 of homework 5 (you may borrow from the posted solution, if you wish). Use a dataflow description to define basic building blocks for each component (e.g. half-adders and full-adders), then use structural VHDL to assemble these into larger components, and to assemble the components into the complete circuit. Simulate the circuit on the same inputs as in homework 5. entity flip is en: in STD_LOGIC; a: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0) end flip; architecture flip_arch of flip is x <= (not a) when en = '1' else a; end flip_arch; --------------------------------------------------- entity inc is en: in STD_LOGIC; a: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0) end inc; architecture inc_arch of inc is signal c: STD_LOGIC_VECTOR (2 downto 0 c(0) <= a(0) and en; c(1) <= a(1) and c(0 c(2) <= a(2) and c(1 x(0) <= a(0) xor en; x(1) <= a(1) xor c(0 x(2) <= a(2) xor c(1-1 -

x(3) <= a(3) xor c(2 end inc_arch; --------------------------------------------------- entity pass is en: in STD_LOGIC; a: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0) end pass; architecture pass_arch of pass is x <= a when en = '1' else "0000"; end pass_arch; --------------------------------------------------- entity adder is cin: in STD_LOGIC; a, b: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0 cout: out STD_LOGIC end adder; architecture adder_arch of adder is signal c: STD_LOGIC_VECTOR (3 downto 0 c(0)<=(a(0) and b(0)) or (a(0) and cin) or (b(0) and cin c(1)<=(a(1) and b(1)) or (a(1) and c(0)) or (b(1) and c(0) c(2)<=(a(2) and b(2)) or (a(2) and c(1)) or (b(2) and c(1) c(3)<=(a(3) and b(3)) or (a(3) and c(2)) or (b(3) and c(2) cout <= c(3 x(0) <= a(0) xor (b(0) xor cin x(1) <= a(1) xor (b(1) xor c(0) x(2) <= a(2) xor (b(2) xor c(1) x(3) <= a(3) xor (b(3) xor c(2) end adder_arch; --------------------------------------------------- entity control is c: in STD_LOGIC_VECTOR (2 downto 0-2 -

sa, sb, sx, adder_cout: in STD_LOGIC; na, nb, pa, pb, v: out STD_LOGIC end control; architecture control_arch of control is na <= '1' when (c = "010") or (c = "111") else '0'; nb <= '1' when (c = "011") or (c = "110") else '0'; pa <= '1' when (c /= "001") and (c /= "011") else '0'; pb <= '1' when (c /= "000") and (c /= "010") else '0'; v <= '1' when ((c = "010") and sa = '1' and sx = '1') or ((c = "011") and sb = '1' and sx = '1') or ((c = "100") and adder_cout = '1') or ((c = "101") and (sa = sb) and (sa /= sx)) or ((c = "110") and (sa /= sb) and (sa /= sx)) or ((c = "111") and (sa /= sb) and (sb /= sx)) else '0'; end control_arch; --------------------------------------------------- entity arithuvs is a, b: in STD_LOGIC_VECTOR (3 downto 0 c: in STD_LOGIC_VECTOR (2 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0 v: out STD_LOGIC end arithuvs; architecture arithuvs_arch of arithuvs is component flip en: in STD_LOGIC; a: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0) end component; component inc en: in STD_LOGIC; a: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0) end component; component pass en: in STD_LOGIC; a: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0) end component; - 3 -

component adder cin: in STD_LOGIC; a, b: in STD_LOGIC_VECTOR (3 downto 0 x: out STD_LOGIC_VECTOR (3 downto 0 cout: out STD_LOGIC end component; component control c: in STD_LOGIC_VECTOR (2 downto 0 sa, sb, sx, adder_cout: in STD_LOGIC; na, nb, pa, pb, v: out STD_LOGIC end component; signal a1, a2, a3, b1, b2, b3, xb: STD_LOGIC_VECTOR (3 downto 0 signal na, nb, pa, pb, adder_cout: STD_LOGIC; signal zero: STD_LOGIC; zero <= '0'; flip_a: flip port map(na, a, a1 flip_b: flip port map(nb, b, b1 inc_a: inc port map(na, a1, a2 inc_b: inc port map(nb, b1, b2 pass_a: pass port map(pa, a2, a3 pass_b: pass port map(pb, b2, b3 addem: adder port map(zero,a3,b3,xb,adder_cout ctl: control port map(c,a(3),b(3),xb(3), adder_cout, na, nb, pa, pb, v x <= xb; end arithuvs_arch; - 4 -

- 5 -

2. Write a VHDL specification for a 3 bit multiplier with 6 output bits. Your specification should include a 3 bit adder module. Use structural VHDL to combine the adder modules to form the multiplier. Perform a unit delay simulation of your circuit for all 64 possible pairs of input values and display the results so that inputs and outputs are represented numerically (that is, combine the signals to form a bus) so that the results are easy to check. In your simulation, set the simulation precision to 1 ns and have the inputs change once every 20 ns. entity adder is cin: in STD_LOGIC; a, b: in STD_LOGIC_VECTOR (2 downto 0 x: out STD_LOGIC_VECTOR (2 downto 0 cout: out STD_LOGIC end adder; architecture adder_arch of adder is signal c: STD_LOGIC_VECTOR (2 downto 0 c(0) <= (a(0) and b(0)) or (a(0) and cin) or (b(0) and cin c(1) <= (a(1) and b(1)) or (a(1) and c(0)) or (b(1) and c(0) c(2) <= (a(2) and b(2)) or (a(2) and c(1)) or (b(2) and c(1) cout <= c(2 x(0) <= a(0) xor (b(0) xor cin x(1) <= a(1) xor (b(1) xor c(0) x(2) <= a(2) xor (b(2) xor c(1) end adder_arch; ----------------------------------------------- entity mult is a, b: in STD_LOGIC_VECTOR (2 downto 0 x: out STD_LOGIC_VECTOR (5 downto 0) end mult; architecture mult_arch of mult is component adder cin: in STD_LOGIC; a, b: in STD_LOGIC_VECTOR (2 downto 0 x: out STD_LOGIC_VECTOR (2 downto 0 cout: out STD_LOGIC end component; signal pp0, pp1, pp2, spp0: STD_LOGIC_VECTOR (2 downto 0 signal isum: STD_LOGIC_VECTOR (3 downto 0 signal zero: STD_LOGIC; zero <= '0'; - 6 -

pp0 <= a when b(0) = '1' else "000"; pp1 <= a when b(1) = '1' else "000"; pp2 <= a when b(2) = '1' else "000"; spp0 <= '0' & pp0(2 downto 1 add0: adder port map(zero, pp1, spp0, isum(2 downto 0), isum(3) add1: adder port map(zero, pp2, isum(3 downto 1), x(4 downto 2), x(5) x(1) <= isum(0 x(0) <= pp0(0 end mult_arch; - 7 -

- 8 -

- 9 -

3. Consider the flip flop in Figure 4-35 of Mano & Kime. Construct (by hand) a timing diagram for this circuit to determine how it behaves. Show the C and D inputs, the intermediate S and R signals and the Q and Q outputs. To understand how the circuit works, consider the diagram shown below. A C.. S R... Q Q D. B The first thing to do is note that when C=0, the S and R signals are both high. This means that the output latch just retains its old value. So, whenever C=0, there is no change to Q and Q'. Also, when C=0, signal B equals D' (the complement of the D input). Because of this, signal A equals D. Now, consider what happens when C changes from 0 to 1,while D stays stable. The two inner NANDs on the left hand side are now enabled. So in particular, the second one from the top propagates the value on the other input to its output (complementing it, as it propagates).this makes the S signal equal to D'. Now, the second NAND from the bottom has C=1 at one input and has D' at both of its other inputs. So its output will be D. That is R will be D. So now the output latch has complementary values on its inputs and will propagate these to the outputs, so that we will have Q=D and Q'=D'. Now, the last thing to note is that after C goes high, subsequent changes to the D input don't affect the stored value, because after the transition, the feedback input of the bottom NAND is equal to D. If the D input now changes to D', this NAND will have different values on its two inputs, so signal B will be high. But this high output just reinforces the feedback through the top NAND gate, without allowing any other signal values to change. So all changes to D that follow the rising clock edge have no effect on the output value. - 10 -

So the circuit operates as a positive edge-triggered D flip flop. Note that it is important that the D input stays stable when the clock is rising. If this condition is not met, the operation of the circuit is unpredictable and can include oscillations on the outputs. C D S R Q Q - 11 -

4. Derive a state transition diagram ( bubble diagram) for the sequential circuit shown below. Give a set of test inputs for this circuit that will verify every transition in the state diagram (including self-loops ). D R clk D >C Q Q Z 00/1 10/0 *1/0 0 1 10/1 DR/Z *1/0 00/0 The following sequence exercises all the transitions. D = 0010 1011 10 R = 1110 0001 01-12 -