Chapter-5. EE 335 : Advanced Microprocessor. Logic Design with Behavioral Models of Combinational and Sequential Logic

Similar documents
Programmable Logic Devices Verilog VII CMPE 415

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Synthesis of Combinational and Sequential Circuits with Verilog

Midterm Exam Thursday, October 24, :00--2:15PM (75 minutes)

Lab 7 (All Sections) Prelab: Introduction to Verilog

Register Transfer Level

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Course Topics - Outline

Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog

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

Register Transfer Level in Verilog: Part I

RIZALAFANDE CHE ISMAIL TKT. 3, BLOK A, PPK MIKRO-e KOMPLEKS PENGAJIAN KUKUM. SYNTHESIS OF COMBINATIONAL LOGIC (Chapter 8)

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial

ECEN 468 Advanced Logic Design

Introduction to Verilog HDL. Verilog 1

Under-Graduate Project Logic Design with Behavioral Models

In this lecture, we will focus on two very important digital building blocks: counters which can either count events or keep time information, and

Hardware Description Languages (HDLs) Verilog

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

Verilog. Like VHDL, Verilog HDL is like a programming language but:

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

Module 4. Design of Embedded Processors. Version 2 EE IIT, Kharagpur 1

Digital Design with FPGAs. By Neeraj Kulkarni

MLR Institute of Technology

Homework deadline extended to next friday

ECEN 468 Advanced Digital System Design

ECE331: Hardware Organization and Design

Introduction to Verilog/System Verilog

Modeling Synchronous Logic Circuits. Debdeep Mukhopadhyay IIT Madras

RTL Design (Using ASM/SM Chart)

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

Hardware Description Language (HDL)

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

ES611 FPGA Based System Design. Behavioral Model

Introduction to Digital VLSI Design מבוא לתכנון VLSI ספרתי

Introduction to Verilog

EECS150 - Digital Design Lecture 10 Logic Synthesis

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

Synthesizable Verilog

Online Verilog Resources

Digital Design (VIMIAA01) Introduction to the Verilog HDL

Department of Computer Science and Electrical Engineering. Intro to Verilog II

VLSI II E. Özgür ATES

Advanced Digital Design with the Verilog HDL

Introduction to synthesis. Logic Synthesis

Register Transfer Level Design. Topics. Register Transfer Level Notation. Chapter 8 Steve Oldridge Dr. Sidney Fels. A Circuit is described as:

EEL 4783: HDL in Digital System Design

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Lab 7 (All Sections) Prelab: Verilog Review and ALU Datapath and Control

CSE140L: Components and Design Techniques for Digital Systems Lab

ECE 4514 Digital Design II. Spring Lecture 7: Dataflow Modeling

VHDL VS VERILOG.

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Schematic design. Gate level design. 0 EDA (Electronic Design Assistance) 0 Classical design. 0 Computer based language

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis


St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

CSE140L: Components and Design

CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

Design Using Verilog

CSE241 VLSI Digital Circuits Winter Recitation 1: RTL Coding in Verilog

Why Should I Learn This Language? VLSI HDL. Verilog-2

EECS150 - Digital Design Lecture 10 Logic Synthesis

Brief Introduction to Verilog HDL (Part 1)

Course Topics - Outline

Course Topics - Outline

Contents. Appendix D Verilog Summary Page 1 of 16

Speaker: Shao-Wei Feng Adviser: Prof. An-Yeu Wu Date: 2010/09/28

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

Module 4. Design of Embedded Processors. Version 2 EE IIT, Kharagpur 1

Advanced Digital Design with the Verilog HDL

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

5.14 Algorithmic State Machine (ASM) Charts

EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

Verilog Tutorial. Introduction. T. A.: Hsueh-Yi Lin. 2008/3/12 VLSI Digital Signal Processing 2

Introduction To Verilog Design. Chun-Hung Chou

VERILOG. Deepjyoti Borah, Diwahar Jawahar

Workshop on Digital Circuit Design in FPGA

Combinational Logic. Prof. Wangrok Oh. Dept. of Information Communications Eng. Chungnam National University. Prof. Wangrok Oh(CNU) 1 / 93

The Verilog Hardware Description Language Testing the Design Overview

Verilog Behavioral Modeling

EECS 427 Lecture 14: Verilog HDL Reading: Many handouts/references. EECS 427 W07 Lecture 14 1

Introduction. Why Use HDL? Simulation output. Explanation

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

Sequential Logic Design

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

Verilog for Combinational Circuits

Combinational Logic II

Week 4 Tutorial: Verilog Primer Part 2. By Steve Engels

ADVANCED DIGITAL IC DESIGN. Verilog Simulation Techniques (I)

ENGN1640: Design of Computing Systems Topic 02: Design/Lab Foundations

Amrita Vishwa Vidyapeetham. EC429 VLSI System Design Answer Key

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

Modeling Sequential Circuits in Verilog

Chapter 2 Using Hardware Description Language Verilog. Overview

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

Transcription:

EE 335 : Advanced Microprocessor Chapter-5 Logic Design with Behavioral Models of Combinational and Sequential Logic Ajay Kumar Yadav (Instructor) Electrical & Computer Engineering Temple University

Data Types for Behavioral Modeling: Data types are classified in two categories: Nets (wire) : establish connectivity between design objects. Register (reg) : similar to variable in ordinary procedural language, stores the information while the program executes. Integer : word length depends on the type of computer.

Nets: Net Types wire tri wand wor Establish connectivity, No Logical behavior or functionality implied. Establish Connectivity like wire, used to indicate three stated in hardware. Connected to the output of multiple primitives, implementation of wired AND. Connected to the output of multiple primitives, implementation of wired OR.

Register Variables: reg : hardware storage element. Default size is single bit and default value is x. integer: : supports numeric computation in procedural statements. Word length depends upon the host machine. Default initial value is 0. Assigned value must be decimal equivalent. real: : A 64 bit value stored in double precision. Default initial value is 0.0 0.0. $realtobits and $bitstoreal syntax are used to convert data types to permit real data transfer. Constants: A constant is declared with the keyword parameter.. Constant can be a integer, real number or reg type.

Two Dimensional Array: reg [31:0] memory [0:256] Word size Memory size User Defined Name

Two channel Mux with 32-bit Datapath:

Propagation Delay & Continuous Assignments:

Verilog Counterparts: Logic Description Circuit Schematic Verilog Description Structural Model Truth Table User-Defined Primitives Boolean Equations Continuous Assignments

Cyclic Behavioral Models: Model edge sensitive functionality (e.g. posedge or negedge of clock). Cyclic Behavior is abstract do not use hardware to specify signal values. Do not expire after the execution of last procedural statements. Execution can be unconditional or can be governed by an optional event control expression. Capable of modeling both edge sensitive and level sensitive behavior. Continuous-assignment statement are limited to level sensitive modeling

Cyclic Behavior & Edge Detection: Always activate at the beginning of the simulation. Delay control operator and event control operator control the execution.(#,@ #,@) posedge and negedge are the two event control expressions used for rising edge and falling edge respectively. After a complete execution of cyclic behavior, the computational activity flow return to the always keyword. If a procedural statement has both delay and event control expression, the activity will wait for the indicated time and then test for event control expression.

Continuous-Assignment Models: A B Compare_32 A_gt_B A_lt_B A_eq_B module compare_32 (A_gt_B, A_lt_B, A_eq_B, A, B) ; parameter size=32 ; input [size-1:0] A, B; output A_gt_B, A_lt_B, A_eq_B ; assign A_gt_B = (A>B), A_lt_B= (A<B), A_eq_B = (A==B) ; endmodule

Dataflow/RTL Models: Describes concurrent operations on signals in a sequential machine. The computations are initiated at the active edge of clk and completed in a time to be stored in a register at the next active edge. RTL model are written for a specific architecture :that is, the registers, data paths and machine operations and their schedule are known a priori.

Blocking and Non-Blocking Operator: Ordinary procedural assignment operator =, stores the value immediately after the statement execution and before the next statement can execute. Also called as Blocking assignment operator. If there is data dependencies among the variables, outcome may get affected. To avoid such cases Non-Blocking assignment <= <= operator is generally used. It effectively executes the statement concurrently rather than sequentially.

Example(4-bit serial shift register): module shiftreg_ba(a,e, clk, rst); input E, clk, rst; output A; reg A, B, C, D; always @(posedge clk or posedge rst) begin if (rst) begin A=0; B=0; C=0; D=0; else begin D=E; C=D; B=C; A=B; end end end always @(posedge clk or posedge rst) begin if (rst) begin A=0; B=0; C=0; D=0; end else begin D<=E; C<=D; B<=C; A<=B; end end endmodule

Simulation Result: Blocking Operator Non-Blocking Operator

Algorithm-Based Models: Algorithms based models are abstract in nature. It defines the sequence of procedural assignment within a cyclic behaviour, the execution of statement determines the storage variable and output of the machine. Eliminates the need of a priori architecture. Algorithm model execute sequentially, without an explicit architecture. Not all Algorithms can be implemented in hardware

Linear Feedback Shift Register: Reset C3 C2 C1 R D S Clk R D S R D S + + + Y[1] Clk Y[2] Clk Y[3] R D S Clk Y[4] Clock Used in data-compression circuits implementing a signature analysis technique called cyclic redundancy check. C1, C2, C3 are binary tap coefficients, which determine whether Y[N] is fed back to a given stage of the register. Vector of tap coefficients characterize polynomial of LFSR and its cyclic nature.

Verilog code of LFSR: module LFSR (Y, clk, rst); parameter length=8; parameter in_state =8'b10010001; parameter [1:length] tap=8'b11001111; input clk, rst; output [1:length] Y; reg [1:length] Y; always @(posedge clk) begin if(rst==0) Y<=in_state; end endmodule else begin end Y[1]<=Y[8]; Y[2]<=tap[7]?Y[1]^Y[8]:Y[1]; Y[3]<=tap[6]?Y[2]^Y[8]:Y[2]; Y[4]<=tap[5]?Y[3]^Y[8]:Y[3]; Y[5]<=tap[4]?Y[4]^Y[8]:Y[4]; Y[6]<=tap[3]?Y[5]^Y[8]:Y[5]; Y[7]<=tap[2]?Y[6]^Y[8]:Y[6]; Y[8]<=tap[1]?Y[7]^Y[8]:Y[7];

Simulation result of LFSR:

Digital Machines with Repetitive Algorithms: *** Data movement in LFSR for multiple cycles ***

Loop Constructs in Verilog: for loop: for( initial_stat; control_exp; index _stat) repeat loop: repeat ( N) while loop: while (expression) forever loop: causes unconditional repetitive execution of statements, subject to the disable statement. *** repeat can also be terminated by a disable statement ***

Example for for loop: *** Verilog code for multiple cycle in LFSR ***

Intellectual Property Reuse: count =0; temp_reg = data; // storing the data word in temp register while (temp_reg) begin if (temp_reg [0] ) count =count+1; temp_reg = temp_reg >> 1; end while (temp_reg) begin end count =count + temp_reg[0]; temp_reg = temp_reg >> 1; *** while loop will execute till the time temp register is not equal to zero ***

Difference between forever & always : always declares a concurrent behaviour whereas forever loop is a computational activity flow and used within the behaviour only. forever loop can be nested whereas always cannot be nested. forever loop executes within a sequential activity flow, whereas always becomes active and execute at the beginning of the simulation. To stop the forever loop disable is required but always automatically stops at the end of the simulation.

Example of disable construct : output [3:0] index; input [15:0] word; input trigger; reg [3:0] index; always @ (trigger) begin: search_1 index = 0; for ( index = 0; index <= 15; index = index+1 ) if ( word [index]) disable search_1; end 1. Execution of disable allows the simulator to come out of the loop. 2. If there is named block after the disable, it will prematurely terminate the named block of procedural statement

Tasks: Declared within a module and referenced only from within a cyclic or single pass behavior. Assigned parameters are associated with the declared input and output variables of the task. Additional local variables can be declared within a task. task must be named and all the declarations are local to the task. All the arguments to the task are passed by a value not by a pointer to the value. task may have event control operator but not delay control operator.

Example of task : module task_a (out, sum, in, data_a, data_b, clk, rst); output [3:0] sum; output out; input [3:0] data_a, data_b ; input clk, rst, in; reg sum, out; always @ (posedge clk or posedge rst) begin if (rst) {out,sum}<=0; else Add(out, sum, data_a, data_b, in); task add; output [3:0] sum; output out; input [3:0] data_a, data_b; input in; begin {out,sum}<=data_a + ( data_b + in); end end endmodule endtask

Functions: functions are declared within a parent module and can be referenced in any valid expression. function returns a value at the function s identifier. function cannot invoke task and may not contain a timing controls. ( @, #, wait ) function can call other functions but not recursively. It may contain a declaration of input and local variables, but may not have declared output.

Example of function : module word_align (word_out, word_in); output [7:0] word_out; input [7:0] word_in ; assign word_out = align_word(word_in); function [7:0] align_word; input [7:0] word_in; begin align_word = word_in; if (align_word!=0) while (align_word[7]= = 0 ) align_word = align_word<<1; end endfunction endmodule

ASM Charts for Behavioral Modeling : Algorithmic state machine (ASM) charts are an abstraction of the functionality of a sequential machine. Display the computational activity as well as the sequential steps that occur under the influence of the machine s input. An ASM chart is organized into blocks using three fundamental elements: state box, decision box and conditional box.

ASM Chart for a Vehicle Speed Controller : Brake has Priority over Accelerator

ASMD Chart : Two stage Pipeline Register

ASM charts for an Up-Down Counter : Up- down Counter with and without the conditional output boxes

Barrel Shifter : Used in digital signal processors to avoid overflow problems by scaling the input and output of a datapath operation. Shifting the word to the right effectively divide the word by a power of 2 whereas shifting to the left multiplies the word by a power of 2. It can be implemented using the combinational logic as well as registered logic.

8-bit Barrel Shifter with Registered Output :

Example of 32-Word Register File : assign Data_Out_1=Reg_file[Read_Addr_1]; assign Data_Out_2=Reg_file[Read_Addr_2]; always @ (posedge clock) begin if (Write_Enable) Reg_file[Write_Addr]<=Data_in; end endmodule

Keypad Scanner and Encoder :

Keypad Code for Hexadecimal Scanner : Key Row [3:0] Col [3:0] Code 0 0001 0001 0000 1 0001 0010 0001 2 0001 0100 0010 3 0001 1000 0011 4 0010 0001 0100 5 0010 0010 0101 6 0010 0100 0110 7 0010 1000 0111 8 0100 0001 1000 9 0100 0010 1001 A 0100 0100 1010 B 0100 1000 1011 C 1000 0001 1100 D 1000 0010 1101 E 1000 0100 1110 F 1000 1000 1111

ASM Chart for Keypad :

Text Bench Model for Hex-Keypad : Row[0] Code[3] Signal Generator for Keys Key X 16 Row_Signal Row[1] Row[2] Row[3] Grayhill 072 Hex Keypad Code Generator Code[2] Code[1] Code[0] Valid Col [1] Col [0] Col [2] Col [3] ***www.grahill.com***

Summary : Data types are broadly classified as net and wire. Different systems can be implemented using Cyclic Behavioral, Dataflow/RTL and Architectural based model. Different loop constructs which Verilog supports are: for, while, repeat and forever. Verilog supports two types of subprograms: Task create a hierarchical organization of the procedural statements within a verilog behavior. Function substitute for an expression. ASM charts are abstraction of the functionality of a sequential machine and are used to model the behavior of the system.