Mridula Allani Fall Fall

Similar documents
VHDL Examples Mohamed Zaky

UNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :

Review. LIBRARY list of library names; USE library.package.object; ENTITY entity_name IS generic declarations PORT ( signal_name(s): mode signal_type;

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

Hardware Description Language VHDL (1) Introduction

Basic Language Concepts

Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification

Concurrent Signal Assignment Statements (CSAs)

VHDL for FPGA Design. by : Mohamed Samy

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

DOD, VHSIC ~1986, IEEE stnd 1987 Widely used (competition Verilog) Commercial VHDL Simulators, Synthesizers, Analyzers,etc Student texts with CDROMs

2/14/2016. Hardware Synthesis. Midia Reshadi. CE Department. Entities, Architectures, and Coding.

What Is VHDL? VHSIC (Very High Speed Integrated Circuit) Hardware Description Language IEEE 1076 standard (1987, 1993)

Hardware Description Languages. Modeling Complex Systems

Declarations of Components and Entities are similar Components are virtual design entities entity OR_3 is

VHDL Basics. Mehdi Modarressi. Department of Electrical and Computer Engineering, University of Tehran. ECE381(CAD), Lecture 4:

310/ ICTP-INFN Advanced Tranining Course on FPGA and VHDL for Hardware Simulation and Synthesis 27 November - 22 December 2006

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

Digital Systems Design

Module 2.1 Gate-Level/Structural Modeling. UNIT 2: Modeling in Verilog

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

VHDL HIERARCHICAL MODELING

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

VHDL VS VERILOG.

Computer-Aided Digital System Design VHDL

Lecture 4. VHDL Fundamentals. George Mason University

Advanced Training Course on FPGA Design and VHDL for Hardware Simulation and Synthesis. 26 October - 20 November, 2009

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 4 Introduction to VHDL

1. Defining and capturing the design of a system. 2. Cost Limitations (low profit margin must sell millions)

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

CMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi

C-Based Hardware Design

Lattice VHDL Training

Lecture 4. VHDL Fundamentals. Required reading. Example: NAND Gate. Design Entity. Example VHDL Code. Design Entity

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

Modeling Complex Behavior

EE261: Intro to Digital Design

Tutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy

Review of Digital Design with VHDL

Digital Systems Design

-- Fill in values for each generic. -- Fill in values for each signal. SIGNAL load_start : std_ulogic := '1'; SIGNAL clock : std_ulogic := '0';

Constructing VHDL Models with CSA

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Introduction to VHDL #1

EITF35: Introduction to Structured VLSI Design

CDA 4253 FPGA System Design Introduction to VHDL. Hao Zheng Dept of Comp Sci & Eng USF

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

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

In our case Dr. Johnson is setting the best practices

VHDL 3 BASIC OPERATORS AND ARCHITECTURE BODY. Design descriptions & design constructions examples are taken from foundation series examples

VHDL: A Crash Course

Field Programmable Gate Array

6.111 Lecture # 5. Entity section describes input and output. VHDL: Very High speed integrated circuit Description Language:

Architecture des Ordinateurs I

Lecture 4. VHDL Basics. Simple Testbenches

Contents. Appendix D VHDL Summary Page 1 of 23

A bird s eye view on VHDL!

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

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

Advanced Electronics Lab.

VHDL is a hardware description language. The code describes the behavior or structure of an electronic circuit.

EECE-4740/5740 Advanced VHDL and FPGA Design. Lecture 3 Concurrent and sequential statements

Introduction to VHDL. Main language concepts

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

Lecture 3 Introduction to VHDL

Introduction to the VHDL language. VLSI Digital Design

Embedded Systems CS - ES

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

ECE4401 / CSE3350 ECE280 / CSE280 Digital Design Laboratory

LECTURE 4: The VHDL N-bit Adder

Sudhakar Yalamanchili, Georgia Institute of Technology, 2006

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

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

Introduction to VHDL Based on Altera s Tutorial. Computer Architecture. Prof. Erivelton G. Nepomuceno

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

Experiment 8 Introduction to VHDL

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

EE434 ASIC & Digital Systems

Introduction to VHDL

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

Building Blocks. Entity Declaration. Entity Declaration with Generics. Architecture Body. entity entity_name is. entity register8 is

ENGIN 241 Digital Systems with Lab

Digital Systems Design

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)

Tutorial on VHDL and Verilog Applications

EEL 4712 Digital Design Test 1 Spring Semester 2008

EE 595. Part II Design Units in VHDL. EE 595 EDA / ASIC Design Lab

Introduction to VHDL #3

ACS College of Engineering. Department of Biomedical Engineering. Logic Design Lab pre lab questions ( ) Cycle-1

VHDL Objects. Lecture 8: VHDL (2) Variables. VHDL Objects - Constant. Files. EE3109 Gopi K. Manne Fall 2007

Menu. Introduction to VHDL EEL3701 EEL3701. Intro to VHDL

Test Benches - Module 8

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

ELCT 501: Digital System Design

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

EEL 4783: Hardware/Software Co-design with FPGAs

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

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

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

Transcription:

Mridula Allani Fall 2010 Fall 2010 1

Model and document digital systems Hierarchical models System, RTL (Register Transfer Level), gates Different levels of abstraction Behavior, structure Verify circuit/system design via simulation Synthesize circuits from HDL models ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 2

VHDL = VHSIC Hardware Description Language (VHSIC = Very High Speed Integrated Circuits) Developed by DOD from 1983 based on ADA IEEE Standard 1076-1987/1993/200x Based on the ADA language Verilog created in 1984 by Philip Moorby of Gateway Design Automation (merged with Cadence) IEEE Standard 1364-1995/2001/2005 Based on the C language IEEE P1800 System Verilog in voting stage & will be merged with 1364 ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 3

Entity describes the external view of a design/component Architecture describes the internal behavior/structure of the component Example: 1-bit full adder A B Full Adder Sum Cin Cout ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 4

External view comprises input/output signals ( ports ) A port is defined by its signal name, direction and type: port_name: direction data_type; direction: in - driven into the entity from an external source out - driven from within the entity inout - bidirectional drivers within the entity and external data_type: any scalar or aggregate signal type ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 5

Type std_logic data values: U, X uninitialized/unknown 0, 1 strongly-driven 0/1 L, H weakly-driven 0/1 (resistive) Z, W - strong/weak floating - - don t care Type std_logic_vector is array of std_logic Include package: library IEEE; use IEEE.std_logic_1164.all; ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 6

ENTITY entity_name IS GENERIC (optional) (generic_name: type :=default_value; generic_name: mode signal_type); PORT (signal_name: mode signal_type; signal_name: mode signal_type); END ENTITY entity_name; ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 7

A B Full Adder Sum Cin ENTITY Full_adder IS PORT ( -- I/O ports a: IN STD_LOGIC; -- a input b: IN STD_LOGIC; -- b input cin: IN STD_LOGIC; -- carry input sum: OUT STD_LOGIC; -- sum output cout: OUT STD_LOGIC); -- carry output END Full_adder ; Cout ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 8

ARCHITECTURE architecture_name OF entity_name IS -- data type definitions (ie, states, arrays, etc.) -- internal signal declarations -- component declarations -- function and procedure declarations -- behavior of the model is described here using: -- component instantiations -- concurrent statements -- processes END ARCHITECTURE architecture_name; ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 9

ARCHITECTURE dataflow OF Full_adder IS sum <= a xor b xor cin; cout <= (a and b) or (a and cin) or (b and cin); END dataflow; ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 10

ARCHITECTURE structure OF Full_adder IS COMPONENT xor IS -- declare component to be used PORT (x,y: IN BIT; z: OUT BIT); END COMPONENT xor; SIGNAL x1: bit; -- signal internal to this component G1: xor PORT MAP (A, B, X1); -- instantiate 1 st xor gate G2: xor PORT MAP (X1, Cin, Sum); -- instantiate 2 nd xor gate add circuit for carry output END structure; A Cin X1 Sum ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 11

ARCHITECTURE structural OF Full_adder IS COMPONENT half_adder PORT(a,b : IN STD_LOGIC; sum, carry : OUT STD_LOGIC); END COMPONENT; COMPONENT or_2 PORT(a,b : IN STD_LOGIC; c : OUT STD_LOGIC); END COMPONENT; SIGNAL s1, s2, s3 : STD_LOGIC; H1: half_adder port map(a=>in1, b=>in2, sum=>s1, carry=>s3); H2: half_adder port map(a=>s1, b=>c_in, sum=>sum, carry=>s2); O1: or_2 port map(a=> s2, b=>s3, c=>c_out); END structural; ENTITY half_adder IS PORT (a,b : IN BIT ; sum,carry : OUT BIT); END half_adder; ARCHITECTURE dataflow OF half_adder IS sum<= a xor b; carry <= a and b; END dataflow; ENTITY or_2 IS PORT (a,b : IN BIT ; c : OUT BIT); END or_2; ARCHITECTURE dataflow OF or_2 IS c<= a or b; END dataflow; Fall 2010 12

library ieee; use ieee.std_logic_1164.all; ENTITY adder_4bit IS PORT (a, b: IN STD_LOGIC_VECTOR(3 DOWNTO 0); Cin : IN STD_LOGIC; sum: OUT STD_LOGIC_VECTOR (3 DOWNTO 0); Cout: OUT STD_LOGIC); END adder_4bit; ARCHITECTURE structural OF adder_4bit IS SIGNAL c: STD_LOGIC_VECTOR (4 DOWNTO 0); FA0: Full_adder PORT MAP (a(0), b(0), Cin, sum(0), c(1)); FA1: Full_adder PORT MAP (a(1), b(1), C(1), sum(1), c(2)); FA2: Full_adder PORT MAP (a(2), b(2), C(2), sum(2), c(3)); FA3: Full_adder PORT MAP (a(3), b(3), C(3), sum(3), c(4)); Cout <= c(4); END structural; COMPONENT Full_adder PORT(a, b, c: IN STD_LOGIC; sum, carry: OUT STD_LOGIC); END COMPONENT; Fall 2010 13

ARCHITECTURE behavioral OF Full_adder IS Sum: PROCESS(a, b, cin) sum <= a xor b xor cin; END PROCESS Sum; Carry: PROCESS(a, b, cin) cout <= (a and b) or (a and cin) or (b and cin); END PROCESS Carry; END behavioral; ARCHITECTURE behavioral OF Full_adder IS PROCESS(a, b, cin) sum <= a xor b xor cin; cout <= (a and b) or (a and cin) or (b and cin); END PROCESS; END behavioral; Fall 2010 14

Allows conventional programming language methods to describe circuit behavior Supported language constructs ( sequential statements ) only allowed within a process: variable assignment if-then-else (elsif) case statement while (condition) loop for (range) loop ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 15

[label:] process (sensitivity list) declarations begin sequential statements end process; Process statements executed once at start of simulation Process halts at end until an event occurs on a signal in the sensitivity list ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 16

ENTITY dff IS PORT (d,clk: IN STD_LOGIC; q: OUT STD_LOGIC); END dff; ARCHITECTURE behavioral OF dff IS PROCESS(clk) -- process sensitivity list IF (clk event and clk= 1 ) THEN q <= d after 1 ns; END IF; END PROCESS; END behavioral; Process statements executed sequentially (sequential statements) clk event is an attribute of signal clk which is TRUE if an event has occurred on clk at the current simulation time D CLK Q ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 17

ENTITY dff IS PORT (d,clk: IN STD_LOGIC; q: OUT STD_LOGIC); END dff; D ARCHITECTURE behavioral OF dff IS CLK PROCESS -- no sensitivity list WAIT ON clk; -- suspend process until event on clk IF (clk= 1 ) THEN q <= d AFTER 1 ns; END IF; END PROCESS; END behavioral; Other wait formats: WAIT UNTIL (clk event and clk= 1 ) WAIT FOR 20 ns; Process executes endlessly if no sensitivity list or wait statement! ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 18 Q

if-then-elsif-else statement if condition then (... sequence of statements...) elsif condition then (... sequence of statements...) else (... sequence of statements...) end if; case statement case expression is when choices => sequence of statements when choices => sequence of statements... when others => sequence of statements end case; ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 19

while loop [label:] while condition loop... sequence of statements... end loop [label]; for loop [label:] for loop_variable in range loop... sequence of statements... end loop [label]; ELEC 5200-001/6200-001 Lecture 2 Fall 2010 (from Prof. Nelson's and Prof. Stroud's course material) 20

ARCHITECTURE functional OF Full_adder IS PROCESS(A,B,Cin) If (Cin = '0' and A = '0' and B = '0' ) then sum<= '0'; Cout <= '0'; elsif(cin = '0' and A = '0' and B = '1') then sum <= '1' ; Cout <= '0'; elsif(cin = '0' and A = '1' and B = '0' ) then sum <= '1' ; Cout <= '0'; elsif(cin = '0' and A = '1' and B = '1' ) then sum<= '0'; Cout <= '1'; elsif(cin = '1' and A = '0' and B = '0' ) then sum <= '1' ; Cout <= '0'; elsif(cin = '1' and A = '0' and B = '1' ) then sum<= '0'; Cout <= '1'; elsif(cin = '1' and A = '1' and B = '0' ) then sum<= '0'; Cout <= '1'; elsif(cin = '1' and A = '1' and B = '1' ) then sum <= '1' ; Cout <= '1'; else sum <= 'X' ; Cout <= 'X'; end if; END PROCESS; END functional; Fall 2010 21

ENTITY counter_4bit IS PORT(Ld, Clr, Clk: IN STD_LOGIC; D: IN STD_LOGIC_VECTOR (3 DOWNTO 0); Cout: OUT STD_LOGIC; Qout: OUT STD_LOGIC_VECTOR (3 DOWNTO 0)); END counter_4bit; ARCHITECTURE behavioral OF counter_4bit IS SIGNAL Q: STD_LOGIC_VECTOR(3 DOWNTO 0); Qout <= Q; Cout <= Q(3) and Q(2) and Q(1) and Q(0); PROCESS(Clk) IF Clk'event and Clk = '1' THEN IF Clr = '0' THEN Q <= "0000"; ELSIF Ld = '0' THEN Q <= D; ELSE Q <= Q + 1; END IF; END IF; END PROCESS; END behavioral; Fall 2010 22

VHDL mini-reference on Prof. Nelson s website http://www.eng.auburn.edu/department/ee/mgc/vhdl.html VHDL resources on Prof. Stroud s website http://www.eng.auburn.edu/~strouce/elec4200.html http://esd.cs.ucr.edu/labs/tutorial/ http://www.seas.upenn.edu/~ese201/vhdl/vhdl_primer.html#_ Toc526061344 http://www.vhdl.org/ http://www.doulos.com/knowhow/vhdl_designers_guide/ http://www.altera.com/support/examples/vhdl/vhdl.html http://www.vhdl-online.de/tutorial/ http://www.people.vcu.edu/~rhklenke/tutorials/vhdl/module s/m12_23/sld006.htm Fall 2010 23

Modelsim PE (Student Edition) can be downloaded from http://model.com/content/modelsim-pestudent-edition-hdlsimulation?quicktabs_4=1#quicktabs-4 Modelsim is installed on the Windows7 platform in Lab 310, Broun Hall. Fall 2010 24

Fall 2010 25

Fall 2010 26

Fall 2010 27

Fall 2010 28

Fall 2010 29

Fall 2010 30

Fall 2010 31

Fall 2010 32

Fall 2010 33

Fall 2010 34

Fall 2010 35

Fall 2010 36

Fall 2010 37

Fall 2010 38