Combinational Logic COMB. LOGIC BLOCK. A Combinational Logic Block is one where the outputs depend only on the current inputs

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

VHDL for FPGA Design. by : Mohamed Samy

ENGIN 241 Digital Systems with Lab

Lecture 4. VHDL Fundamentals. George Mason University

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

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

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

Introduction to VHDL #1

Lecture 3 Introduction to VHDL

VHDL Structural Modeling II

VHDL for Complex Designs

Hardware Description Language VHDL (1) Introduction

Very High Speed Integrated Circuit Har dware Description Language

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

Introduction to VHDL

Contents. Appendix D VHDL Summary Page 1 of 23

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

Review of Digital Design with VHDL

Hardware Modeling. VHDL Basics. ECS Group, TU Wien

C-Based Hardware Design

BASIC VHDL LANGUAGE ELEMENTS AND SEMANTICS. Lecture 7 & 8 Dr. Tayab Din Memon

Concurrent Signal Assignment Statements (CSAs)

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

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

Introduction to VHDL #3

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Digital Systems Design

Introduction to VHDL. Main language concepts

Control and Datapath 8

Chapter 6 Combinational-Circuit Building Blocks

Boolean Logic CS.352.F12

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 1

Basic Language Concepts

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

1 ST SUMMER SCHOOL: VHDL BOOTCAMP PISA, JULY 2013

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

Menu. Introduction to VHDL EEL3701 EEL3701. Intro to VHDL

Design units can NOT be split across different files

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Lecture 4. VHDL Basics. Simple Testbenches

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

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

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

Experiment 8 Introduction to VHDL

ELCT 501: Digital System Design

EEL 4783: Hardware/Software Co-design with FPGAs

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

Outline CPE 626. Advanced VLSI Design. Lecture 4: VHDL Recapitulation (Part 2) Signals. Variables. Constants. Variables vs.

IT T35 Digital system desigm y - ii /s - iii

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

Embedded Systems CS - ES

Lecture 3. VHDL Design Units and Methods. Entity, Architecture, and Components Examples of Combinational Logic Hands-on in the Laboratory

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

Lecture 3. VHDL Design Units and Methods. Notes. Notes. Notes

Hardware description languages

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

Entity, Architecture, Ports

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

Getting Started with VHDL

Basic Language Constructs of VHDL

EITF35: Introduction to Structured VLSI Design

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

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

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

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

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

Inthis lecture we will cover the following material:

Performance Engineering of Real-Time and Embedded Systems. Introduction to VHDL

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

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

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

Combinational Logic II

VHDL 2 IDENTIFIERS, DATA OBJECTS AND DATA TYPES

VHDL BASIC ELEMENTS INTRODUCTION

A bird s eye view on VHDL!

ECE U530 Digital Hardware Synthesis. Course Accounts and Tools

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

Contents. Chapter 9 Datapaths Page 1 of 28

Lab 3: Standard Combinational Components

Computer-Aided Digital System Design VHDL

Contents. Chapter 3 Combinational Circuits Page 1 of 34

LANGUAGE VHDL FUNDAMENTALS

VHDL kod yerleşimi. kütüphaneler. Dış görünüş (entity: varlık) İşleyişi, yapısı (architecture: mimari)

UNIT 6 CIRCUIT DESIGN

Experiment 4 Boolean Functions Implementation

VHDL Part 2. What is on the agenda? Basic VHDL Constructs. Examples. Data types Objects Packages and libraries Attributes Predefined operators

1. What is y-chart? ans: The y- chart consists of three domains:- behavioral, structural and geometrical.

Field Programmable Gate Array

Essential VHDL for ASICs

Outline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.

Constructing VHDL Models with CSA

Verilog HDL is one of the two most common Hardware Description Languages (HDL) used by integrated circuit (IC) designers. The other one is VHDL.

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

Design Entry: Schematic Capture and VHDL ENG241: Digital Design Week #4

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

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

Outline CPE 626. Advanced VLSI Design. Lecture 3: VHDL Recapitulation. Intro to VHDL. Intro to VHDL. Entity-Architecture Pair

CCE 3202 Advanced Digital System Design

Transcription:

Combinational Logic A Combinational Logic Block is one where the outputs depend only on the current inputs COMB. LOGIC BLOCK A combinational logic block can be implemented using simple gates or lookup tables or other techniques. Can describe the function of a comb. block in many ways: 1. English: The block has an output of 1 when an even number of inputs are 1. Note: sometimes ambiguous 2. A Truth Table: a b c f 0 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 Exercise: fill in the last two rows... 3. A Boolean Equation: f = a b c + a b c + a b c +. Exercise: fill in the rest of the equation Note this can be simplified: f = a xor b xor c 4. A schematic diagram: Exercise: draw a schematic diagram for this circuit 5. VHDL or Verilog We ll talk about this soon

What you should remember about combinational logic: 1. How to write a logic equation from an English description 2. How to minimize a logic equation (ie. produce an equivalent equation with fewer literals) - using KMAPs - Section 4.1-4.5 in the textbook (review if necessary!) (an A student might want to read 4.5-4.8 as well). - Really, these minimization techniques are usually performed automatically by CAD tools, so we won t focus on them here. 3. Some common combinational blocks (mux, decoder, etc) - Sections 6.1-6.5 of the textbook Combinational Logic in VHDL: The basic construct for modeling a digital system in VHDL is called a design entity. Each hardware block is described in one design entity. A VHDL Design Entity consists of two parts: An Interface description: - describes the inputs and outputs of the block - in VHDL, denoted by the keyword entity A Body: - describes either what the block does and/or what it is composed of - in VHDL, denoted by the keyword architecture Example: A VHDL Description of an Exclusive-Or Gate: entity XOR_GATE is port ( A, B : in BIT; end XOR_GATE; architecture MY_DEFN of XOR_GATE is Z <= A xor B;

Example: A VHDL Description of a more complex gate: entity BIG_GATE is port ( A, B, C : in BIT; end BIG_GATE; architecture MY_DEFN of BIG_GATE is Z <= (not A and B) or (B and not C); Things to note about the entity part: Ports are signals that flow into or out of the design The direction of flow is called the mode of the port Possible modes: in, out, inout, linkage, buffer Type information (eg. BIT) declares a set of legal values for the port. A signal of type BIT can be either a 1 or 0. Other types are possible (more on this later) Things to note about the architecture part: Each entity might have several architectures (one behavioural, one structural for example). Therefore, must name each architecture (eg. MY_DEFN). Common names are BEHAVIOURAL, STRUCTURAL, DATAFLOW, etc. Can describe a block with several outputs: entity COMB_BLOCK is port (A, B,C,D : in BIT; X,Y, end COMB_BLOCK; architecture MY_DEFN of COMB_BLOCK is X <= A and B and C; Y <= C and not D; Z <= A xor B xor D; A B C D X Y Z Note: Three assignments performed concurrently

One more example. What is this block? entity MYSTERY is port ( IN1, IN2, IN3 : in BIT; OUT1, OUT2 : out BIT); end MYSTERY; architecture MY_DEFN of MYSTERY is OUT1 <= IN1 xor IN2 xor IN3; OUT2 <= (IN1 and IN2) or (IN1 and IN3) or (IN2 and IN3); Consider an alternate description of an EXOR gate: entity XOR_GATE is port (A, B : in BIT; end XOR_GATE; architecture ALT_DEF of XOR_GATE is signal INT1, INT2; INT1 <= A and not B; Two Internal Signals NT2 <= not A and B; Z <= INT1 or INT2; end ALT_DEF; Exercise: Show that this the same as an exclusive or gate. We have defined two INTERNAL signals. Sometimes this results in simpler definitions (not in this case, though) Mode of Ports: Ports can be in, out, or inout. Rule: signals that are in can not be written to (can not appear on the left side of a signal assignment) and signals that are out can not be read from (can not appear on the right side of a signal assignment statement). Seems obvious, but it means this is illegal: entity BAD_MODEL is port (A, B, C, D : in bit; X, Y_BAR : out bit); end BAD_MODEL; architecture EXAMPLE of BAD_MODEL is X <= (A and B) or C; Y_BAR <= X nand D; end EXAMPLE;

Use an internal signal to fix this problem: entity GOOD_MODEL is port (A, B, C, D : in bit; X, Y_BAR : out bit); end GOOD_MODEL; architecture EXAMPLE of GOOD_MODEL is signal INT_SIG : bit; INT_SIG <= (A and B) or C; X <= INT_SIG; Y_BAR <= INT_SIG nand D; end EXAMPLE; Note: ports can also be inout; in that case, there are no restrictions So a recipe for specifying combinational logic in VHDL: 1. Write a boolean expression for each output 2. Include each boolean expression as a signal assignment within an architecture description (as in the full-adder example above). This will work, and you can use it. But, there are more efficient and easier ways to do it. Coming soon... By the way, - VHDL is case-insensitive, and spaces and new lines can appear anywhere (except in the middle of a keyword) - Comments can appear anywhere, using two dashes -- The rest of this line is a comment In your assignments (and any VHDL code you might write out in the real world), please use lots of comments!

Structural Specifications: One of the important concepts in VHDL is hierarchy That is, specifying a circuit as a composition of smaller circuits. Such a specification is called a structural specification Structural specifications can take on many forms: - a circuit composed of individual gates -> gate-level rep. - a circuit composed of RTL components -> RTL rep. - a circuit composed of higher level blocks - a circuit composed of only one top-level block In general, there will be many levels of hierarchy Consider a REALLY simple example: IN1 IN2 U0 X U1 OUT1 Start by describing each component: entity NAND_GATE is port (A, B : in BIT; end NAND_GATE; architecture MY_DEFN of NAND_GATE is Z <= A nand B; entity INV_GATE is port (A : in BIT; end INV_GATE; architecture MY_DEFN of INV_GATE is Z <= not A; IN1 IN2 U0 X U1 OUT1 entity AND_GATE is port (IN1, IN2 : in BIT; OUT1 : out BIT); end AND_GATE; Entity Part Architecture Part architecture STRUCTURAL of AND_G is component NAND_GATE port (A, B: in bit; Z: out bit); end component; component INV_GATE port (A: in bit; Z: out bit); end component; signal X : bit; u0: NAND_GATE port map (IN1, IN2, X); u1: INV_GATE port map (X, OUT1); end STRUCTURAL;

Positional vs. Named Notation: In the previous example, we used Positional notation in the port map statements: port map (IN1, IN2, X) means that IN1 is connected to the first port in the entity definition and IN2 is connected to the second port in the entity definition, etc. Can also used named notation: port map (A=> IN1, B=> IN2, Z=> X) means that IN1 is connected to A in the entity def n, etc. Aside: Packages and Libraries: A package is a collection of: - component declarations - types, subtypes, and constants - procedures and function declarations A library is a collection of packages. Example of how to use stuff from packages in your code: library IEEE ; use IEEE.std_logic_1164.all ; use IEEE.std_logic_arith.all ; This indicates that you want to use the library called IEEE. Within the IEEE library, you want to use packages: STD_LOGIC_1164 and STD_LOGIC_ARITH. Describing Buses: Up until now, all signals have been of type BIT. This maps nicely to one wire. Can also have a signal that represents a set of parallel wires. signal x: bit_vector(2 downto 0); This example defines x as a bus with 3 parallel wires. This is like an array in a programming language. Each element of the array is of type BIT. Bit_vector signals can also be used as input/output signals of design entities

The size of a bit-vector and the element numbers are assigned when the signal is defined: signal x: bit_vector(0 to 7) -- 8 elements accessed using indices 0-7 signal y: bit_vector(8 to 15) -- 8 elements accessed using indices 8-15 signal z: bit_vector(7 downto 0) -- 8 elements accessed indices 7 to 0 You can do lots of cool things with bit_vectors: 1. You can assign values to all elements in the array at once x <= 00011101 ; 2. You can copy one bus to another: out_bus <= in_bus; -- both buses must be declared identically 3. You can access individual elements of bit_vectors: signal STATUS : bit; signal MAIN_BUS : bit_vector(15 downto 0);. STATUS <= MAIN_BUS(6); -- copy element 6 to status. 4. You can access slices of vectors: signal MAIN_BUS : bit_vector(31 downto 0); signal OPCODE : bit_vector (3 downto 0); OPCODE <= MAIN_BUS(31 downto 28); 5. You can concatenate short vectors to produce longer vectors Example: if you have the following signals defined: signal MAIN_BUS : bit_vector(7 downto 0); signal SHORT_BIT : bit_vector(2 downto 0); then the following are legal: MAIN_BUS <= 0000 & 1111 ; MAIN_BUS <= 01011 & SHORT_BIT; MAIN_BUS <= 0 & 0001111 ; MAIN_BUS <= 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 ;

6. You can operate on entire bit vectors: signal SIG_A, SIG_B, SIG_C : bit_vector(7 downto 0);.. SIG_C <= SIG_A and SIG_B; The and is done bit-by-bit. So if SIG_A = 00001111 and SIG_B = 01010101, then SIG_C gets 00000101. Other operations include shift and rotates. 7. You can make two-dimensional arrays: type REGARRAY is array (3 downto 0) of bit_vector(7 downto 0); signal R: REGARRAY; Predefined Attributes: You can use attributes to avoid hard-coding numbers: Example: with the following declaration signal B_VEC: bit_vector(7 downto 0); the following can be used anywhere in the code: B_VEC LEFT = 7 B_VEC RIGHT = 0 B_VEC HIGH = 7 B_VEC LOW = 0 B_VEC RANGE = 7 downto 0 B_VEC REVERSE_RANGE = 0 to 7 B_VEC LENGTH = 8 example: MSB_B <= B_VEC ( B_VEC LEFT); Two New Types: STD_LOGIC: Like BIT, but signals of type STD_LOGIC can take on values other than 0 or 1. Some possible values: 0 or 1 : like BIT Z : high-impedance (a signal no one is driving) X : unknown (a signal who s value is unknown) U : uninitialized (a signal that has not been initialized). Later, we will see examples where we need Z, X and U. STD_LOGIC_VECTOR: Array of STD_LOGIC elements (analogous to BIT_VECTOR) My advice: Use STD_LOGIC and STD_LOGIC_VECTOR instead of BIT and BIT_VECTOR all the time.