SystemVerilog for Verification

Slides:



Advertisements
Similar presentations
IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
Advertisements

What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Pointers in C Rohit Khokher
C++ Data Type String A string is a sequence of characters enclosed in double quotes. Examples of strings: “Hello” “CIS 260” “Students” The empty string.
Structure of a C program
Java Syntax Primitive data types Operators Control statements.
CS1061 C Programming Lecture 4: Indentifiers and Integers A.O’Riordan, 2004.
CS Nov 2006 C-strings.
Variables and constants Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences.
1 Agenda Variables (Review) Example Input / Output Arithmetic Operations Casting Char as a Number (if time allow)
Data Types.
Java Primitives The Smallest Building Blocks of the Language (corresponds with Chapter 2)
C programming for Engineers Lcc compiler – a free C compiler available on the web. Some instructions.
C Tokens Identifiers Keywords Constants Operators Special symbols.
Characters The data type char represents a single character in Java. –Character values are written as a symbol: ‘a’, ‘)’, ‘%’, ‘A’, etc. –A char value.
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.
CISC105 – General Computer Science Class 9 – 07/03/2006.
Data Types. Data types Data type tells the type of data, that you are going to store in memory. It gives the information to compiler that how much memory.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 2 Basic Elements of Java.
Characters. Character Data char data type – Represents one character – char literals indicated with ' '
CSCI 130 Chapter 3. Variables & Names Variable Declarations: –reserve a storage location in memory –identify the name of the variable –identify the type.
Java Overview. Comments in a Java Program Comments can be single line comments like C++ Example: //This is a Java Comment Comments can be spread over.
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
1 Cannon_Chapter9 Strings and the string Class. 2 Overview  Standards for Strings  String Declarations and Assignment  I/O with string Variables 
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Chapter2 Constants, Variables, and Data Types. 2.1 Introduction In this chapter, we will discuss –constants (integer, real, character, string, enum),symbolic.
Sahar Mosleh California State University San MarcosPage 1 Character String.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
0 Chap.2. Types, Operators, and Expressions 2.1Variable Names 2.2Data Types and Sizes 2.3Constants 2.4Declarations 2.5Arithmetic Operators 2.6Relational.
Structure A collection of values (members) struct date{ int day; char month[10]; int year; }; Declare a structure variable struct date today; struct struct_name.
Pointers A pointer type variable holds the address of a data object or a function. A pointer can refer to an object of any one data type; it cannot refer.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Java Programming Language Lecture27- An Introduction.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
The C++ Data Types Fundamental Data Types
Chapter 6 – Data Types CSCE 343.
Data types Data types Basic types
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
BASIC ELEMENTS OF A COMPUTER PROGRAM
Chap. 2. Types, Operators, and Expressions
Chapter 6: Data Types Lectures # 10.
Lecture-5 Arrays.
CSE 303 Lecture 14 Strings in C
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
C Short Overview Lembit Jürimägi.
C Basics.
Module 2 Arrays and strings – example programs.
Strings A string is a sequence of characters treated as a group
Java Programming: From Problem Analysis to Program Design, 4e
DATA HANDLING.
Advanced Programming Behnam Hatami Fall 2017.
Advanced Programming in Java
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Advanced Programming Basics
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
Basics of ‘C’.
Pointers, Dynamic Data, and Reference Types
Review for Final Exam.
SystemVerilog for Verification
PHP.
SystemVerilog for Verification
Recap Week 2 and 3.
elementary programming
Review for Final Exam.
2. Second Step for Learning C++ Programming • Data Type • Char • Float
Programming Language C Language.
Module 2 Variables, Data Types and Arithmetic
C Language B. DHIVYA 17PCA140 II MCA.
Variables in C Topics Naming Variables Declaring Variables
Presentation transcript:

SystemVerilog for Verification Basic data types – Part II

Agenda Variable Integer Real Void Class String Event User-Defined Enumeration Real

Variable – a data storage element logic [3:0] abcd; Variable Integer Void Class String Event User-Defined Enumeration Real Integer State value Size Sign Default Value shortint 2 16 bits signed ‘0 int 32 bits longint 64 bits byte 8 bits bit user-defined vector unsigned logic 4 ‘X reg integer time

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real Real type (floating point) C-type Size Sign Default Value real double 64 bits signed 0.0 shortreal float 32 bits $realtime $realtime vs $time – Depends on timescale

Exercise Time Perform addition on bit & integer type operands, logic & bit type operands. Assign four state initial value (containing x,z,1,0) to all four types of operand... Print their initial values as well as result after addition. See the effect of data types. Assign {32{4'b1111}} to bit, byte, shortint, int, longint and integer data types and print them. Repeat the same thing with “unsigned” declaration for all above data types.. Use four state value {32{4'b01xz}} and repeat the above steps.

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real Void – nonexistence of data functions indicating no return type void = function_call(); type of tagged union

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real OOPS Can contain properties and methods class data; bit [3:0] abc; logic [4:0] cdf; integer pqr; task clean(); abc = 4’b0; cdf = 5’b0; pqr = 0; endtask endclass default value = null

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real variable size, dynamically allocated array of bytes string s0 = “Hello World”; byte s1 [0:10] = “Hello World”; s0 = {s0, “new”};  s0 : “Hello World new” Operator Semantics str1 == str2 , str1 != str2 equality str1 > str2 , >= , < , <= comparison {str1, str2} concatenation {multiplier{str1}} replication str[index] indexing str.method() methods onto strings

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real Method Description Str.len() Returns length of string Str.putc(int i, string s) Replaces ‘i’th char in string with first char in s Str.getc(int i) Returns the ASCII code of the ‘i’th char in str Str.toupper() Returns a string with chars in string converted to upper case. Source string remains unchanged Str.tolower() Returns a string with chars in string converted to lower case. Source string remains unchanged str1.compare(str2) str1.icompare(str2) Compares str1 with str2 (non case sensitive) Compares str1 with str2 (case sensitive) Str.substr(i,j) Returns new string that is a substring formed by characters in position I through j of str.

String Exercise Print the str1 and size of str1; Write 2 string variables, str1=Hello and str2=World. Print the str1 and size of str1; Declare new string variable New_Str, concatenate str1 and str2 and assign it to New_Str Print the New_Str and size of New_Str Declare new string variable NEW_STR, call the New_Str.toupper() and assign the returned string to the NEW_STR variable and then print the NEW_STR Similarly call the tolower() method, assign the returned string to new_str variable and print it. Try other string operations

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real synchronization of, two or more concurrently active processes. event a; // declaration  a; // event triggerred @(a); // waiting for occurrence of the event trigger

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real Typedef typedef data_type type_identifier ; Ex. typedef int animal; animal lion, tiger;

Variable – a data storage element Integer Void Class String Event User-Defined Enumeration Real a set of integral named constants enum {red, yellow, green} light1;  red = 0, yellow = 1, green = 2 enum bit [1:0] {IDLE, XX='x, S1=2'b01, S2=2'b10} state, next;  Syntax error enum integer {IDLE, XX='x, S1='b01, S2='b10} state, next;  IDLE = 0, others having values enum {bronze=3, silver, gold} medal;  silver = 4, gold = 5 enum {a=3, b=7, c} alphabet;  c = 8

Enum Exercise Design a sequence detector ‘1011’ using state machine. Declare present_state & next_state as enum. Hint : typedef enum logic [1:0] {s0,s1,s2,s3} state; state present_state, next_state;

Next Session – Parameter – Scope & Lifetime – Casting