SystemVerilog for Verification

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 4 Modular Programming with Functions.
Advertisements

1 Storage Duration and Scope –Local and global variables Storage classes –automatic, static, external, register Todays Material.
Chapter 8 Scope, Lifetime and More on Functions. Definitions Scope –The region of program code where it is legal to reference (use) an identifier Three.
Introduction to C# Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Scope and Lifespan of Identifiers. Every function has a scope What does that mean? That means that every identifier that is created in a function (that’s.
Chapter 7: User-Defined Functions II
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
1 Chapter 8 Scope, Lifetime, and More on Functions Dale/Weems/Headington.
Data Types.
Storage Classes.
COMPUTER PROGRAMMING. Data Types “Hello world” program Does it do a useful work? Writing several lines of code. Compiling the program. Executing the program.
C Functions Programmer-defined functions – Functions written by the programmer to define specific tasks. Functions are invoked by a function call. The.
1 CSC 221: Computer Programming I Spring 2010 interaction & design  modular design: roulette game  constants, static fields  % operator, string equals.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Defining and Converting Data Copyright Kip Irvine, 2003 Last Update: 11/4/2003.
18. DECLARATIONS.
1 SystemVerilog Enhancement Requests Daniel Schostak Principal Engineer February 26 th 2010.
Copyright © 2012 Pearson Education, Inc. Chapter 6: Functions.
CS212: Object Oriented Analysis and Design Lecture 2: Introduction to C++
 The if statement and the switch statement are types of conditional/decision controls that allow your program.  Java also provides three different looping.
User Defined Functions Chapter 7 2 Chapter Topics Void Functions Without Parameters Void Functions With Parameters Reference Parameters Value and Reference.
Object Oriented Programming (OOP) Lecture No. 11.
CSC241 Object-Oriented Programming (OOP) Lecture No. 6.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
C++ Programming Lecture 11 Functions – Part III By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372 Some Basics.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MTech[IT],MPhil (Comp.Sci), MCA, MSc[IT], PGDCA, ADCA, Dc. Sc. & Engg.
Object Oriented Programming Elhanan Borenstein Lecture #5.
Lecture 14 Miscellaneous Topics II: Enuerations, Pointers to Functions (& Prelim Review)
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Brief Edition Chapter 6 Functions.
Programming Fundamentals. Topics to be covered Today Recursion Inline Functions Scope and Storage Class A simple class Constructor Destructor.
 constant represented by a name, just like a variable, but whose value cannot be changed  The const keyword precedes the type, name, and initialization.
Verification Presentation to SystemVerilog Basic Committee Peter Flake Nov 15, 2002.
CHAPTER 8 Scope, Lifetime, and More on Functions.
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
 2000 Prentice Hall, Inc. All rights reserved Program Components in C++ Function definitions –Only written once –These statements are hidden from.
1 Chapter 8 Scope, Lifetime, and More on Functions CS185/09 - Introduction to Programming Caldwell College.
Dynamic memory allocation and Intraprogram Communication.
Variable Scope. When you declare a variable, that name and value is only “alive” for some parts of the program  We must declare variables before we use.
Advanced Programming in C
Test 2 Review Outline.
C Functions -Continue…-.
C-language Lecture By B.S.S.Tejesh, S.Neeraja Asst.Prof.
Introduction to C Programming Language
Instructor: Ioannis A. Vetsikas
Lecture Set 4 Data Types and Variables
Using local variable without initialization is an error.
Advanced Programming Basics
User Defined Functions
Namespaces, Typedefs & Enums
Variables Title slide variables.
Local Variables, Global Variables and Variable Scope
SystemVerilog for Verification
Seoul National University
Namespaces How Shall I Name Thee?.
Tonga Institute of Higher Education
The Destructor and the Assignment Operator
Programming Language C Language.
Object Oriented Programming (OOP) Lecture No. 11
Language Definitions Chap. 3 of Orange Book.
C Language B. DHIVYA 17PCA140 II MCA.
The Three Attributes of an Identifier
Seoul National University
C Programming Lecture-17 Storage Classes
Enum.
Identifiers & Lifetimes
Storage classes in C In C language, each variable has a storage class which decides the following things: scope i.e where the value of the variable would.
Object Oriented Programming (OOP) Lecture No. 12
INTRODUCTION TO C.
Scope Rules.
Presentation transcript:

SystemVerilog for Verification Basic data types – Part IV

Agenda Constant/Parameter Scope & Lifetime Casting

Elaboration-time constant Constant/Parameter constant Elaboration-time constant parameter Run-time constant const named data objects that never change. parameter logic flag = 1 ; module vector #(size = 1); vector v #(3);  Overwritten size by 3 const logic option = a.b.c ; // acts like a variable that cannot be written

Scope & Lifetime Scope File-Scope (C equivalent - global) Declaration - outside module, interface, program, task, or function Accessible anywhere in code int i1; module a1(); i1 = 2; // Ok : In scope endmodule module a2(); i1 = 3; // Ok : In scope Block-Scope (C equivalent - local) Declaration - inside module, interface, program, checker, task or function Accessible within block of code i1 = 2; // Ok : In scope i1 = 3; // ERROR : not in scope

Scope & Lifetime Lifetime Static Lifetime Exists for the whole simulation Keyword – static (default mode) for (int i = 0; i < 5; ++i) begin static int loop = 0; //optional static loop++; $display(loop); // 1 2 3 4 5 end Automatic Lifetime lifetime ends when execution leaves their scope, and recreated/reinitialized when the scope is reentered. Keyword – automatic automatic int loop = 0; $display(loop); // 1 1 1 1 1

Scope & Lifetime module t1(); int a; endmodule int a; module t1(); … Scenario file scope block scope static lifetime automatic lifetime Variables declared outside a module, program, interface, task, or function  Variables declared inside a module, interface, program, task, or function Variables explicitly declared as automatic in static task, function, or block Tasks, functions, program - declared as automatic, Variables declared in them Variables within an automatic task, function, or block can be explicitly declared as static. task automatic t1(); int a; endtask task automatic t1(); static int a; endtask task automatic t1(); int a; endtask

Casting Static Casting Dynamic Casting system task - $cast casting operator ' casting_type ' ( expression ) int'(2.0 * 3.0) shortint'({8'hFA,8'hCE}) signed'(x) unsigned'(-4); const'(x) Dynamic Casting system task - $cast typedef enum { red, green, blue} Colors; Colors col; $cast( col, 1 + 2 ); // col=value of enum equivalent to 3 - blue

Thank You