1 H ardware D escription L anguages Basic Input/Output.

Slides:



Advertisements
Similar presentations
VHDL in digital circuit synthesis (tutorial) dr inż. Miron Kłosowski EA 309
Advertisements

VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
INTRO TO VHDL Appendix A: page page VHDL is an IEEE and ANSI standard. VHDL stands for Very High Speed IC hardware description language.
Test Bench Un test bench es una entidad que no tiene declaraciones de puertos. Consiste en una arquitectura que contiene una instancia del componente a.
Introduction to VHDL (Lecture #5) ECE 331 – Digital System Design The slides included herein were taken from the materials accompanying Fundamentals of.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL ECE 448 Lecture 10 Advanced Testbenches.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
Managing design complexity Partition of designs Typical design process using VHDL Test Bed A VHDL example.
VHDL And Synthesis Review. VHDL In Detail Things that we will look at: –Port and Types –Arithmetic Operators –Design styles for Synthesis.
Kazi Fall 2006 EEGN 4941 EEGN-494 HDL Design Principles for VLSI/FPGAs Khurram Kazi Some of the slides were taken from K Gaj’s lecture slides from GMU’s.
ECE C03 Lecture 141 Lecture 14 VHDL Modeling of Sequential Machines Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Chapter 8: I/O Streams and Data Files. In this chapter, you will learn about: – I/O file stream objects and functions – Reading and writing character-based.
Lecture #6 Page 1 Lecture #6 Agenda 1.VHDL - Architecture 2.VHDL - Packages Announcements 1.HW #3 assigned ECE 4110– Sequential Logic Design.
(1) Basic Input and Output © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
CMPUT Computer Organization and Architecture II 1 CMPUT329 - Fall 2003 Topic 6: Testbenches Paras Mehta and José Nelson Amaral.
1 H ardware D escription L anguages Basic Language Concepts.
Design Verification VHDL ET062G & ET063G Lecture 5 Najeem Lawal 2012.
VHDL TUTORIAL Preetha Thulasiraman ECE 223 Winter 2007.
10/17/2015DSD, USIT, GGSIPU1 Data Types Each data object has a type associated with it. The type defines the set of values that the object can have and.
Digital System Verification. VERIFICATION OUTLINE Purpose of Verification –Verification effort and cost Verification Tools –Linting tools –Code Coverage.
ECE 368 CAD-Based Logic Design Shantanu Dutt Lecture 11 File I/O and Textio in VHDL (courtesy of Karam Chatha, ASU)
VHDL Files & Text IO ECE4623/5623 Computer Hardware Design.
C++ for Engineers and Scientists Second Edition Chapter 8 I/O File Streams and Data Files.
Chapter 9 I/O Streams and Data Files
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
George Mason University ECE 545 Lecture 7 Advanced Testbenches.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
George Mason University ECE 545 – Introduction to VHDL Variables, Functions, Memory, File I/O ECE 545 Lecture 7.
Copyright(c) 1996 W. B. Ligon III1 Getting Started with VHDL VHDL code is composed of a number of entities Entities describe the interface of the component.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
1 VHDL Overview A Quick Start Tutorial. 2 What does VHDL stand for ? V HSIC H ardware D escription L anguage VHSIC: V ery H igh S peed I ntegrated C ircuits.
Mixed Style RTL Modeling
Topics AliasesSubprograms Generics & Configurations.
1 VLSI Design & Reconfigurable Computing ENG*6090(3) Advanced Topics in VHDL Stephen Coe Guangfa Lu Friday, March 07, 2003.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
EE694v-Verification-Lect6-1- Lecture 6 - Writing Tests A difference if treating the design as a black box or if you have access to internal signals EE762.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
15-Dec-15EE5141 Chapter 4 Sequential Statements ä Variable assignment statement ä Signal assignment statement ä If statement ä Case statement ä Loop statement.
George Mason University Simple Testbenches ECE 545 Lecture 4.
16/11/2006DSD,USIT,GGSIPU1 Packages The primary purpose of a package is to encapsulate elements that can be shared (globally) among two or more design.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
EE694v-Verification-Lect6-1- Lecture 6 - Writing Tests A difference if treating the design as a black box or if you have access to internal signals EE762.
Modern Digital System Design Using VHDL: A Practical Introduction Subprograms & Packages Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd.
IAY 0600 Digital Systems Design VHDL discussion Verification: Testbenches Alexander Sudnitson Tallinn University of Technology.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the basic properties and characteristics of external files ❏ To.
George Mason University Advanced Testbenches Lecture 4.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
ECE 448 – FPGA and ASIC Design with VHDL George Mason University ECE 448 Lab 2 Implementing Combinational Logic in VHDL.
CDA 4253 FPGA System Design VHDL Testbench Development Hao Zheng Comp. Sci & Eng USF.
Programming II I/O Streams and Data Files 1(c) Asma AlOsaimi.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Unit 7 Mixed Language Descriptions SYLLABUS Highlights of Mixed-Language Description, How to invoke One language from the Other Mixed-language Description.
Basic Language Concepts
Chapter 7 Text Input/Output Objectives
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Chapter 7 Text Input/Output Objectives
ECE 4110–5110 Digital System Design
CPE 528: Session #8 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
ECE 545 Lecture 10 Advanced Testbenches.
CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
ECE 434 Advanced Digital System L17
CPE/EE 422/522 Advanced Logic Design L15
VHDL Discussion Subprograms
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
VHDL Discussion Subprograms
UNIT 6: Mixed-Type Description
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

1 H ardware D escription L anguages Basic Input/Output

2 File Objects VHDL objects: Signals, Variables, Constants, Files Files provides an interface between the VHDL programs and the host environment VHDL Program file: type declaration operations

3 Basic I/O Operations File Type and Declaration Opening and Closing a File of a specified type Reading and Writing from a file A very useful example of the application of file I/O is the construction of testbenches Example: the testbench reads test inputs from a file, applies them to the model under test, and records model outputs for analysis

4 File Type and Declaration Files are distinguished by the type of information stored type textFileType is file of string ; type integerFileType is file of integer ; File declarations VHDL 1987 file infile: textFileType is in “inputdata.txt”; file outfile: textFileType is out “outputdata.txt”; File declarations VHDL 1993 file infile: textFileType open read_mode is “inputdata.txt”; file outfile: textFileType open write_mode is “outputdata.txt”;

5 Binary File I/O (VHDL 1987) VHDL 1987 provides read(f,value), write(f, value) and endfile(f) It uses implicit file open operations via file declarations test of binary file I/O -- entity io87 is end io87; architecture beh of io87 is begin process type IntegerFileType is file of integer; file dataout:IntegerFileType is out “output.txt”; variable check :integer :=0; begin for count in 1 to 10 loop check := check+1; write(dataout, check); end loop; wait; end process; end beh;

6 Binary File I/O (VHDL 1993) – cont. entity io93 is end entity io93; architecture beh of io93 is begin process is type IntFileType is file of integer; -- file declarations file dataout :IntFileType; variable count : integer:= 0; variable fstatus: FILE_OPEN_STATUS; begin file_open(fstatus,dataout,"myfile.txt",write_mode); -- open the file for j in 1 to 8 loop write(dataout,count); -- some random values count := count+2; end loop; wait; -- an artificial way to stop the process end process; end architecture beh;

7 VHDL ’93 provides READ(file_handle,value), WRITE(file_handle, value) and ENDFILE(file_handle), and also FILE_OPEN() and FILE_CLOSE() VHDL ’93 allows both explicit and implicit file open operations procedure FILE_OPEN( file file_handle: FILE_TYPE File_name: in STRING; Open_kind: in FILE_OPEN_KIND := READ_MODE); procedure FILE_OPEN(File_Status:out FILE_OPEN_STATUS; file file_handle: FILE_TYPE File_name: in STRING; Open_kind: in FILE_OPEN_KIND := READ_MODE); procedure FILE_CLOSE( file file_handle: FILE_TYPE) Binary File I/O (VHDL 1993) – cont.

8 FILE_OPEN_KIND may have one of 3 values: READ_MODE, WRITE_MODE, APPEND_MODE FILE_STATUS may have one of 4 values: OPEN_OK file open operation was successfull STATUS_ERROR attempted to open an already open file NAME_ERROR file not found MODE_ERROR file cannot be opened in this mode Binary File I/O (VHDL 1993)

9 Binary File I/O limitations The values passed on each line of the file are all of the same type It would be very “handy” to be able to pass different types ……..

10 The TEXTIO Package line file read(buf,c) write(buf,arg) writeline() buffer One common approach to I/O for the predefined types of the language is to use the TEXTIO package I/O is text based (ASCII) The TEXTIO package is in the STD library, which is implicitly declared. You do not need to declare the usage of the library STD, however you still need to declare the use of the package contents via the use clause

11 The TEXTIO Package Text based I/O A file is organized by lines read() and write() procedures operate on line data structures readline() and writeline() procedures transfer data from-to files The TEXTIO package is in the library STD and provides: procedures for reading and writing the pre-defined types from lines predefined access to std_input and std_output procedures names are overloaded procedure

12 Example: Use of the TEXTIO Package use std.textio.all; entity formatted_io is -- this entity is empty end formatted_io; architecture behavioral of formatted_io is begin process is file outfile :text; -- declare the file to be a text file variable fstatus :File_open_status; variable count: integer := 5; variable value : bit_vector(3 downto 0):= X”6”; variable buf: line; -- buffer to file begin -- open the file for writing file_open(fstatus, outfile,”myfile.txt”, write_mode); L1: write(buf, “This is an example of formatted I/O”); L2: writeline(outfile, buf); -- write buffer to file L3: write(buf, “The First Parameter is =”); L4: write(buf, count); L5: write(buf, ‘ ‘); L6: write(buf, “The Second Parameter is = “); L7: write(buf, value); L8: writeline(outfile, buf); L9: write(buf, “...and so on”); L10: writeline(outfile, buf); L11: file_close(outfile); -- flush the buffer to the file wait; end process; end architecture behavioral; This is an example of formatted I/O The First Parameter is = 5 The Second Parameter is = and so on Result

13 Passing Filenames interactively process is variable buf : line; variable fname : string(1 to 10); begin prompt and read filename from standard input -- write(output, “Enter Filename: “); readline(input, buf); read(buf, fname); process code -- end process; Generally “input” and “output” are mapped to standard input and standard output respectively

14 Extending TEXTIO for other Datatypes Hide the ASCII format of TEXTIO from the user Create type conversion procedures for reading and writing desired datatypes Encapsulate procedures in a package Install package in a library and make its contents visible via the use clause library ieee; use ieee.std_logic_textio.all;

15 Constructing Testbenches General approach: Apply stimulus vectors and Measure and Record response vectors If the number of test vectors is too big procedural vectors generation is preferable to FILE I/O vectors generation Clock and reset generation is usually done with procedural stimulus

16 Testbenches: I/O stimulus generation example... while not endfile(vectors) loop readline(vectors, vectorline); -- file format is if (vectorline(1) = ‘#’ then next; end if; read(vectorline, datavar); read((vectorline, A); -- A, B, and C are two bit vectors read((vectorline, B); -- of type std_logic read((vectorline, C); -- --signal assignments Indata <= to_stdlogic(datavar); A_in <= unsigned(to_stdlogicvector(A)); -- A_in, B_in and C_in are B_in <= unsigned(to_stdlogicvector(B)); -- of unsigned vectors C_in <= unsigned(to_stdlogicvector(C)); wait for ClockPeriod; end loop;...

17 Testbenches: Validation Compare reference vectors with response vectors and record errors in external files In addition to failed tests record simulation time

18 The “ASSERT” Statement Designer can report errors at predefined levels: NOTE, WARNING, ERROR and FAILURE (enumerated type) Report argument is a character string written to simulation output TEXTIO may be faster than ASSERT if we do not need to stop the simulation assert Q = check(1) and Qbar = check(0) report “Test Vector Failed” severity error;

19 Summary Basic Input/Output Binary I/O ASCII I/O and the TEXTIO package VHDL 87 vs. VHDL 93 Testbenches The ASSERT statement