INTRO TO VLSI DESIGN (CPE 448) (VHDL Tutorial ) Prof: Asuif Mahmood.

Slides:



Advertisements
Similar presentations
1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
Advertisements

Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Sequential Statements Module F3.2. Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements.
VHDL Data Types Module F3.1. VHDL Data Types Scalar Integer Enumerated Real (floating point)* Physical* Composite Array Record Access (pointers)* * Not.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Sistemas Digitais I LESI - 2º ano Lesson 5 - VHDL U NIVERSIDADE DO M INHO E SCOLA DE E NGENHARIA Prof. João Miguel Fernandes Dept.
ELEN 468 Lecture 191 ELEN 468 Advanced Logic Design Lecture 19 VHDL.
Topics of Lecture Structural Model Procedures Functions Overloading.
CSCI 660 EEGN-CSCI 660 Introduction to VLSI Design Lecture 3 Khurram Kazi Some of the slides were taken from K Gaj ’ s lecture slides from GMU ’ s VHDL.
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.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Introduction to VHDL (part 2)
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 Part V: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
VHDL TUTORIAL Preetha Thulasiraman ECE 223 Winter 2007.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
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.
ECE 368 CAD-Based Logic Design Shantanu Dutt Lecture 11 File I/O and Textio in VHDL (courtesy of Karam Chatha, ASU)
7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design.
Digital Design with VHDL Presented by: Amir Masoud Gharehbaghi
Subprograms Procedures, functions. Subprograms subprogram_body
Execution of an instruction
Packages and Use Clauses Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
1 ECE 545 – Introduction to VHDL Dataflow Modeling of Combinational Logic Simple Testbenches ECE 656. Lecture 2.
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.
VHDL Very High Speed Integrated Circuit Hardware Description Language Shiraz University of shiraz spring 2011.
Topic 3: VHDL José Nelson Amaral Paul Berube Paras Mehta
Topics AliasesSubprograms Generics & Configurations.
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Sequential statements. If statement [if_label:] if boolean_expression then {sequential_statement} {elsif boolean_expression then {sequential_statement}}
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
(1) Identifiers, Data Types, and Operators © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
Aliases Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
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.
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.
Digital System Projects
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
© 조준동 2008 ECE C03 Lecture 121 Lecture 12 Introduction to VHDL Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Subprograms Lecture 6. Subprograms A subprogram defines a sequential algorithm that performs some computations. Subprograms can be: –1. functions –2.
Scalar Data Types and Operations 大同大學 資訊工程系 副教授 鄭福炯
Subprograms Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
Relational Operators Result is boolean: greater than (>) less than (=) less than or equal to (
55:032 - Intro. to Digital DesignPage 1 VHDL and Processes Defining Sequential Circuit Behavior.
Computer Organization Instructions Language of The Computer (MIPS) 2.
VHDL Tutorial.
Case Study: Xilinx Synthesis Tool (XST). Arrays & Records 2.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
1 Introduction to Engineering Spring 2007 Lecture 19: Digital Tools 3.
Introduction To VHDL 홍 원 의.
Basic Language Concepts
Sequential Design.
The Processor and Machine Language
CPE 528: Session #7 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
CSCE Fall 2013 Prof. Jennifer L. Welch.
IAS 0600 Digital Systems Design
VHDL Discussion Subprograms
CPE 528: Lecture #3 Department of Electrical and Computer Engineering University of Alabama in Huntsville.
VHDL Discussion Subprograms
IAS 0600 Digital Systems Design
CSCE Fall 2012 Prof. Jennifer L. Welch.
Data Types Each data object has a type associated with it.
4-Input Gates VHDL for Loops
Presentation transcript:

INTRO TO VLSI DESIGN (CPE 448) (VHDL Tutorial ) Prof: Asuif Mahmood

FILES and INPUT/OUTPUT  Files can be used to store data to be loaded into a model when it is run, or to store the results produced by simulation.  VHDL also provides specialized versions of file operations for working with text files.  VHDL provides sequential access to files using operations, such as “open”, “close”, “read” and “write”, that are familiar to users of conventional programming languages.  File Declarations: file identifier{,… }: subtype_indication [[ open file_open_kind_expression ] is string_expression]

Reading from Files  If a file is opened in a read mode, successive elements of data are read from the file using the read operation.  Reading starts from the first element in the file, and each time an element is read the file position advances to the next element.  We can use the endfile operation to determine when we have read the last element in the file. Syntax: type file_type is file of element_type; read and endfile operations are implicitly declared as procedure read ( file f : file_type; value : out element_type); function endfile ( file f : file_type) return boolean;

Reading from Files (Example) Library ieee; Use ieee.std_logic_1164.all; entity ROM is generic (load_file_name:string); port( sel:in std_logic; address:in std_logic_vector; data:in std_logic_vector); end entity ROM; architecture behavioral of ROM is begin behavior :process is subtype word is std_logic_vector( o to data’length – 1); type storage_array is array (natural range 0 to 2**address’length –1 ) of word; variable storage : storage_array; variable index : natural; --other declarations type load_file_type is file of word; file load_file: load_file_type open read_mode is load_file_name; begin --load ROM contents from load_file index := 0; while not endfile (load_file) loop read ( load_file, storage(index)); index := index + 1; end loop; --respond to ROM accesses loop --- other instructions end loop; end process behavior; end architecture behavioral;

Writing to Files  If a file is open in write mode, a new empty file is created in the host computer’s file system, and successive data elements are added using the write operation.  implicitly declared as procedure write ( file f : file_type; value : in element_type);

Writing to Files (Example) architecture instrumented of CPU is type count_file is file of natural; file instruction_counts: count_file open write_mode is “instructions”; begin interpreter :process is variable IR : word; alias opcode : byte is IR(0 to 7); variable IR : word; type counter_array is array (0 to 2**address’length –1 ) of natural; variable counters : counter_array:=(others =>0); begin --initialize the instruction set interpreter instruction_loop: loop --fetch the next instruction into IR --decode the instruction opcode_number := convert_to_natural(opcode); counters(opcode_number) := counters(opcode_number)+1; -- execute the decoded instruction case opcode is when halt_opcode => exit instruction_loop; end case; end loop instruction_loop; for index in counters’range loop write (instruction_counts, counters(index)); end loop; wait; -- program finished, wait forever end process interpreter; end architecture instrumented;

Scalar Data Types and Operations  The concept of type is very important when describing data in a VHDL model.  The type of a data object defines the set of values that the object defines the set of values that the object can assume, as well as the set of operations that can be performed on those values.  A scalar type consists of single, indivisible values.

CONSTANTS and VARIABLES  Both constants and variables need to be declared before they can be used in a model.  A declaration simply introduces the name of the object, defines its type and may give it an initial value. constant number_of_bytes : integer := 4; constant number_of_bits : integer := 8*number_of_bytes; constant e : real := ; constant prop_delay : time := 3 ns; variable index: integer := 0; variable start, finish : time := 0 ns;

CONSTANTS and VARIABLES (cont.)  Example:  One restriction on where a variable declaration may occur is that it may not be placed so that the variable would be accessible to more than one process.  The exception to this rule is if a variable is declared specially as shared variable. architecture sample of ent is constant pi : real : begin process is variable counter : integer; begin --do anything end process; end architecture sample;

SCALAR TYPES  A scalar type is one whose value are indivisible.  type apples is range 0 to 100;  type oranges is range 0 to 100; package int_types is type small_int is range 0 to 255; end package int_types; use work.int_types.all; entity smaller_adder is port ( a, b :in small_int; s:out small_int); end entity small_adder;

INTEGER TYPES  A predefined type integer is included, which includes all whole numbers representable on a particular host computer. type day_of_month is range 0 to 31; type year is range 0 to 2100; variable today: day_of_month := 19; variable start_year: year := 2002; **It is illegal to make the assignment: start_year := today;

FLOATING-POINT TYPES type INPUT_LEVEL is range –10.0 to 10.0; type probability is range 0.0 to 1.0; variable input_A: input_level;

PHYSICAL TYPES  Examples: type resistance is range 0 to 1E9 units ohm; kohm=1000ohm; Mohm=1000kohm; end units resistance; **We can use them as5 ohm22 ohm4kohm type time is range implementation defined units fs; ps=1000fs; ns=1000ps; us=1000ns; ms=1000us; sec=1000ms; min=60sec; hr=60min; end units time;

ENUMERATION TYPES type alu_function is (disable, pass, add, subtract, multiply, divide); type octal_digit is ( ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’‘,7’); variable alu_op: alu_function; variable last_digit: octal_digit := ‘0’; and make assignments to them: alu_op := subtract; last_digit :=‘7’;

Subprograms  When we write complex behavioral models it is useful to divide the code into sections, each dealing with a relatively self- contained part of the behavior.  There are two kinds of subprograms: procedures and functions.  Procedure encapsulates a collection of sequential statements that are executed for their effect.  Function encapsulates a collection of statements that compute a result.  Thus a procedure is a generalization of a statement, whereas a function is a generalization of an expression.

PROCEDURES  There are two aspects to using procedures in a model:  First the procedure is declared.  Then elsewhere the procedure is called. procedure identifier [ (parameter_interface_list) ] is { subprogram_declarative_part } begin { sequential_statement } end procedure [ identifier ];

PROCEDURES (Example) procedure addu ( a, b : in word32; result:out word32; overflow:out Boolean ) is variable sum: word32; variable carry: bit := ‘0’; begin for index in sum’reverse_range loop sum(index):=a(index) xor b(index) xor carry; carry:=(a(index) and b(index) ) or (carry and (a(index) xor b(index) ) ); end loop; result:=sum; overflow:=carry = ‘1’; end procedure addu; **A call to this procedure may appear as follows: variable PC, next_PC: word32; variable overflow_flag: boolean; addu ( PC, X”0000_0004”,next_PC, overflow_flag);

FUNCTIONS  The syntax rule for a function declaration is very similar to that for a procedure declaration: function identifier [ (parameter_interface_list) ] return type_mark is { subprogram_declarative_part } begin { sequential_statement } end function [ identifier ];

FUNCTIONS  Call to this function might be included in a variable assignment statement, as follows: new_temperature := limit ( current_temperature + increment, 10,100); function limit ( value, min, max : integer) return integer is begin if value > max then return max; elsif value < min then return min; else return value; end if; end function limit;

Package  A VHDL package is simply a way of grouping a collection of related declarations that serve a common purpose.  They might be a set of subprograms that provide operations on a particular type of data.  Or they might just be the set of declarations needed to model a particular design.  The important thing is that they can be collected together into a separate design unit that can be worked on independently and reused in different parts of a model. package identifier is { package_declarative_item } begin { sequential_statement } end package [ identifier ];

Package (Example) package cpu_types is constant word_size : positive:= 16; constant address_size : positive:= 24; subtype word is bit_vector (word_size-1 downto 0); subtype address is bit_vector (address_size-1 downto 0); type status_value is (halted, idle, fetch, mem_read, read, mem_write, io_read, io_write, int_ack); subtype opcode is bit_vector (5 downto 0); function extract_opcode (instr_word: word) return opcode; constant op_nop : opcode:= “000000”; constant op_breq : opcode:= “000001”; constant op_brne : opcode:= “000010”; constant op_add : opcode:= “000011”; end package cpu_types;

Package (Example) entity address_decoder is port ( addr: inwork.cpu_type.address; status: inwork.cpu_type.status_value; mem_sel, int_sel, io_sel: out bit); end entity address_decoder; architecture behavioral of cpu is -- define constant mem_low: work.cpu_type.address:=X”000000”; begin interpreter : process is variable instr_reg :work.cpu_types.word; variable instr_opcode : work.cpu_types.opcode; begin -- initialize loop -- fetch instruction instr_opcode:= work.cpu_types.extract_opcode( instr_reg): case instr_opcode is when work.cpu_types.op_nop => null; when work.cpu_types.op_breq => null; end case; end loop; end process interpreter; end architecture behavioral;