Behavioral Modeling Structural modeling Behavioral modeling

Slides:



Advertisements
Similar presentations
Digital System Design-II (CSEB312)
Advertisements

VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
Counters Discussion D8.3.
Verilog Overview. University of Jordan Computer Engineering Department CPE 439: Computer Design Lab.
Sequential Logic in Verilog
Supplement on Verilog adder examples
Synchronous Sequential Logic
Combinational Logic.
Verilog Modules for Common Digital Functions
Table 7.1 Verilog Operators.
Verilog Intro: Part 1.
Hardware Description Language (HDL)
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Verilog Module Module declaration Module instantiation module Add_full (sum, c_out, a, b, c_in); // parent module input a, b, c_in; output c_out, sum;
ECEN ECEN475 Introduction to VLSI System Design Verilog HDL.
Digital System Design Verilog ® HDL Tasks and Functions Maziar Goudarzi.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Today’s Lecture Process model –initial & always statements Assignments –Continuous & procedural assignments Timing Control System tasks.
RTL Coding tips Lecture 7,8 Prepared by: Engr. Qazi Zia, Assistant Professor EED, COMSATS Attock.
Tasks and Functions Programmable Logic Design (40-493) Fall 2001 Computer Engineering Department Sharif University of Technology Maziar Gudarzi.
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior: initial blocks execute.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Chapter 5: Tasks, Functions, and UDPs Digital System Designs and Practices Using Verilog HDL and 2008~2010, John Wiley 5-1 Ders - 5 : Görevler,
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
COE 405 Logic Design with Behavioral Models of Combinational & Sequential Logic Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
The Verilog Hardware Description Language. GUIDELINES How to write HDL code: How to write HDL code:
Introduction to ASIC flow and Verilog HDL
M.Mohajjel. Objectives Learn How to write synthesizable Verilog code Common mistakes and how to avoid them What is synthesized for what we code Digital.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Verilog 강의자료 REAL TIME ARCHITECTURE LAB Advanced Digital Design with the Verilog HDL Chapter 1 ~ 5.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
1 Lecture 1: Verilog HDL Introduction. 2 What is Verilog HDL? Verilog Hardware Description Language(HDL)? –A high-level computer language can model, represent.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Constructs for Activity Flow Control  Task & Function  System Tasks for Timing Checks.
Structural Description
Overview Logistics Last lecture Today HW5 due today
Hardware Description Languages: Verilog
Verilog Tutorial Fall
Supplement on Verilog FF circuit examples
Adapted from Krste Asanovic
Verilog Introduction Fall
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
HDL for Sequential Circuits
Synthesis of Combinational Logic
Verilog-HDL-3 by Dr. Amin Danial Asham.
Hardware Description Languages: Verilog
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Verilog HDL.
Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-I]
Chapter 5: Tasks, Functions, and UDPs
SYNTHESIS OF SEQUENTIAL LOGIC
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
Verilog.
COE 202 Introduction to Verilog
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
The Verilog Hardware Description Language
Supplement on Verilog adder examples
The Verilog Hardware Description Language
The Verilog Hardware Description Language
332:437 Lecture 8 Verilog and Finite State Machines
COE 202 Introduction to Verilog
Presentation transcript:

Logic Design with Behavioral Models of Combinational and Sequential Logic

Behavioral Modeling Structural modeling Behavioral modeling Connects primitive gates and/or functional units to create a specified functionality. Behavioral modeling The functionality of a design The input-output model of a logic circuit and suppress details about its low-level internal structure and physical implementation.

Data type Nets Registers Net variables act like wires in a physical circuit and establish connectivity between design objects. wire Registers Register variables act like variables in ordinary procedural languages reg integer

Boolean-Equation-Based Behavioral Model of combinational Logic Module AOI_5_CA0(y_out, x_in1, x_in2, x_in3, x_in4, x_in5); input x_in1, x_in2, x_in3, x_in4, x_in5; output y_out; assign y_out =~(( x_in1 & x_in1) | (x_in3 & x_in4 & x_in5)); endmodule Module AOI_5_CA1(y_out, x_in1, x_in2, x_in3, x_in4, x_in5, enable); input x_in1, x_in2, x_in3, x_in4, x_in5, enable; output y_out; assign y_out =enable ? ~(( x_in1 & x_in1) | (x_in3 & x_in4 & x_in5)) : 1’bz; endmodule

Propagation Delay and continuous Assignments Propagation delay can be associated with a continuous assignment so that its implicit logic has the same functionality and timing characteristics as its gate-level counterpart Module AOI_5_CA3(y_out, x_in1, x_in2, x_in3, x_in4, x_in5); input x_in1, x_in2, x_in3, x_in4, x_in5; output y_out; wire #1 y1 = x_in1 & x_in2 & x_in5; // Bitwise and operation wire #1 y2 = x_in3 & x_in4; wire #1 y_out = ~(y1 | y2); // complement the result of bitwise OR operation endmodule

Latches and Level-Sensitive Circuits in Verilog module Latch_CA(q_out, data_in, enable); output q _out; input data_in, enable; assign q_out = enable? data_in : q_out; endmodule module Latch_Rbar_CA(q_out, data_in, enable, reset_bar); output q _out; input data_in, enable, reset_bar; assign q_out = !reset_bar? 0 : enable? data_in : q_out; endmodule

Cyclic Behavioral Models of Flip-Flops and latches Keyword : always module df_behav(q, q_bar, data, set, reset, clk); input data, set clk, reset; output q, q_bar; reg q; assign q_bar = ~q; always @(posedge clk) // Flip-flop with synchronous set/reset begin if(reset == 0) q <= 0; else if (set ==0) q <= 1; else q <= data; end endmodule

A comparison of styles for behavioral Modeling Continuous-assignment Models Dataflow/RTL Models Algorithm-Based Models Simulation with Behavioral Models

Continuous-Assignment Models module compare_2_CA1( A_lt_B, A_gt_B, A_eq_B, A1, A0, B1, B0); input A1, A0, B1, B0; output A_lt_B, A_gt_B, A_eq_B; assign A_lt_B = ({A1, A0} < {B1, B0}); assign A_gt_B = ({A1, A0} > {B1, B0}); assign A_eq_B = ({A1, A0} = {B1, B0}); endmodule module compare_2_CA2( A_lt_B, A_gt_B, A_eq_B, A, B); input [1:0] A, B; output A_lt_B, A_gt_B, A_eq_B; assign A_lt_B = (A < B); assign A_gt_B = (A > B); assign A_eq_B = (A = B); endmodule

Dataflow/RTL Models module compare_2_RTL( A_lt_B, A_gt_B, A_eq_B, A, B); input A1, A0, B1, B0; output A_lt_B, A_gt_B, A_eq_B; reg A_lt_B, A_gt_B, A_eq_B; always @( A0 or A1 or B0 or B1) begin A_lt_B = ({A1, A0} < {B1, B0}); A_gt_B = ({A1, A0} > {B1, B0}); A_eq_B = ({A1, A0} = {B1, B0}); end endmodule

Algorithm-Based Models module compare_2_algo( A_lt_B, A_gt_B, A_eq_B, A, B); input [1:0] A B; output A_lt_B, A_gt_B, A_eq_B; reg A_lt_B, A_gt_B, A_eq_B; always @( A or B) // Level-sensitive behavior begin A_lt_B = 0; A_gt_B = 0; A_eq_B = 0; if (A==B) A_eq_B = 1; else if(A >B) A_gt_B = 1; else A_lt_B =1; end endmodule

Functions vs Tasks Functions Tasks Can enable another function but not another task Always executes zero simulation time Can not contain any delay, event or timing control statements Must have at least one input argument Always return a single value Can not have output or inout arguments Can enable other task and functions May execute in non-zero simulation time May contain delay, event, or timing control statement May have zero or more input, output, or inout arguments Modifies zero or more values

module adder_task (c_out, sum, c_in, data_a, data_b, clk, reset); output [3:0] sum; output c_out; input [3:0] data_a, data_b; input clk, reset; input c_in; reg [3:0] sum; reg c_out; always @(posedge clk or posedge reset) if(reset) {c_out, sum} <= 0; else add_values(c_out, sum, data_a, data_b, c_in); task add_values; begin {c_out, sum} <= data_a + (data_b + c_in); end endtask endmodule Tasks

Functions module word_aligner (word_out, word_in); output [7 : 0] word_out; input [7 : 0] word_in; assign word_out = aligned_word(word_in); function [7:0] aligned_word; input [7:0] word_in; begin aligned_word = word_in; if (aligned_word != 0) while(aligned_word[7] ==0) aligned_word = aligned_word <<1; end endfunction endmodule