CS/EE Homework 7 Solutions

Similar documents
EE 231 Fall EE 231 Homework 8 Due October 20, 2010

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. Behavioral Design Style: Registers & Counters.

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1 Solutions

[VARIABLE declaration] BEGIN. sequential statements

Counters. Counter Types. Variations. Modulo Gray Code BCD (Decimal) Decade Ring Johnson (twisted ring) LFSR

Ripple Counters. Lecture 30 1

Problem Set 10 Solutions

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

Control Unit: Binary Multiplier. Arturo Díaz-Pérez Departamento de Computación Laboratorio de Tecnologías de Información CINVESTAV-IPN

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

University of Technology

Lab 3: Standard Combinational Components

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Control and Datapath 8

COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14

Sequential Statement

Control in Digital Systems

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

VHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents

ELCT 501: Digital System Design

CS232 VHDL Lecture. Types

Timing in synchronous systems

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

Digital Integrated Circuits

EL 310 Hardware Description Languages Midterm

Contents. Chapter 9 Datapaths Page 1 of 28

Sequential Logic - Module 5

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 6 Combinational and sequential circuits

Testbenches for Sequential Circuits... also, Components

EECE 353: Digital Systems Design Lecture 10: Datapath Circuits

Summary of FPGA & VHDL

Injntu.com Injntu.com Injntu.com R16

CSE 260 Digital Computers: Organization and Logical Design. Exam 2. Jon Turner 3/28/2012

ECE 545 Lecture 6. Behavioral Modeling of Sequential-Circuit Building Blocks. George Mason University

Chapter 10. Counters (a short discussion)

Lecture 12 VHDL Synthesis

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

CSE 260 Digital Computers: Organization and Logical Design. Exam 2 Solutions

3 Designing Digital Systems with Algorithmic State Machine Charts

Pollard s Tutorial on Clocked Stuff in VHDL

Design Problem 3 Solutions

Nanosistemų programavimo kalbos 5 paskaita. Sekvencinių schemų projektavimas

ECE 448 Lecture 4. Sequential-Circuit Building Blocks. Mixing Description Styles

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

VHDL Simulation. Testbench Design

EECS150, Fall 2004, Midterm 1, Prof. Culler. Problem 1 (15 points) 1.a. Circle the gate-level circuits that DO NOT implement a Boolean AND function.

EECS150 - Digital Design Lecture 20 - Finite State Machines Revisited

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

VHDL/Verilog Simulation. Testbench Design

Written exam for IE1204/5 Digital Design Thursday 29/

ECEU530. Homework 4 due Wednesday Oct 25. ECE U530 Digital Hardware Synthesis. VHDL for Synthesis with Xilinx. Schedule

Code No: R Set No. 1

Schedule. ECE U530 Digital Hardware Synthesis. Rest of Semester. Midterm Question 1a

Concurrent & Sequential Stmts. (Review)

Code No: R Set No. 1

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

Code No: R Set No. 1

Lecture 4: Modeling in VHDL (Continued ) EE 3610 Digital Systems

RealDigital. Problem Set #7 S1 S2 S3 Y Z X Y + Y Z X Z

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

6.111 Lecture # 8. Topics for Today: (as time permits)

VHDL: RTL Synthesis Basics. 1 of 59

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Computer-Aided Digital System Design VHDL

R07

Latch Based Design (1A) Young Won Lim 2/18/15

VHDL for Modeling - Module 10

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Inferring Storage Elements

Single Cycle Datapath

Sequential Circuit Design: Principle

VHDL VS VERILOG.

ECOM 4311 Digital Systems Design

The University of Alabama in Huntsville Electrical and Computer Engineering CPE/EE 422/522 Spring 2005 Homework #6 Solution

Lecture 3. Behavioral Modeling Sequential Circuits. Registers Counters Finite State Machines

Mid-Term Exam Solutions

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

EEL 4712 Digital Design Test 1 Spring Semester 2007

L5: Simple Sequential Circuits and Verilog

ENSC E-123: HW D3: Counter Applications; Counter in Verilog

Lectures 11 & 12: Synchronous Sequential Circuits Minimization

C A R L E T O N U N I V E R S I T Y. FINAL EXAMINATION April Duration: 3 Hours No. of Students: 108

Design Problem 4 Solutions

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

ECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity

Introduction to VHDL #3

Single Cycle Datapath

VHDL. ELEC 418 Advanced Digital Systems Dr. Ron Hayne. Images Courtesy of Cengage Learning

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

Design Problem 4 Solution

Digital Design with SystemVerilog

Mealy and Moore examples

Lab 6: Integrated the Decoder with Muti-bit Counter and Programming a FPGA

EECS 373 Midterm 2 Fall 2018

VHDL simulation and synthesis

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Test Benches - Module 8

Transcription:

CS/EE 260 - Homework 7 Solutions 4/2/2001 1. (20 points) A 4 bit twisted ring counter is a sequential circuit which produces the following sequence of output values: 0000, 1000, 1100, 1110, 1111, 0111, 0011, 0001 and then repeats. esign a circuit for a 4 bit twisted ring counter that uses four flip flops. raw a state transition diagram, a state table and a schematic for your circuit. esign an alternate implementation using just three flip flops and draw a state transition diagram, state table and a schematic for your circuit. If your designs are extended to implement an n bit twisted ring counter, how many flip flops are required using each of the two approaches. In what situations would you prefer the first method? In what situations would you prefer the second? present next state state output 0000 1000 0000 1000 1100 1000 1100 1110 1100 1110 1111 1110 1111 0111 1111 0111 0011 0111 0011 0001 0011 0001 0000 0001 0000/0000 1000/1000 1100/1100 1110/1110 0001/0001 0011/0011 0111/0111 1111/1111 outputs Reset Clk - 1 -

present next state state output 000 001 0000 001 010 1000 010 011 1100 011 100 1110 100 101 1111 101 110 110 111 0111 0011 111 000 0001 000/0000 111/0001 001/1000 110/0011 010/1100 101/0111 011/1110 100/1111 outputs Reset Clk If the designs are extended to n bits, the first will need n flip flops, while the second will need 1+log2n (assuming n is a power of 2). So for example, if n=64, this would be 64 vs. 7. On the other hand, the second will need more gates to generate the output logic, which could more than compensate for the savings in the number of flip flops. The first is preferable if speed is critical, but the second might be better for large values of n if it is important to minimize the number of flip flops.. - 2 -

2. (30 points) Write a VHL specification for a loadable BC up-down counter with 4 digits. Your design should have three control signals load, cnt and up. When load is high, the circuit should load the value on the data inputs. Otherwise, when cnt is high, the circuit should increment by 1 if up is high and decrement by 1 if up is low. Your design should also have a synchronous reset that sets the counter to zero when asserted. Simulate your design first using a functional simulation with a 10 ns clock period. In your simulation, load the following values into the counter 8, 98, 998, 9998 and after each load, increment the counter 5 times and decrement it 5 times. Verify that your counter works correctly and turn in the result from this simulation, along with your VHL source code. Now, switch to a unit delay mode simulation. oes your design still work correctly? If not, explain why you think it is not working. Also, if it does not work, try doubling the clock period and checking the results again. If it still does not work, continue doubling the clock period until you find a clock period for which your design will work in the unit delay mode. Turn in samples of your simulation output for each of these runs, showing either that the circuit is working correctly, or that it is not. What do these results tell you about the operation speed of your circuit? library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; -- bcd digit implements one decimal digit of BC up/down counter entity bcd_digit is port ( clk, reset: in ST_LOGIC; cnt, up, load: in ST_LOGIC; cbout: out ST_LOGIC; d: in ST_LOGIC_VECTOR (3 downto 0); q: out ST_LOGIC_VECTOR (3 downto 0) ); end bcd_digit; architecture bcd_digit_arch of bcd_digit is signal reg: ST_LOGIC_VECTOR (3 downto 0); begin process begin wait until clk = '1'; if reset = '1' then reg <= x"0"; elsif load = '1' then reg <= d; elsif cnt = '1' and up = '1' then if reg = x"9" then reg <= x"0"; else reg <= reg + x"1"; end if; elsif cnt = '1' and up = '0' then if reg = x"0" then reg <= x"9"; else - 3 -

reg <= reg - x"1"; end if; end if; end process; q <= reg; cbout <= '1' when (cnt = '1' and up = '1' and reg = x"9") or (cnt = '1' and up = '0' and reg = x"0") else '0'; end bcd_digit_arch; library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; -- BC up-down counter. Resets to zero, counts when cnt high, -- counts up when up is also high, otherwise down entity bcdcntv is port ( clk, reset: in ST_LOGIC; cnt, up, load: in ST_LOGIC; d: in ST_LOGIC_VECTOR (15 downto 0); q: out ST_LOGIC_VECTOR (15 downto 0) ); end bcdcntv; architecture bcdcntv_arch of bcdcntv is component bcd_digit port ( clk, reset: in ST_LOGIC; cnt, up, load: in ST_LOGIC; cbout: out ST_LOGIC; d: in ST_LOGIC_VECTOR (3 downto 0); q: out ST_LOGIC_VECTOR (3 downto 0) ); end component; signal cb: ST_LOGIC_VECTOR(3 downto 0); begin d0: bcd_digit port map(clk,reset, cnt, up,load,cb(0),d( 3 downto 0),q( 3 downto 0)); d1: bcd_digit port map(clk,reset,cb(0),up,load,cb(1),d( 7 downto 4),q( 7 downto 4)); d2: bcd_digit port map(clk,reset,cb(1),up,load,cb(2),d(11 downto 8),q(11 downto 8)); d3: bcd_digit port map(clk,reset,cb(2),up,load,cb(3),d(15 downto 12),q(15 downto 12)); end bcdcntv_arch; The functional simulation results appear on the next page, and show the circuit working correctly for all the tested input conditions. - 4 -

- 5 -

The simulation results below are from a unit delay simulation with a simulation precision of 1 ns and a 10 ns clock period. Although this was run for the same input values as the functional simulation, the results are obviously incorrect. Presumably, the gate delays are too high to allow the values to propagate through the combinational logic within the 10 ns available in each clock period. The results below are for a 20 ns clock period, and we can see that it seems to work somewhat better, but the load operation is still not working correctly. Apparently, it takes more than the 10 ns available for the data input values to propagate through the circuit s combinational logic to the flip flops. The results below are for a 40 ns clock period and here the load operation does work correctly, as do the counting operations. So, it appears that 20 ns is enough time for input values to propagate through to the flip flops. Overall, the results show that the counter works correctly, if the inputs are stable 20 ns before the clock goes high and the clock period is 40 ns or more. Clock periods close to 20 ns could work as well, but the inputs will have to be stable more than 10 ns before the clock edge in this case. - 6 -