1 Part I: SYSTEM DESIGN. 2 Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs.

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

Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
History TTL-logic PAL (Programmable Array Logic)
Arbitrary Waveform Discussion 5.5 Example 34.
Arithmetic Logic Unit (ALU)
Multiplexer as a Universal Element Discussion D2.6 Example 9.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Top-level VHDL Designs
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
Structural VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T3: ALU Design.
4-to-1 Multiplexer: case Statement Discussion D2.3 Example 6.
Introduction to VHDL Multiplexers Discussion D1.1.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
1 Part II: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Behavioral & Structural.
L23 – Arithmetic Logic Units. Arithmetic Logic Units (ALU)  Modern ALU design  ALU is heart of datapath  Ref: text Unit 15 9/2/2012 – ECE 3561 Lect.
AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’.
1 Data Object Object Types A VHDL object consists of one of the following: –Signal, Which represents interconnection wires that connect component instantiation.
1 H ardware D escription L anguages Basic Language Concepts.
ECE 332 Digital Electronics and Logic Design Lab Lab 5 VHDL Design Styles Testbenches.
Data Flow Modeling of Combinational Logic Simple Testbenches
ENG6090 RCS1 ENG6090 Reconfigurable Computing Systems Hardware Description Languages Part 4: Modeling Dataflow.
1 Part I: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
DSD,USIT,GGSIPU1 Entity declaration –describes the input/output ports of a module entity reg4 is port ( d0, d1, d2, d3, en, clk : in std_logic; q0, q1,
Figure 5.1 Conversion from decimal to binary. Table 5.1 Numbers in different systems.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #17 – Introduction.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
ENG241 Digital Design Week #4 Combinational Logic Design.
VHDL in 1h Martin Schöberl. AK: JVMHWVHDL2 VHDL /= C, Java,… Think in hardware All constructs run concurrent Different from software programming Forget.
L26 – Datapath ALU implementation
Basic Overview of VHDL Matthew Murach Slides Available at:
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
Introducing the Nexys 2 Board CS 332 – Operating Systems 12/04/2011 by Otto Castell-R.
Introduction to VHDL Spring EENG 2920 Digital Systems Design Introduction VHDL – VHSIC (Very high speed integrated circuit) Hardware Description.
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.
ECE 332 Digital Electronics and Logic Design Lab Lab 6 Concurrent Statements & Adders.
ECE 331 – Digital System Design Multiplexers and Demultiplexers (Lecture #13)
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
EE3A1 Computer Hardware and Digital Design Lecture 2 Introduction to VHDL.
2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.
4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5.
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.
George Mason University Data Flow Modeling in VHDL ECE 545 Lecture 7.
Digital System Projects
CS/EE 3700 : Fundamentals of Digital System Design
Data Flow Modeling in VHDL
VHDL ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
Lecture 8 Review Combinational Devices –Decoder –Multiplexor (Bhasker p-81) –Shifter –Barrel Shifter (Bhasker p-303)
George Mason University Data Flow Modeling of Combinational Logic ECE 545 Lecture 5.
EGRE 6311 LHO 04 - Subprograms, Packages, and Libraries EGRE 631 1/26/09.
Combinational logic circuit
Basic Language Concepts
Chapter 2. Introduction To VHDL
LIBRARY IEEE; Include Libraries for standard logic data types USE IEEE.STD_LOGIC_1164.ALL; -- Entity name normally the same as file name.
UNIT 2: Data Flow description
LIBRARY IEEE; Include Libraries for standard logic data types USE IEEE.STD_LOGIC_1164.ALL; -- Entity name normally the same as file name.
CHAPTER 10 Introduction to VHDL
Mano and Kime Sections 7-6 – 7-8
Getting Started with Vivado
VHDL Hardware Description Language
Data Flow Modeling of Combinational Logic
VHDL Structural Architecture
Concurrent vs Sequential
CprE / ComS 583 Reconfigurable Computing
4-Input Gates VHDL for Loops
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
Digital Logic with VHDL
Presentation transcript:

1 Part I: SYSTEM DESIGN

2 Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs

3 Packages and Components

4 PACKAGE PACKAGE package_name IS (declarations) END package_name; [PACKAGE BODY package_name IS (FUNCTION and PROCEDURE descriptions) END package_name;] PACKAGE package_name IS (declarations) END package_name; [PACKAGE BODY package_name IS (FUNCTION and PROCEDURE descriptions) END package_name;] 1.Code partitioning, 2.Code sharing, 3.and code reuse. 1.Code partitioning, 2.Code sharing, 3.and code reuse. Example: Simple Package LIBRARY ieee; 3 USE ieee.std_logic_1164.all; PACKAGE my_package IS 6 TYPE state IS (st1, st2, st3, st4); 7 TYPE color IS (red, green, blue); 8 CONSTANT vec: STD_LOGIC_VECTOR(7 DOWNTO 0) := " "; 9 END my_package; PACKAGE BODY is not necessary

5 Example: Package with a Function LIBRARY ieee; 3 USE ieee.std_logic_1164.all; PACKAGE my_package IS 6 TYPE state IS (st1, st2, st3, st4); 7 TYPE color IS (red, green, blue); 8 CONSTANT vec: STD_LOGIC_VECTOR(7 DOWNTO 0) := " "; 9 FUNCTION positive_edge(SIGNAL s: STD_LOGIC) RETURN BOOLEAN; 10 END my_package; PACKAGE BODY my_package IS 13 FUNCTION positive_edge(SIGNAL s: STD_LOGIC) RETURN BOOLEAN IS 14 BEGIN 15 RETURN (s'EVENT AND s='1'); 16 END positive_edge; 17 END my_package; LIBRARY ieee; USE ieee.std_logic_1164.all; USE work.my_package.all; ENTITY ARCHITECTURE LIBRARY ieee; USE ieee.std_logic_1164.all; USE work.my_package.all; ENTITY ARCHITECTURE

6 COMPONENT COMPONENT component_name IS PORT ( port_name : signal_mode signal_type;...); END COMPONENT; COMPONENT component_name IS PORT ( port_name : signal_mode signal_type;...); END COMPONENT; COMPONENT declaration: COMPONENT instantiation: label: component_name PORT MAP (port_list);

7 Example: Components Declared in the Main Code

File inverter.vhd: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY inverter IS 6 PORT (a: IN STD_LOGIC; b: OUT STD_LOGIC); 7 END inverter; ARCHITECTURE inverter OF inverter IS 10 BEGIN 11 b <= NOT a; 12 END inverter; File nand_2.vhd: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY nand_2 IS 6 PORT (a, b: IN STD_LOGIC; c: OUT STD_LOGIC); 7 END nand_2; ARCHITECTURE nand_2 OF nand_2 IS 10 BEGIN 11 c <= NOT (a AND b); 12 END nand_2; File nand_3.vhd: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY nand_3 IS 6 PORT (a, b, c: IN STD_LOGIC; d: OUT STD_LOGIC); 7 END nand_3; ARCHITECTURE nand_3 OF nand_3 IS 10 BEGIN 11 d <= NOT (a AND b AND c); 12 END nand_3;

File project.vhd: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY project IS 6 PORT (a, b, c, d: IN STD_LOGIC; 7 x, y: OUT STD_LOGIC); 8 END project; ARCHITECTURE structural OF project IS COMPONENT inverter IS 13 PORT (a: IN STD_LOGIC; b: OUT STD_LOGIC); 14 END COMPONENT; COMPONENT nand_2 IS 17 PORT (a, b: IN STD_LOGIC; c: OUT STD_LOGIC); 18 END COMPONENT; COMPONENT nand_3 IS 21 PORT (a, b, c: IN STD_LOGIC; d: OUT STD_LOGIC); 22 END COMPONENT; SIGNAL w: STD_LOGIC; 25 BEGIN 26 U1: inverter PORT MAP (b, w); 27 U2: nand_2 PORT MAP (a, b, x); 28 U3: nand_3 PORT MAP (w, c, d, y); 29 END structural;

10 Example: Components Declared in a Package File my_components.vhd: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; PACKAGE my_components IS inverter: COMPONENT inverter IS 8 PORT (a: IN STD_LOGIC; b: OUT STD_LOGIC); 9 END COMPONENT; input nand: COMPONENT nand_2 IS 12 PORT (a, b: IN STD_LOGIC; c: OUT STD_LOGIC); 13 END COMPONENT; input nand: COMPONENT nand_3 IS 16 PORT (a, b, c: IN STD_LOGIC; d: OUT STD_LOGIC); 17 END COMPONENT; END my_components; File project.vhd: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; 4 USE work.my_components.all; ENTITY project IS 7 PORT ( a, b, c, d: IN STD_LOGIC; 8 x, y: OUT STD_LOGIC); 9 END project; ARCHITECTURE structural OF project IS 12 SIGNAL w: STD_LOGIC; 13 BEGIN 14 U1: inverter PORT MAP (b, w); 15 U2: nand_2 PORT MAP (a, b, x); 16 U3: nand_3 PORT MAP (w, c, d, y); 17 END structural;

11 Example: ALU Made of COMPONENTS

COMPONENT arith_unit: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; 4 USE ieee.std_logic_unsigned.all; ENTITY arith_unit IS 7 PORT ( a, b: IN STD_LOGIC_VECTOR (7 DOWNTO 0); 8 sel: IN STD_LOGIC_VECTOR (2 DOWNTO 0); 9 cin: IN STD_LOGIC; 10 x: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)); 11 END arith_unit; ARCHITECTURE arith_unit OF arith_unit IS 14 SIGNAL arith, logic: STD_LOGIC_VECTOR (7 DOWNTO 0); 15 BEGIN 16 WITH sel SELECT 17 x <= a WHEN "000", 18 a+1 WHEN "001", 19 a-1 WHEN "010", 20 b WHEN "011", 21 b+1 WHEN "100", 22 b-1 WHEN "101", 23 a+b WHEN "110", 24 a+b+cin WHEN OTHERS; 25 END arith_unit; COMPONENT logic_unit: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY logic_unit IS 6 PORT ( a, b: IN STD_LOGIC_VECTOR (7 DOWNTO 0); 7 sel: IN STD_LOGIC_VECTOR (2 DOWNTO 0); 8 x: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)); 9 END logic_unit; ARCHITECTURE logic_unit OF logic_unit IS 12 BEGIN 13 WITH sel SELECT 14 x <= NOT a WHEN "000", 15 NOT b WHEN "001", 16 a AND b WHEN "010", 17 a OR b WHEN "011", 18 a NAND b WHEN "100", 19 a NOR b WHEN "101", 20 a XOR b WHEN "110", 21 NOT (a XOR b) WHEN OTHERS; 22 END logic_unit;

COMPONENT mux: LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY mux IS 6 PORT ( a, b: IN STD_LOGIC_VECTOR (7 DOWNTO 0); 7 sel: IN STD_LOGIC; 8 x: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)); 9 END mux; ARCHITECTURE mux OF mux IS 12 BEGIN 13 WITH sel SELECT 14 x <= a WHEN '0', 15 b WHEN OTHERS; 16 END mux; Project ALU (main code): LIBRARY ieee; 3 USE ieee.std_logic_1164.all; ENTITY alu IS 6 PORT ( a, b: IN STD_LOGIC_VECTOR(7 DOWNTO 0); 7 cin: IN STD_LOGIC; 8 sel: IN STD_LOGIC_VECTOR(3 DOWNTO 0); 9 y: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); 10 END alu; ARCHITECTURE alu OF alu IS COMPONENT arith_unit IS 15 PORT ( a, b: IN STD_LOGIC_VECTOR(7 DOWNTO 0); 16 cin: IN STD_LOGIC; 17 sel: IN STD_LOGIC_VECTOR(2 DOWNTO 0); 18 x: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); 19 END COMPONENT; COMPONENT logic_unit IS 22 PORT ( a, b: IN STD_LOGIC_VECTOR(7 DOWNTO 0); 23 sel: IN STD_LOGIC_VECTOR(2 DOWNTO 0); 24 x: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); 25 END COMPONENT; COMPONENT mux IS 28 PORT ( a, b: IN STD_LOGIC_VECTOR(7 DOWNTO 0); 29 sel: IN STD_LOGIC; 30 x: OUT STD_LOGIC_VECTOR(7 DOWNTO 0)); 31 END COMPONENT; SIGNAL x1, x2: STD_LOGIC_VECTOR(7 DOWNTO 0); BEGIN 36 U1: arith_unit PORT MAP (a, b, cin, sel(2 DOWNTO 0), x1); 37 U2: logic_unit PORT MAP (a, b, sel(2 DOWNTO 0), x2); 38 U3: mux PORT MAP (x1, x2, sel(3), y); 39 END alu;

14