Chapter 8 VHDL Code Examples

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

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

Constructing VHDL Models with CSA

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

Inferring Storage Elements

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

Multiplication Simple Gradeschool Algorithm for 16 Bits (32 Bit Result)

[VARIABLE declaration] BEGIN. sequential statements

Getting Started with the CPU Design

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

Simulation with ModelSim Altera from Quartus II

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

Test Benches - Module 8

Objective Design a 4*4 register file and test it on VSIM, QUARTUS, and UP3 board.

ECOM 4311 Digital Systems Design

VHDL Testbench Design. Textbook chapters 2.19, , 9.5

The Optimization of a Design Using VHDL Concepts

ECE 545 Lecture 12. Datapath vs. Controller. Structure of a Typical Digital System Data Inputs. Required reading. Design of Controllers

Simulation with ModelSim Altera from Quartus II

A Programmable Pulse Generator

In our case Dr. Johnson is setting the best practices

Lecture 27. Structural Description of a 3-Bit Synchronous Decade Counter. FIGURE 4.31 A State diagram of a decade counter.

Problem Set 10 Solutions

Summary of FPGA & VHDL

EL 310 Hardware Description Languages Midterm

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

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

Hardware Description Language VHDL (1) Introduction

VHDL/Verilog Simulation. Testbench Design

Introduction to VHDL #3

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

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

TSIU03, SYSTEM DESIGN LECTURE 10

VHDL Simulation. Testbench Design

Getting Started with VHDL

Senior Project Design Review: Internal Hardware Design of a Microcontroller in VLSI

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

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Quartus Counter Example. Last updated 9/6/18

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

Concurrent Signal Assignment Statements (CSAs)

ELCT 501: Digital System Design

Hello, World: A Simple Application for the Field Programmable Port Extender (FPX)

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

OUTLINE SYSTEM-ON-CHIP DESIGN. GETTING STARTED WITH VHDL September 3, 2018 GAJSKI S Y-CHART (1983) TOP-DOWN DESIGN (1)

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

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

EE434 ASIC & Digital Systems

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

Example 58: Traffic Lights

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

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

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

7 PROGRAMMING THE FPGA Simon Bevan

Fundamental Design Concepts. Fundamental Concepts. Modeling Domains. Basic Definitions. New terminology and overloaded use of common words

ECE 545 Lecture 4. Simple Testbenches. George Mason University

Σχεδιασμός Κυκλώματος Προσαύξησης στη VHDL

Sequential Statement

Experiment 0 OR3 Gate ECE 332 Section 000 Dr. Ron Hayne June 8, 2003

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

VHDL. Official Definition: VHSIC Hardware Description Language VHISC Very High Speed Integrated Circuit

Lecture 6. Digital Design Laboratory. Copyright 2007, 2009, 2010, 2014 Thomas R. Collins, Kevin Johnson

Advanced Digital Design Spring 2011 Final Examination Time Limit: 2 Hours

Sequential Logic - Module 5

5. VHDL - Introduction - 5. VHDL - Design flow - 5. VHDL - Entities and Architectures (1) - 5. VHDL - Entities and Architectures (2) -

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

EENG 2910 Project III: Digital System Design. Due: 04/30/2014. Team Members: University of North Texas Department of Electrical Engineering

Very High Speed Integrated Circuit Har dware Description Language

Introduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez

Modeling Complex Behavior

Polusabirač. design.vhd. testbench.vhd. library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;

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

EEL 4712 Digital Design Test 2 Spring Semester 2008

CCE 3202 Advanced Digital System Design

Test Bench. Top Level Model Test Bench MUT

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

3e library declarations library IEEE; use IEEE.std_logic_1164.all;

Hard/Software Interface MicroEnable

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 8

MCPU - A Minimal 8Bit CPU in a 32 Macrocell CPLD.

Hardware Description Languages. Modeling Complex Systems

VHDL for Modeling - Module 10

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

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

CprE 583 Reconfigurable Computing

VHDL Examples Mohamed Zaky

EE261: Intro to Digital Design

The CPU Bus : Structure 0

Advanced module: Video en/decoder on Virtex 5

JUNE, JULY 2013 Fundamentals of HDL (10EC45) PART A

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

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

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

EEL 4712 Digital Design Test 1 Spring Semester 2008

Computer-Aided Digital System Design VHDL

Simulating the ASMI Block in Your Design

VHDL simulation and synthesis


Concurrent & Sequential Stmts. (Review)

Full-Speed USB 1.1 Function Controller

Transcription:

APPENDIX I Chapter 8 VHDL Code Examples I.1 Introduction Two example VHDL code designs are presented in Chapter 8, the first for controlling the AD7524 digital-to-analogue converter and the second for controlling an example thyristor. This appendix presents the code examples along with commenting to support the presented code: Figure 8.18 VHDL code for DAC controller Figure 8.19 Figure 8.55 Figure 8.56 VHDL test bench for DAC controller Thyristor gate control pulse generator Thyristor gate control pulse generator test bench

2 Appendix I I.2 VHDL Code Examples ENTITY AD7524_Controller IS PORT ( Clock : IN STD_LOGIC; Reset : IN STD_LOGIC; Data_In : IN STD_LOGIC_VECTOR (7 downto 0); Data_Out : OUT STD_LOGIC_VECTOR (7 downto 0); CS : OUT STD_LOGIC; WR : OUT STD_LOGIC); END ENTITY AD7524_Controller; ARCHITECTURE Behavioural OF AD7524_Controller IS SIGNAL Count : STD_LOGIC_VECTOR(2 downto 0); SIGNAL Update : STD_LOGIC; PROCESS (Update, Reset, Data_In) If (Reset = '0') Then Data_Out(7 downto 0) <= "00000000"; ElsIf (Update'event and Update = '1') Then Data_Out(7 downto 0) <= Data_In(7 downto 0); PROCESS (Clock, Reset) If (Reset = '0') Then Count(2 downto 0) <= "000"; ElsIf (Clock'event and Clock = '1') Then PROCESS (Count) If (Count = "100") Then Count <= "000"; Count <= Count + 1; If (Count = "000") Then Update <='0'; CS <= '1'; WR <= '1'; ElsIf (Count = "001") Then Update <='1'; CS <= '1'; WR <= '1'; ElsIf (Count = "010") Then Update <='0'; CS <= '0'; WR <= '1'; ElsIf (Count = "011") Then Update <='0'; CS <= '0'; WR <= '0'; ElsIf (Count = "100") Then Update <='0'; CS <= '0'; WR <= '1'; Update <='0'; CS <= '1'; WR <= '1'; Figure 8.18: VHDL code for DAC controller

Chapter 8 VHDL Code Examples 3 ENTITY Test_AD7524_Controller_vhd IS END Test_AD7524_Controller_vhd; ARCHITECTURE Behavioural OF Test_AD7524_Controller_vhd IS COMPONENT AD7524_Controller PORT( Clock : IN STD_LOGIC; Reset : IN STD_LOGIC; Data_In : IN STD_LOGIC_VECTOR (7 downto 0); Data_Out : OUT STD_LOGIC_VECTOR (7 downto 0); CS : OUT STD_LOGIC; WR : OUT STD_LOGIC); END COMPONENT; SIGNAL Clock : STD_LOGIC := '0'; SIGNAL Reset : STD_LOGIC := '0'; SIGNAL Data_In : STD_LOGIC_VECTOR (7 downto 0) := (others=>'0'); SIGNAL Data_Out : STD_LOGIC_VECTOR(7 downto 0); SIGNAL CS : STD_LOGIC; SIGNAL WR : STD_LOGIC; uut: AD7524_Controller PORT MAP( Clock => Clock, Reset => Reset, Data_In => Data_In, Data_Out => Data_Out, CS => CS, WR => WR); Reset_Process : PROCESS Wait for 0 ns; Reset <= '0'; Wait for 5 ns; Reset <= '1'; Wait; Clock_Process : PROCESS Wait for 0 ns; Clock <= '0'; Wait for 10 ns; Clock <= '1'; Wait for 10 ns; Clock <= '0'; Figure 8.19: VHDL test bench for DAC controller

4 Appendix I ENTITY Pulse_Generator is PORT ( Master_Clock : IN STD_LOGIC; Master_Reset : IN STD_LOGIC; Gate_Control : OUT STD_LOGIC); END ENTITY Pulse_Generator; ARCHITECTURE Behavioural OF Pulse_Generator IS SIGNAL Divider : STD_LOGIC_VECTOR(15 downto 0); SIGNAL Int_Clock : STD_LOGIC; SIGNAL Count : STD_LOGIC_VECTOR(4 downto 0); PROCESS(Master_Clock, Master_Reset) If (Master_Reset = '0') Then Divider(15 downto 0) <= "0000000000000000"; ElsIf (Master_Clock'event and Master_Clock = '1') Then If (Divider = "1100001101001111") Then Divider(15 downto 0) <= "0000000000000000"; Divider(15 downto 0) <= Divider(15 downto 0) + 1; PROCESS(Divider) If (Divider = "1100001101001111") Then Int_Clock <= '1'; Int_Clock <= '0'; PROCESS(Int_Clock, Master_Reset) Figure 8.55: Thyristor gate control pulse generator

Chapter 8 VHDL Code Examples 5 If (Master_Reset = '0') Then Count(4 downto 0) <= "00000"; ElsIf (Int_Clock'event and Int_Clock = '1') Then If (Count = "10011") Then Count(4 downto 0) <= "00000"; Count(4 downto 0) <= Count(4 downto 0) + 1; PROCESS(Count) If (Count = "00001") Then Gate_Control <= '1'; Gate_Control <= '0'; Figure 8.55: (Continued)

6 Appendix I ENTITY Test_Pulse_Generator_vhd IS END Test_Pulse_Generator_vhd; ARCHITECTURE Behavioural OF Test_Pulse_Generator_vhd IS COMPONENT Pulse_Generator PORT( Master_Clock : IN STD_LOGIC; Master_Reset : IN STD_LOGIC; Gate_Control : OUT STD_LOGIC); END COMPONENT; SIGNAL Master_Clock : STD_LOGIC := '0'; SIGNAL Master_Reset : STD_LOGIC := '0'; SIGNAL Gate_Control : STD_LOGIC; uut: Pulse_Generator PORT MAP( Master_Clock => Master_Clock, Master_Reset => Master_Reset, Gate_Control => Gate_Control); Master_Reset_Process : PROCESS Wait for 0 ns; Master_Reset <= '0'; Wait for 5 ns; Master_Reset <= '1'; Wait; Master_Clock_Process : PROCESS Wait for 0 ns; Master_Clock <= '0'; Wait for 10 ns; Master_Clock <= '1'; Wait for 10 ns; Master_Clock <= '0'; Figure 8.56: Thyristor gate control pulse generator test bench