HDL Programming Fundamentals UNIT 3: Behavioral Descriptions OBJECTIVES  Understand the concept of sequential statements in VHDL and how they are different.

Slides:



Advertisements
Similar presentations
UNIT 2: Data Flow description
Advertisements

VHDL Lecture 1 Megan Peck EECS 443 Spring 08.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Synchronous Sequential Logic
Combinational Logic.
Verilog Modules for Common Digital Functions
Table 7.1 Verilog Operators.
Hardware Description Language (HDL)
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
Slide 1 7. Verilog: Combinational always statements. VHDL: Combinational Processes: To avoid (I.E. DO NOT What in your HDL code?) Cases that generate Synthesis.
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.
ECE 551 Digital System Design & Synthesis Lecture 09 Synthesis of Common Verilog Constructs.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
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.
Verilog HDL (Behavioral Modeling) Bilal Saqib. Behavioral Modeling.
Overview Logistics Last lecture Today HW5 due today
Introduction to VHDL (part 2)
Advanced FPGA Based System Design Lecture-9 & 10 VHDL Sequential Code By: Dr Imtiaz Hussain 1.
Verilog Basics Nattha Jindapetch November Agenda Logic design review Verilog HDL basics LABs.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
ECE 2372 Modern Digital System Design
Synthesis Presented by: Ms. Sangeeta L. Mahaddalkar ME(Microelectronics) Sem II Subject: Subject:ASIC Design and FPGA.
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
Chapter 4: Behavioral Modeling Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 4-1 Ders – 4: Davranışsal Modelleme.
7/10/2007DSD,USIT,GGSIPU1 Basic concept of Sequential Design.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
3/4/20031 ECE 551: Digital System Design * & Synthesis Lecture Set 3 3.1: Verilog - User-Defined Primitives (UDPs) (In separate file) 3.2: Verilog – Operators,
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Hardware languages "Programming"-language for modelling of (digital) hardware 1 Two main languages: VHDL (Very High Speed Integrated Circuit Hardware Description.
IAY 0600 Digital Systems Design VHDL discussion Dataflow Style Combinational Design Alexander Sudnitson Tallinn University of Technology.
Verilog A Hardware Description Language (HDL ) is a machine readable and human readable language for describing hardware. Verilog and VHDL are HDLs.
M.Mohajjel. Structured Procedures Two basic structured procedure statements always initial All behavioral statements appear only inside these blocks Each.
Digital System Projects
1 Part III: VHDL CODING. 2 Design StructureData TypesOperators and AttributesConcurrent DesignSequential DesignSignals and VariablesState Machines A VHDL.
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
CEC 220 Digital Circuit Design VHDL in Sequential Logic Wednesday, March 25 CEC 220 Digital Circuit Design Slide 1 of 13.
Apr. 3, 2000Systems Architecture I1 Introduction to VHDL (CS 570) Jeremy R. Johnson Wed. Nov. 8, 2000.
May 9, 2001Systems Architecture I1 Systems Architecture I (CS ) Lab 5: Introduction to VHDL Jeremy R. Johnson May 9, 2001.
1 ASIC 120: Digital Systems and Standard-Cell ASIC Design Tutorial 2: Introduction to VHDL February 1, 2006.
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
Unit 4 Structural Descriptions SYLLABUS Highlights of Structural descriptions Organization of the Structural descriptions Binding State Machines Generate(HDL),Generic(VHDL),
George Mason University Behavioral Modeling of Sequential-Circuit Building Blocks ECE 545 Lecture 8.
1 University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Unit 7 Mixed Language Descriptions SYLLABUS Highlights of Mixed-Language Description, How to invoke One language from the Other Mixed-language Description.
Overview Logistics Last lecture Today HW5 due today
An Introduction to Verilog: Transitioning from VHDL
Combinational logic circuit
Systems Architecture Lab: Introduction to VHDL
UNIT 8: Synthesis Basics
Dataflow Style Combinational Design with VHDL
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
HDL Programming Fundamentals
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
UNIT 3: Behavioral Descriptions
UNIT 2: Data Flow description
Field Programmable Gate Array
Field Programmable Gate Array
The Verilog Hardware Description Language
Sequntial-Circuit Building Blocks
4-Input Gates VHDL for Loops
Presentation transcript:

HDL Programming Fundamentals UNIT 3: Behavioral Descriptions OBJECTIVES  Understand the concept of sequential statements in VHDL and how they are different from concurrent statements.  Identify the basic statements and components of behavioral description such as process, variable assignment statements, if, case, when, report, loop, exit, next, always, repeat, forever, and initial.  Review and understand basics of some digital logic systems such as D flip-flop, JK flip-flop, Binary Counters, and shift register.  Understand the concept of some basic genetics and renal system.

HDL Programming Fundamentals Behavioral is implemented when digital logic structures are not known or are hard to generate Examples of such systems are complex arithmetic units, computer control units, and biological mechanisms In VHDL, the major behavioral description statement is process. In Verilog, the major behavioral description statements are always and initial. For VHDL, the statements inside the process are sequential. In Verilog all statements are concurrent.

HDL Programming Fundamentals 3.2 Structure of Behavioral Description Listing 3.1 Example of HDL Behavioral Description. a) VHDL. B) Verilog. a) VHDL Description entity half_add is port (I1, I2 : in bit; O1, O2 : out bit); end half_add ; architecture behave_ex of half_add is begin process (I1, I2) begin O1 <= I1 xor I2 after 10 ns ; -- statement 1 O2 <= I1 and I2 after 10 ns; -- statement 2 -- The above two statements are signal assignment statements -- with 10 nano seconds delay. --Other behavioral (sequential) statements can be added here end process; end behave_ex; Execution of SA statements Inside process is Sequential calculation And then assignment

HDL Programming Fundamentals See Page 67 of the textbook Event on I1 activates the Process I1 I2 O1 O2 1. Calculate O1 (1 xor 0)= 1 2. Calculate O2 (1 and 0)=0 3. Assign O1 =1 after 10 ns 4. Assign O2 = 0 after 10 ns 10 ns Event on I1 activates ALWAYS I1 I2 O1 O2 1. Calculate: O1 (1 xor 0)= 1, O2 = (1 and 0)= 0 2. Assign: O1 =1 after 10 ns, O2 = 0 after 10 ns 10 ns VHDL Verilog

HDL Programming Fundamentals b) Verilog Description module half_add (I1,I2,O1,O2); input I1,I2; output O1,O2; reg O1,O2; /* Since O1 and O2 are outputs and they are written inside “always”, they should be declared as reg */ I2) begin #10 O1 = I1 ^ I2; // statement 1. #10 O2 = I1& I2;// statement 2. /*The above two statements are procedural(inside always) signal assignment statements with 10 simulation screen units delay*/ /*Other behavioral (sequential) statements can be added here*/ end endmodule Execution of statements inside Always is event-concurrent

HDL Programming Fundamentals Signl: process(t1) begin st1: S1<= t1; st2: S2 <= not S1; end process; Varb: process(t1) variable temp1, temp2: bit; begin st3: temp1 := t1; st4: temp2 := not temp1; st5: S1 <= temp1; st6: S2 <= temp2; end process ; Variable Versus Signal in VHDL t1 S1 S2 t1 S1 S2 temp1 temp2

HDL Programming Fundamentals 3.4 Sequential Statements IF Statement IF statement is a sequential statement that appears inside a process in VHDL or inside always or initial in Verilog. It has several formats; some of those formats are as follows: a) VHDL if ( Boolean Expression)then statement 1; statement 2; statement 3; else statement a; statement b; statement c; end if; See Table 1.15 for a list of relational operators

HDL Programming Fundamentals b)Verilog if ( Boolean Expression) begin statement 1; /* if only one statement, begin and end can be omitted */ statement 2; statement 3; end else begin statement a; /* if only one statement, begin and end can be omitted */ statement b; statement c; End See Table 1.15 for a list of relational operators

HDL Programming Fundamentals else statement can be eliminated; the if statement in this case simulates a latch:. a) VHDL if clk = ‘1’ then………….Example 3.2 temp := s1; end if; Another example If (clk = ‘1’ and cs =‘1’) then b) Verilog if ( clk ==1) Begin temp = s1; end Another example If (clk == 1 & cs ==1) begin

HDL Programming Fundamentals Example 3.5 Behavioral Description of a 2x1 Multiplexer with Tri-State Output Listings 3.2 and 3.3

HDL Programming Fundamentals library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity MUXBH is port (A,B,SEL, Gbar: in std_logic; Y: out std_logic); end MUXBH; architecture MUX_bh of MUXBH is begin process (SEL,A,B,Gbar) variable temp: std_logic; begin if (Gbar = '0') and (SEL ='1') then temp :=B; elsif (Gbar = '0') and (SEL ='0')then temp := A; else temp := 'Z';--Z is high impedance` end if; Y <= temp; end process; end MUX_bh; Listing 3.3 VHDL elsif If…..then elsif….then else end if;

HDL Programming Fundamentals b) Verilog Description module MUXBH(A,B,SEL, Gbar,Y); input A,B,SEL, Gbar; output Y; reg Y; /* since Y is an output and appears inside always,Y has to be declared as reg( register) */ ( SEL,A,B,Gbar) begin if (Gbar ==0 & SEL==1) begin Y = B; end else if (Gbar == 0 & SEL ==0) Y = A; else Y = 1'bz; //Y is assigned to high impedance end endmodule Verilog else if If….. begin……end else if…. begin…..end else if…. begin…..end else begin….end

HDL Programming Fundamentals Signal and Variable Assignment in VHDL Know the difference in execution of signal and variable in VHDL To execute Signal we need two phases ( calculate and assign), Variable is the same as in software languages such as C only one phase to execute. Example 3.6

HDL Programming Fundamentals D Latch using Variables. The Wave form is correct D Latch using Signals. The Wave form is Wrong

HDL Programming Fundamentals Case Statement case statement is a sequential control statement. It has the following format: a)VHDL case (control-expression) is when test value or expression1 => statements1; when test value or expression2 => statements2; when test value or expression3 => statements3; when others => statements4; end case ; b)Verilog case (control-expression) test value1: begin statements1; end test value2: begin statements2; end test value3: begin statements3; end default : begin default statements end endcase

HDL Programming Fundamentals Example 3.8 Behavioral Description of a Positive Edge Triggered JK Flip-Flop Using CASE Statement Listing 3.7

HDL Programming Fundamentals Example bit counter with clear

HDL Programming Fundamentals module CT_CASE(clk, clr, q); input clk, clr; output [2:0] q; reg [2:0] q; initial /* The initial procedure is to force the counter to start from initial count q=110 */ q = 3'b101; clk) begin if (clr ==0) begin case (q) 3'd0 : q = 3'd1; 3'd1 : q = 3'd2; 3'd2 : q = 3'd3; 3'd3 : q = 3'd4; 3'd4 : q = 3'd5; 3'd5 : q = 3'd6; 3'd6 : q = 3'd7; 3'd7 : q = 3'd0; endcase end initial as always is a behavioral statement

HDL Programming Fundamentals Example 3.10 Genetics- Listing 3.9 Cells, Chromosomes, DNA, Allele, Dominant allele, Recessive allele,. Co-Dominant alleles, Gametes, Homozygous in a Gene, Heterozygous in a Gene, Genotype: Phenotype. ♂ ♀ABO A AAAB AO B ABBBBO O AOBOOO ♂ ♀ABO A AAB A B ABBB O ABO report, & concatenate (VHDL) $display, { } concatenate (Verilog)

HDL Programming Fundamentals Verilog Casex and Casez Example 3.11 Verilog Description of Priority Encoder using Casex Listing 3.11

HDL Programming Fundamentals Loop Statement For-Loop a) VHDL for i in 0 to 2 loop if temp(i) = '1' then result := result + 2**i; end if; end loop; statement1; statement2;.... b) Verilog for (i=0; i<=2;i=i+1) begin if (temp[i] ==1) begin result = result + 2**i; end

HDL Programming Fundamentals While Loop a) VHDL while (i < x)loop i := i + 1; z := i*z; end loop; b) Verilog while(i < x) begin i = i +1; z = i*z; end repeat, forever, next, exit pages 93-94

HDL Programming Fundamentals Example 3.16 Behavioral Description of a 4-bit Positive Edge Triggered Counter Listing 3.11 Example 3.17 Behavioral Description of a 4-bit Counter with Synchronous Hold Listing 3.12

HDL Programming Fundamentals Example 3.18 Calculating the Factorial using Behavioral Description with While-Loop Listing 3.13

HDL Programming Fundamentals Case Study 3.1 Booth Algorithm

HDL Programming Fundamentals Case Study 3.2 Behavioral Description of a Simplified Renal Antidiuretic Hormone (ADH) Mechanism

HDL Programming Fundamentals

3.6 Summary