VHDL Files & Text IO ECE4623/5623 Computer Hardware Design.

Slides:



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

 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Characters and Strings.
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
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.
1 H ardware D escription L anguages Basic Input/Output.
History TTL-logic PAL (Programmable Array Logic)
Chapter 9: Sequential Access Files and Printing
VHDL Data Types Module F3.1. VHDL Data Types Scalar Integer Enumerated Real (floating point)* Physical* Composite Array Record Access (pointers)* * Not.
Signals vs. Variables Workshop Fri/Sat Test bench creation Misc IP Cores Chipscope Pro When Demos due.
VHDL. What is VHDL? VHDL: VHSIC Hardware Description Language  VHSIC: Very High Speed Integrated Circuit 7/2/ R.H.Khade.
(1) Basic Input and Output © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
CPE 626 Advanced VLSI Design Lecture 3: VHDL Recapitulation Aleksandar Milenkovic
Reconfigurable Computing - VHDL - Types John Morris Chung-Ang University The University of Auckland.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
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.
Chapter 10: Structures and Sequential Access Files
ECE 368 CAD-Based Logic Design Shantanu Dutt Lecture 11 File I/O and Textio in VHDL (courtesy of Karam Chatha, ASU)
Chapter Ten Structures and Sequential Access Files Programming with Microsoft Visual Basic th Edition.
C++ for Engineers and Scientists Second Edition Chapter 8 I/O File Streams and Data Files.
Chapter 9 I/O Streams and Data Files
RTL Hardware Design by P. Chu Chapter Basic VHDL program 2. Lexical elements and program format 3. Objects 4. Data type and operators RTL Hardware.
Tutorial 9: Sequential Access Files and Printing1 Tutorial 9 Sequential Access Files and Printing.
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.
An Introduction to Programming with C++ Sixth Edition Chapter 14 Sequential Access Files.
CPE 626 Advanced VLSI Design Lecture 4: VHDL Recapitulation (Part 2) Aleksandar Milenkovic
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Digital Logic Design.
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 13 File Input and.
1 VLSI Design & Reconfigurable Computing ENG*6090(3) Advanced Topics in VHDL Stephen Coe Guangfa Lu Friday, March 07, 2003.
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.
VHDL Basics. VHDL BASICS 2 OUTLINE –Component model –Code model –Entity –Architecture –Identifiers and objects –Operations for relations VHDL ET062G &
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
L13 – VHDL Language Elements. VHDL Language Elements  Elements needed for FPGA design Types  Basic Types  Resolved Types – special attributes of resolved.
Lecture #7 Page 1 Lecture #7 Agenda 1.VHDL Data Types Announcements 1.n/a ECE 4110– Digital Logic Design.
C++ Basics. Compilation What does compilation do? g++ hello.cpp g++ -o hello.cpp hello.
Chapter 5 Introduction to VHDL. 2 Hardware Description Language A computer language used to design circuits with text-based descriptions of the circuits.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Files Tutor: You will need ….
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Input and Output.
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.
Advanced FPGA Based System Design Lecture-6 & 7 VHDL Data Types By: Dr Imtiaz Hussain 1.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Slide 1 3.VHDL/Verilog Description Elements. Slide 2 To create a digital component, we start with…? The component’s interface signals Defined in MODULE.
Lecture #8 Page 1 Lecture #8 Agenda 1.VHDL : Operators 2.VHDL : Signal Assignments Announcements 1.HW #4 assigned ECE 4110– Sequential Logic Design.
Modern Digital System Design Using VHDL: A Practical Introduction Subprograms & Packages Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd.
Simple Java I/O Part I General Principles. Streams All modern I/O is stream-based A stream is a connection to a source of data or to a destination for.
Chapter 8. Additional Topics in VHDL 권동혁.
Chapter 9: Data types and data structures OCR Computing for A Level © Hodder Education 2009.
Chapter 14: Sequential Access Files
Basic Language Concepts
Subject Name: FUNDAMENTALS OF HDL Subject Code: 10EC45
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
I/O Basics.
CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
CPE 626 Advanced VLSI Design Lecture 2: VHDL Recapitulation Aleksandar Milenkovic
ECE 434 Advanced Digital System L17
CPE/EE 422/522 Advanced Logic Design L15
An Introduction to Java – Part I, language basics
CPE/EE 422/522 Advanced Logic Design L14
Today’s Lecture I/O Streams Tools for File I/O
File I/O in C Lecture 7 Narrator: Lecture 7: File I/O in C.
Fundamentals of Python: First Programs
CIS16 Application Development and Programming using Visual Basic.net
VHDL Data Types Module F3.1.
Data Types Each data object has a type associated with it.
EEL4712 Digital Design (VHDL Tutorial).
Presentation transcript:

VHDL Files & Text IO ECE4623/5623 Computer Hardware Design

VHDL Files and TEXTIO File Declaration: file file-name: file-type [open mode] is "file-pathname"; Example: file test_data: text open read_mode is "c:\test1\test.dat" -declares a file named test_data of type text which is opened in the read mode. The physical location of the file is in the test1 directory on the c: drive. Modes for Opening a File: read_mode file elements can be read using a read procedure write_mode new empty file is created; elements can be written using a write procedure append_mode allows writing to an existing file File Types: A file can contain only one type of object as specified by the file type. Example: type bv_file is file of bit_vector; -defines bv_file to be a file type which can only contain bit_vectors Endfile Function: endfile(file_name) -returns TRUE if the file pointer is at the end of the file

VHDL Standard TEXTIO Package · contains declarations and procedures for working with files composed of lines of text. · defines a file type named text: type text is file of string; · contains procedures for reading lines of text from a file of type text and for writing lines of text to a file. Procedure readline reads a line of text and places it in a buffer with an associated pointer. The pointer to the buffer must be of type line, which is declared in the textio package as: type line is access string; When a variable of type line is declared, it creates a pointer to a string. The code variable buff: line;... readline (test_data, buff); reads a line of text from test_data and places it in a buffer which is pointed to by buff. To extract data from the line buffer, call a read procedure one or more times. For example, if bv4 is a bit_vector of length four, the call read(buff, bv4) extracts a 4-bit vector from the buffer, sets bv4 equal to this vector, and adjusts the pointer buff to point to the next character in the buffer. Another call to read will then extract the next data object from the line buffer.

VHDL TEXTIO Package package TEXTIO is -- Type Definitions for Text I/O type LINE is access STRING; -- a LINE is a pointer to a STRING value type TEXT is file of STRING; -- a file of variable-length ASCII records type SIDE is (RIGHT, LEFT); -- for justifying output data w/in fields subtype WIDTH is NATURAL; -- for specifying widths of output fields -- Standard Text Files file INPUT: TEXT open read_mode is "STD_INPUT"; file OUTPUT: TEXT open write_mode is "STD_OUTPUT"; -- Input Routines for Standard Types procedure READLINE (file F: TEXT; L: out LINE); procedure READ (L: inout LINE; VALUE: out BIT; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out BIT); procedure READ (L: inout LINE; VALUE: out BIT_VECTOR; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out BIT_VECTOR); procedure READ (L: inout LINE; VALUE: out BOOLEAN; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out CHARACTER; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out CHARACTER); procedure READ (L: inout LINE; VALUE: out INTEGER; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out INTEGER); procedure READ (L: inout LINE; VALUE: out REAL; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out REAL); procedure READ (L: inout LINE; VALUE: out STRING; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out STRING); procedure READ (L: inout LINE; VALUE: out TIME; GOOD: out BOOLEAN); procedure READ (L: inout LINE; VALUE: out TIME);

TEXTIO Package (Cont.) -- Output Routines for Standard Types procedure WRITELINE (file F: TEXT; L: inout LINE); procedure WRITE (L: inout LINE; VALUE: in BIT; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0); procedure WRITE (L: inout LINE; VALUE: in BIT_VECTOR; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0); procedure WRITE (L: inout LINE; VALUE: in BOOLEAN; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0); procedure WRITE (L: inout LINE; VALUE: in CHARACTER; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0); procedure WRITE (L: inout LINE; VALUE: in INTEGER; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0); procedure WRITE (L: inout LINE; VALUE: in REAL; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0; DIGITS: in NATURAL:= 0); procedure WRITE (L: inout LINE; VALUE: in STRING; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0); procedure WRITE (L: inout LINE; VALUE: in TIME; JUSTIFIED: in SIDE:= RIGHT; FIELD: in WIDTH := 0; UNIT: in TIME:= ns); end package TEXTIO;

Using VHDL TextIO Include the library statement: use STD.TEXTIO.ALL; File statements: File test_file : text open read_mode is "test2.txt"; File results: text open write_mode is "results1.txt"; In a test bench process: VARIABLE TX_OUT : LINE; -- This is already in the test bench for output VARIABLE L_In : line; For input, read in an input record, then each field: readline(test_file, L_In); -- read the line read(L_In, Intval, good => goodval); -- goodval is boolean if not goodval then assert (false) report “Bad Value” severity Failure; end if; AA := Conv_Std_Logic_Vector(Intval, 16); -- AA is a variable (15 d.t. 0) For output, write each field, then the line: write(TX_OUT, IntVal); -- Intval is an integer write(TX_OUT, string'(",")); -- separate values with commas for import into Excel writeline(results1, TX_OUT); -- write the line