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

Similar documents
ELCT 501: Digital System Design

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

Hardware Description Language VHDL (1) Introduction

Digital Systems Design

VHDL Examples Mohamed Zaky

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

Hardware Description Languages. Modeling Complex Systems

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

Basic Language Concepts

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

Lattice VHDL Training

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

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

Mridula Allani Fall Fall

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Concurrent Signal Assignment Statements (CSAs)

ENGIN 241 Digital Systems with Lab

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

VHDL for FPGA Design. by : Mohamed Samy

Introduction to VHDL #3

Control and Datapath 8

Computer-Aided Digital System Design VHDL

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

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

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

Modeling Complex Behavior

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

Chapter 2 Basic Logic Circuits and VHDL Description

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

Chapter 6 Combinational-Circuit Building Blocks

Lecture 12 VHDL Synthesis

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

[VARIABLE declaration] BEGIN. sequential statements

Field Programmable Gate Array

Sequential Logic - Module 5

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

COE 405 Design Methodology Based on VHDL

CCE 3202 Advanced Digital System Design

DESCRIPTION OF DIGITAL CIRCUITS USING VHDL

Experiment 8 Introduction to VHDL

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

Review of Digital Design with VHDL

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

Digital Design with FPGAs. By Neeraj Kulkarni

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

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

FPGA BASED SYSTEM DESIGN. Dr. Tayab Din Memon Lecture 9 & 10 : Combinational and Sequential Logic

VHDL: A Crash Course

C-Based Hardware Design

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

N-input EX-NOR gate. N-output inverter. N-input NOR gate

The University of Alabama in Huntsville ECE Department CPE Midterm Exam Solution March 2, 2006

Part 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits

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

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

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

CSE 260 Introduction to Digital Logic and Computer Design. Exam 1. Your name 2/13/2014

Writing VHDL for RTL Synthesis

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

VHDL in 1h. Martin Schöberl

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

SEQUENTIAL STATEMENTS

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

VHDL VS VERILOG.

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

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

VHDL for Logic Synthesis

Lecture 27. Structural Description of a 3-Bit Synchronous Decade Counter. FIGURE 4.31 A State diagram of a decade counter.

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

EEL 4712 Digital Design Test 1 Spring Semester 2007

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 3

P-1/26. Samir Palnitkar. Prentice-Hall, Inc. INSTRUCTOR : CHING-LUNG SU.

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

Inferring Storage Elements

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

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

Architecture des Ordinateurs I

PLD (eg. PAL) Typically 8 logic elements Technology: AND-OR array. William Sandqvist

Code No: R Set No. 1

EE261: Intro to Digital Design

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

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

VHDL Structural Modeling II

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Very High Speed Integrated Circuit Har dware Description Language

Digital Systems Design

Introduction to VHDL #1

CONCURRENT STATEMENTS COMPONENT DECLARATION COMPONENT INSTANTIATION

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

Topics. Midterm Finish Chapter 7

QUESTION BANK FOR TEST

Introduction to VHDL

CprE 583 Reconfigurable Computing

VHDL And Synthesis Review

Digital Systems Design

VHDL Simulation. Testbench Design

Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING. Fifth Semester. Subject: VHDL Programming

Digital Design with SystemVerilog

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Transcription:

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

Combinational logic -- Behavior can be specified as concurrent signal assignments -- These model concurrent operation of hardware elements entity Gates is port (a, b,c: in STD_LOGIC; d: out STD_LOGIC); end Gates; architecture behavior of Gates is signal e: STD_LOGIC; -- concurrent signal assignment statements e <= (a and b) xor (not c); -- synthesize gate-level ckt d <= a nor b and (not e); -- in target technology end;

Example: SR latch (logic equations) entity SRlatch is port (S,R: in std_logic; --latch inputs Q,QB: out std_logic); --latch outputs end SRlatch; QBi architecture eqns of SRlatch is signal Qi,QBi: std_logic; -- internal signals QBi <= S nor Qi; -- Incorrect would be: QB <= S nor Q; Qi <= R nor QBi; -- Incorrect would be: Q <= R nor QB; Q <= Qi; --drive output Q with internal Qi QB <= QBi; --drive output QB with internal QBi end; Qi Cannot reference output ports.

Conditional signal assignment (form 1) z <= m when sel = 0 else n; True/False conditions m n 0 1 2-to-1 Mux z y <= a when (S= 00 ) else b when (S= 01 ) else c when (S= 10 ) else d; sel a b c d 4-to-1 Mux 00 01 10 11 y Condition can be any Boolean expression y <= a when (F= 1 ) and (G= 0 ) S

Conditional signal assignment (form 2) -- One signal (S in this case) selects the result signal a,b,c,d,y: std_logic; signal S: std_logic_vector(0 to 1); with S select y <= a when 00, b when 01, c when 10, d when 11 ; --Alternative default *: d when others; a b c d 4-to-1 Mux 00 01 10 11 S y * std_logic values can be other than 0 and 1

32-bit-wide 4-to-1 multiplexer signal a,b,c,d,y: std_logic_vector(0 to 31); signal S: std_logic_vector(0 to 1); a with S select b y <= a when 00, c b when 01, d c when 10, d when 11 ; --y, a,b,c,d can be any type, as long as they match 4-to-1 Mux 00 01 10 11 S y

32-bit-wide 4-to-1 multiplexer -- Delays can be specified if desired signal a,b,c,d,y: std_logic_vector(0 to 31); signal S: std_logic_vector(0 to 1); with S select Optional non-delta delays for each option y <= a after 1 ns when 00, b after 2 ns when 01, c after 1 ns when 10, d when 11 ; a b c d 4-to-1 Mux 00 01 10 11 S y a->y delay is 1ns, b->y delay is 2ns, c->y delay is 1ns, d->y delay is δ

Truth table model as a conditional assignment Conditional assignment can model the truth table of a switching function (without deriving logic equations) S A B Y 0 0 0 0 1 1 1 0 1 1 1 0 signal S: std_logic_vector(1 downto 0); S <= A & B; -- S(1)=A, S(0)=B with S select -- 4 options for S Y <= 0 when 00, 1 when 01, 1 when 10, 0 when 11, X when others; & is the concatenate operator, merging scalars/vectors into larger vectors

Example: full adder truth table ADDin <= A & B & Cin; --ADDin is a 3-bit vector S <= ADDout(0); --Sum output (ADDout is a 2-bit vector) Cout <= ADDout(1); --Carry output with ADDin select ADDout <= 00 when 000, 01 when 001, 01 when 010, 10 when 011, 01 when 100, 10 when 101, 10 when 110, 11 when 111, XX when others; ADDout ADDin A B Cin Cout S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1

Example: 2-to-4 decoder library ieee; use ieee.std_logic_1164.all; entity decode2_4 is port (A,B,EN: in std_logic; Y: out std_logic_vector(3 downto 0)); end decode2_4; architecture behavior of decode2_4 is signal D: std_logic_vector(2 downto 0); D <= EN & B & A; -- vector of the three inputs with D select Y <= 0001 when 100, --enabled, BA=00 0010 when 101, --enabled, BA=01 0100 when 110, --enabled, BA=10 1000 when 111, --enabled, BA=11 0000 when others; --disabled (EN = 0) end; A B EN Y(0) Y(1) Y(2) Y(3)

Structural model (no behavior specified) architecture structure of full_add1 is component xor -- declare component to be used port (x,y: in std_logic; z: out std_logic); library entity architecture end component; for all: xor use entity work.xor(eqns); -- if multiple arch s in lib. signal x1: std_logic; -- signal internal to this component -- instantiate components with map of connections 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;

Associating signals with formal ports component AndGate port (Ain_1, Ain_2 : in std_logic; -- formal parameters Aout : out std_logic); end component; AndGate Ain_1 X -- positional association of actual to formal Ain_2 Y A1:AndGate port map (X, Y, Z1); -- named association (usually improves readability) A2:AndGate port map (Ain_2=>Y, Aout=>Z2, Ain_1=>X); -- both (positional must from leftmost formal) A3:AndGate port map (X, Aout => Z3, Ain_2 => Y); Aout Z1

Example: D flip-flop (equations model) entity DFF is port (Preset: in std_logic; Clear: in std_logic; Clock: in std_logic; Data: in std_logic; Q: out std_logic; Qbar: out std_logic); end DFF; Data Clock Preset Clear Q Qbar

7474 D flip-flop equations architecture eqns of DFF is signal A,B,C,D: std_logic; signal QInt, QBarInt: std_logic; A <= not (Preset and D and B) after 1 ns; B <= not (A and Clear and Clock) after 1 ns; C <= not (B and Clock and D) after 1 ns; D <= not (C and Clear and Data) after 1 ns; Qint <= not (Preset and B and QbarInt) after 1 ns; QBarInt <= not (QInt and Clear and C) after 1 ns; Q <= QInt; -- Can drive but not read outs QBar <= QBarInt; -- Can read & drive internals end;

4-bit Register (Structural Model) entity Register4 is port ( D: in std_logic_vector(0 to 3); Q: out std_logic_vector(0 to 3); Clk: in std_logic; Clr: in std_logic; Pre: in std_logic); end Register4; D(3) D(2) D(1) D(0) CLK PRE CLR Q(3) Q(2) Q(1) Q(0)

Register Structure architecture structure of Register4 is component DFF -- declare library component to be used port (Preset: in std_logic; Clear: in std_logic; Clock: in std_logic; Data: in std_logic; Q: out std_logic; Qbar: out std_logic); end component; signal Qbar: std_logic_vector(0 to 3); -- dummy for unused FF Qbar outputs -- Signals connect to ports in order listed above F3: DFF port map (Pre, Clr, Clk, D(3), Q(3), Qbar(3)); F2: DFF port map (Pre, Clr, Clk, D(2), Q(2), Qbar(2)); F1: DFF port map (Pre, Clr, Clk, D(1), Q(1), Qbar(1)); F0: DFF port map (Pre, Clr, Clk, D(0), Q(0), Qbar(0)); end;

Register Structure (with open output) architecture structure of Register4 is component DFF -- declare library component to be used port (Preset: in std_logic; Clear: in std_logic; Clock: in std_logic; Data: in std_logic; Q: out std_logic; Qbar: out std_logic); end component; -- Signals connect to ports in order listed above F3: DFF port map (Pre, Clr, Clk, D(3), Q(3), OPEN); F2: DFF port map (Pre, Clr, Clk, D(2), Q(2), OPEN); F1: DFF port map (Pre, Clr, Clk, D(1), Q(1), OPEN); F0: DFF port map (Pre, Clr, Clk, D(0), Q(0), OPEN); end; Keyword OPEN indicates an unconnected output

VHDL Process Construct (Processes will be covered in more detail in sequential circuit modeling ) [label:] process (sensitivity list) declarations sequential statements end process; Process statements are executed in sequence Process statements are executed once at start of simulation Process halts at end until an event occurs on a signal in the sensitivity list Allows conventional programming language methods to describe circuit behavior

Modeling combinational logic as a process -- All signals referenced in process must be in the sensitivity list. entity And_Good is port (a, b: in std_logic; c: out std_logic); end And_Good; architecture Synthesis_Good of And_Good is process (a,b) -- gate sensitive to events on signals a and/or b c <= a and b; -- c updated (after delay on a or b events end process; -- This process is equivalent to the simple signal assignment: -- c <= a and b; end;

Bad example of combinational logic -- This example produces unexpected results. entity And_Bad is port (a, b: in std_logic; c: out std_logic); end And_Bad; architecture Synthesis_Bad of And_Bad is process (a) -- sensitivity list should be (a, b) c <= a and b; -- will not react to changes in b end process; end Synthesis_Bad; -- synthesis may generate a flip flop, triggered by signal a