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

Similar documents
The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

Sequential Logic - Module 5

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution Spring 2016

The University of Alabama in Huntsville ECE Department CPE Final Exam Solution Spring 2004

VHDL Modeling Behavior from Synthesis Perspective -Part B - EL 310 Erkay Savaş Sabancı University

The University of Alabama in Huntsville ECE Department CPE Midterm Exam February 26, 2003

COVER SHEET: Total: Regrade Info: 5 (14 points) 7 (15 points) Midterm 1 Spring 2012 VERSION 1 UFID:

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

Sign here to give permission for your test to be returned in class, where others might see your score:

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

VHDL And Synthesis Review

Problem Set 10 Solutions

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

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

Summary of FPGA & VHDL

IT T35 Digital system desigm y - ii /s - iii

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

Sequential Statement

VHDL in 1h. Martin Schöberl

VHDL Examples Mohamed Zaky

EL 310 Hardware Description Languages Midterm

DESIGN AND IMPLEMENTATION OF MOD-6 SYNCHRONOUS COUNTER USING VHDL


Problem Set 5 Solutions

FSM Components. FSM Description. HDL Coding Methods. Chapter 7: HDL Coding Techniques

8-1. Fig. 8-1 ASM Chart Elements 2001 Prentice Hall, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 2e, Updated.

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

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2

SEQUENTIAL STATEMENTS

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Timing in synchronous systems

ECE 459/559 Secure & Trustworthy Computer Hardware Design

Lecture 12 VHDL Synthesis

Hardware Description Languages. Modeling Complex Systems

Test Benches - Module 8

Design Problem 5 Solutions

CprE 583 Reconfigurable Computing

Synthesis from VHDL. Krzysztof Kuchcinski Department of Computer Science Lund Institute of Technology Sweden

CCE 3202 Advanced Digital System Design

[VARIABLE declaration] BEGIN. sequential statements

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

Inferring Storage Elements

1. What is y-chart? ans: The y- chart consists of three domains:- behavioral, structural and geometrical.

Control and Datapath 8

Example 58: Traffic Lights

Lab 3. Advanced VHDL

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

The University of Alabama in Huntsville ECE Department CPE Final Exam Solution Spring 2016

COVER SHEET: Total: Regrade Info: 7 (6 points) 2 (10 points) 9 (5 points) 8 (12 points) 12 (5 points) 11 (25 points)

Assignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture

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

Hardware Description Language VHDL (1) Introduction

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Introduction to VHDL #3

Field Programmable Gate Array

Exercise: how can we do?

Sign here to give permission to return your test in class, where other students might see your score:

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

CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis. Register File: An Example. Register File: An Example (cont d) Aleksandar Milenkovic

EEL 4712 Digital Design Test 1 Spring Semester 2007

Modeling Complex Behavior

EECE 353: Digital Systems Design Lecture 10: Datapath Circuits

CS/EE Homework 7 Solutions

Sign here to give permission for your test to be returned in class, where others might see your score:

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

8 Register, Multiplexer and


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

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

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

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

Example 15: Moving Sprites with Flash Background

VHDL for Modeling - Module 10

CS303 LOGIC DESIGN FINAL EXAM

COVER SHEET: Total: Regrade Info: Problem#: Points. 7 (14 points) 6 (7 points) 9 (6 points) 10 (21 points) 11 (4 points)

VHDL Simulation. Testbench Design

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

8-1. Fig. 8-1 ASM Chart Elements 2001 Prentice Hall, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 2e, Updated.

ECE Digital Design Laboratory. Lecture 3 Finite State Machines!

3 Designing Digital Systems with Algorithmic State Machine Charts

ECE 3401 Lecture 20. Microprogramming (III) Overview. Single-Cycle Computer Issues. Multiple-Cycle Computer. Single-Cycle SC

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

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

Design Problem 3 Solutions

COVER SHEET: Total: Regrade Info: 1 (8 points) 2 ( 8 points) 3 (16 points) 4 (16 points) 5 (16 points) 6 (16 points) 7 (16 points) 8 (8 points)

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

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

Writing VHDL for RTL Synthesis

CHAPTER Pearson Education, Inc. S_n. R_n. Q_n. 0 ps 20 ns 40 ns 60 ns 80 ns. C S R Q Q_n. 0 ps 50 ns 100 ns 150 ns 200 ns

search_chr: ASM chart search_chr search_chr search_chr MEM_ENABLE MEM_WE MEM_ADDRESS MEM_DATAIN MEM_DATAOUT MEM_READY ADDRESS CHAR LEN nfound

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

Multi-valued Logic. Standard Logic IEEE 1164 Type std_ulogic is ( U, uninitialized

VHDL: RTL Synthesis Basics. 1 of 59

CCE 3202 Advanced Digital System Design

VHDL 2 Combinational Logic Circuits. Reference: Roth/John Text: Chapter 2

EEE8076. Reconfigurable Hardware Design (coursework) Module Outline. Dr A. Bystrov Dr. E.G. Chester. Autumn

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

Corrections for Digital Systems Design Using VHDL, 3rd printing

Note: Closed book no notes or other material allowed, no calculators or other electronic devices.

Transcription:

5.3(a)(2), 5.6(c)(2), 5.2(2), 8.2(2), 8.8(2) The University of Alabama in Huntsville Electrical and Computer Engineering CPE/EE 422/522 Spring 25 Homework #6 Solution 5.3 (a) For the following SM chart: Draw a timing chart that shows the clock, the state (S, S or S2), the inputs (X, X2 and X3) and the outputs. The input sequence is X X2 X3 =,,,,,,. Assume that all state changes occur on the rising edge of the clock, and the inputs change on the falling edge of the clock. S/ X 2 Z X Z 2 S/ Z CLK X X2 Z 3 X 3 X 2 X3 STATE S S2 S S2 S S2 S S S2/Z X Z Z2 Z3 5.6(c) For the given SM chart: Write a VHDL description of the system. S/ X X2 Z S/Z3 S2/ X3 X4 Z2 Z3 X4

library ieee; use ieee.std_logic_64.all; entity SM_CHART5_6 is port (X, X2, X3, X4, X5 : in std_logic; Z, Z2, Z3 : out std_logic; CLK, RESET : in std_logic); end SM_CHART5_6; architecture BEHAVE of SM_CHART5_6 is type STATE_TYPE is (S, S, S2); signal STATE, NEXT_STATE : STATE_TYPE; process(x, X2, X3, X4, X5, STATE) Z <= ''; Z2 <= ''; Z3 <= ''; case STATE is when S => if (X = '') then NEXT_STATE <= S; if (X2 = '') then Z <= ''; NEXT_STATE <= S; when S => Z3 <= ''; if (X3 = '') then Z2 <= ''; NEXT_STATE <= S; when S2 => if (X4 = '') then if (X5 = '') then NEXT_STATE <= S; Z3 <= ''; NEXT_STATE <= S; process(clk, RESET) if (RESET = '') then STATE <= S; elsif (CLK = '' and CLK'event) then STATE <= NEXT_STATE; end BEHAVE;

5.2 The block diagram for an elevator controller for a building with two floors is shown below. The inputs FB and FB2 are floor buttons in the elevator. The inputs CALL and CALL2 are call buttons in the hall. The inputs FS and FS2 are floor switches that output a when the elevator is at the first or second floor landing. Outputs and control the motor, and the elevator is stopped when = =. N and are flip-flops that indicate when the elevator is needed on the first or second floor. R and R2 are signals that reset these flip-flops. DO = causes the door to open, and = indicates that the door is closed. Draw an SM chart for the elevator controller (four states). FB CALL Storage N R2 R FB2 CALL2 Storage Elevator Control FS FS2 DO Door Mechanism F2/ F2/ FS2 FS R2, DO R, DO F22/ F/ R2, DO N R, DO N

8.2 Design an address decoder. One input to the address decoder is an 8-bit address, which can have any range with a length of 8, for example: std_logic_vector addr(8 to 5). The second input is check : std_logic_vector(5 down to ). The address decoder will output Sel = if the upper 6 bits of the 8-bit address match the 6-bit check vector. For example, if addr = and check = -- then Sel =. Only the 6 leftmost bits of addr will be compared; the remaining bits are ignored. An - in the check vector is a don t care. library ieee; use ieee.std_logic_64.all; entity address_decoder is port (ADDRESS : in std_logic_vector; CHECK : in std_logic_vector(5 downto ); SEL : out std_logic); end ADDRESS_DECODER; architecture BEHAV of ADDRESS_DECODER is alias ADDR : std_logic_vector(address'length- downto ) is ADDRESS; process(address, CHECK) variable MATCH : boolean; MATCH := TRUE; for I in ADDRESS'length- downto ADDRESS'length--5 loop if ((ADDR(I) /= CHECK(I-2)) and (CHECK(I-2) /= '-')) then MATCH := FALSE; end loop; if (MATCH) then SEL <= ''; SEL <= ''; end BEHAV; 8.8 Write a VHDL function to compare two IEEE std_logic_vectors to see whether they are equal. Report an error if any bit in either vector is not,, or - (don t care), or if the lengths of the vector are not the same. The function call should pass only the vectors. The function should return TRUE if the vectors are equal, FALSE. When comparing the vectors, consider that = - and = -. Make no assumptions about the index range of the two vectors. library ieee; use ieee.std_logic_64.all; package MINE is function "=" (L, R : std_logic_vector) return boolean; end MINE;

package body MINE is function "=" (L, R : std_logic_vector) return boolean is variable EQUAL : boolean; alias LEFT : std_logic_vector(l'length- downto ) is L; alias RIGHT : std_logic_vector(l'length- downto ) is R; assert L'length = R'length report "Vectors are not the same length" EQUAL := TRUE; for I in LEFT'range loop case LEFT(I) is when '' => case RIGHT(I) is when '' '-' => null; when '' => case RIGHT(I) is when '' '-' => null; when '-' => case RIGHT(I) is when '' '' => null; when others => assert FALSE report "First vector has invalid value" assert (RIGHT(I)='' or RIGHT(I)='' or RIGHT(I)='-') report "Second vector has invalid value" end loop; return EQUAL; end "="; end MINE;