Chapter 5 Copyright 2012 G. Tumbush, C. Spear v1.2

Size: px
Start display at page:

Download "Chapter 5 Copyright 2012 G. Tumbush, C. Spear v1.2"

Transcription

1 Chapter 5, Basic OOP topics Why OOP OOP terminology Classes Objects Custom constructors Static variables/methods Classes within classes Handles Copying objects 1

2 5.1 Introduction Why OOP? Gains in productivity/maintainability/thoroughness Strongly couples data with code that manipulates it. Allows the testbench to be reused Facilitates testing at the transaction level SystemVerilog allows inheritance and polymorphism 2

3 5.2 Think of Nouns, not Verbs Create Transactions Transmit Transactions Scenario Generator Environment Functional Agent Scoreboard Checker Receive Transactions Command Driver Assertions Monitor Check Transactions Signal DUT Report 3

4 5.5 OOP Terminology Blueprint for a house A complete house House Address 123 Elm Street Class Object Handle Turn on/off switches Light switches Methods Properties Dr. Meeta Yadiv, ASIC Verification, North Carolina State University Fall

5 5.5 OOP Terminology (cont.) Blueprint for a house A complete house Address of a house Light switches Turn on/off switches Class Programming element containing related groups of features and functionality Provides a template for building objects Can be used as a data structure Object An object is an instance of a class Handle Type-safe pointer to an object can not be corrupted Properties Variables contained in the instance of the class Methods Tasks/functions (algorithms) that operate on the properties in this instance of the class Dr. Meeta Yadiv, ASIC Verification, North Carolina State University Fall

6 5.5 OOP Terminology (cont.) HDL OOP Verilog Block definition module class Block instance instance object Block name instance name handle SystemVerilog Data Types registers & wires Properties: Variables Executable Code behavioral blocks Methods: tasks (always, initial), and functions tasks, functions Communication between blocks Ports or crossmodule task calls Dr. Meeta Yadiv, ASIC Verification, North Carolina State University Fall 2007 task/function calls, mailboxes, semaphores, etc. 6

7 5.3 Your First Class class Transaction; bit [31:0] addr, crc, data[8]; function void display; $display( Transaction: %h, addr); : display properties (variables) class method function void calc_crc; crc = addr ^ data.xor; : calc_crc class method xor method : Transaction 7

8 5.4 Where to define (and use) a Class A class can be defined in: 1. program 2. module 3. package A class can be used in: 1. module 2. program 3. package 4. Can be constructed and extended Locations for defining classes: Each class in a separate file Related classes in a package 8

9 5.6 Creating new objects Call new() to allocate space for the object Transaction tr; tr = new(); Object Handle of class Transaction: does not create object itself, uninitialized value is null Class Transaction creates an object of class Transaction tr now points to the object OR Transaction tr = new(); () not required No control over initialization order and if automatic omitted, constructor called at start of simulation 9

10 5.6 Creating new objects Call new() to allocate space for the object Transaction tr; tr = new(); Calling new() procedurally: module test; Transaction tr; initial tr = new(); endmodule tr null tr transaction object 10

11 Class in a package package abc; class Transaction; // Class body endpackage program automatic test; import abc::*; Transaction tr; // Test code endprogram 11

12 Class Exercise Create a class called MemTrans that contains the following members: An 8-bit data_in of logic type A 4-bit address of logic type A void function that prints out the value of data_in and address Construct a MemTrans object in an initial block 12

13 Class Exercise (cont.) Create a class called MemTrans that contains the following members: An 8-bit data_in of logic type A 4-bit address of logic type A void function that prints out the value of data_in and address class MemTrans; logic [7:0] data_in; logic [3:0] address; function void print; $display( Data_in = %h, address = %h, data_in, address); Construct a MemTrans object in an initial block initial begin MemTrans MyMemTrans; MyMemTrans = new(); end // or initial begin MemTrans MyMemTrans = new(); end 13

14 5.6.2 Custom Constructor For every class SystemVerilog creates a default new() Memory space is allocated All variables initialized to their default value The custom constructor does more than allocate memory it also initializes the values. Overloads new() class Transaction; logic [31:0] addr, crc, data[8]; function new(); addr = 3; data = '{default:5}; 14

15 Custom Constructor Exercise Using your MemTrans class create a custom constructor so that data_in and address are both initialized to 0. 15

16 Custom Constructor Exercise Using your MemTrans class create a custom constructor so that data_in and address are both initialized to 0. class MemTrans; logic [7:0] data_in; logic [3:0] address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new; data_in = 8 h0; address = 4 h0; 16

17 5.6.2 Custom Constructor with arguments Make the custom constructor more flexible by passing in values Defaults are used if argument(s) are not passed class Transaction; logic [31:0] addr, crc, data[8]; function new(logic [31:0] a=3, d=5); addr = a; data = '{default:d}; tr1 = new(10); tr2 = new(, 6); tr3 = new(10, 6); tr4 = new(.a(10),.d(6)); 17

18 Custom Constructor with args Exercise Using your MemTrans class create a custom constructor so that data_in and address are both initialized to 0 but can also be initialized through arguments passed into the constructor 1. Create 2 new MemTrans objects 2. Initialize address to 2 in the 1 st object, passing arguments by name 3. Initialize data_in to 3 and address to 4 in the 2 nd object, passing arguments by name. 18

19 Custom Constructor with args Exercise Using your MemTrans class create a custom constructor so that data_in and address are both initialized to 0 but can also be initialized through arguments passed into the constructor 1. Create 2 new MemTrans objects class MemTrans; logic [7:0] data_in; logic [3:0] address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new(logic [7:0] data_init = 0, logic [3:0] address_init = 0); data_in = data_init; address = address_init; 2. Initialize address to 2 in the 1 st object, passing arguments by name 3. Initialize data_in to 3 and address to 4 in the 2 nd object, passing arguments by name. initial begin MemTrans mt1, mt2; mt1 = new(.address_init(2)); mt2 = new(.data_init(3),.address_init(4)); end 19

20 5.7 Object Deallocation Garbage collection, i.e. reclaiming unused memory, is automatic An object is deallocated if no handles point to it. Transaction t1, t2; t1 = new(); t2 = t1; t1 = null, t2=null t2=null, t1 t2 Object A t1 = new(); t2 t1 t1 = null; Object A t2 Object A Object B t1 = null Object B 20

21 5.8 Using Objects Similar to Verilog, use the. delimiter to access properties (variables) and methods (tasks and functions) of a class. Recall: class Transaction; bit [31:0] addr, crc, data[8]; function void display; $display( Transaction: %h, addr); Endfunction function void calc_crc; crc = addr ^ data.xor; Endfunction properties (variables) methods (tasks or functions) Usage: Transaction t; t = new(); t.addr = 32 h42; t.display(); () not required 21

22 Using Objects Exercise Using the previous MemTrans exercise assign the address of the first object to 4 hf after construction Use the print function to print out the values of data_in and address for the 2 objects. Explicitly deallocate the 2 nd object. 22

23 Using Objects Exercise Assign the address of the first object to 4 hf after construction Use the print function to print out the values of data_in and address for the 2 objects. Explicitly deallocate the 2 nd object. class MemTrans; logic [7:0] data_in; logic [3:0] address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new(logic [7:0] data_init = 0, logic [3:0] address_init = 0); data_in = data_init; address = address_init; initial begin MemTrans mt1, mt2; mt1 = new(,.address_init(2)); mt2 = new(3, 4); mt1.address = 4 hf; mt1.print; $display(" "); mt2.print; mt2 = null; end # Data_in = 00, address = f # # Data_in = 00, address = 0 23

24 5.10 Defining Methods Outside of the Class Done to keep the class definition readable Define a prototype of the method in the class Use the extern keyword to indicate the full definition is external class PCI_Tran; bit [31:0] addr, data; extern function void display(); Specify the class that the function is defined for function void PCI_Tran::display(); $display( %0t: PCI: addr = %h, data = %h, $time, addr, data); 24

25 5.11 Static Variables vs. Global Variables Global variable has no limits on manipulation Static variable: Can only be modified by objects of one class Shared among all objects Associated with the class, not the object class Transaction; static int count = 0; int id; function new(); id = count++; Only one copy of static variable count exists which is shared amongst all instances of the class Non-static variable id and thus one copy per object and specific to each object 25

26 5.11 Static Variables vs. Global Variables Global variable has no limits on manipulation Static variable: Can only be modified by objects of one class Shared among all objects Associated with the class, not the object class Transaction; static int count = 0; int id; function new(); id = count++; transaction t1, t2, t3; initial begin t1 = new(); t2 = new(); t3 = new(); end object of class Transaction id =0 object of class Transaction id =1 object of class Transaction id =2 class Transaction count =3 26

27 5.11 Static/Global Variables (cont) initial begin Transaction t1, t2, t3; t1 = new(); $display("first id = %0d, count = %0d", t1.id, t1.count); t2 = new(); $display("first id = %0d, count = %0d", t1.id, t1.count); $display("second id = %0d, count = %0d", t2.id, t2.count); t3 = new(); $display("first id = %0d, count = %0d", t1.id, t1.count); $display("second id = %0d, count = %0d", t2.id, t2.count); $display( Third id = %0d, count = %0d", t3.id, t3.count); end # First id = 0, count = 1 # First id = 0, count = 2 # Second id = 1, count = 2 # First id = 0, count = 3 # Second id = 1, count = 3 # Third id = 2, count = 3 If count was not declared as static: # First id = 0, count = 1 # Second id = 0, count = 1 27

28 Class Scope Resolution Operator :: Object member reference operator. Refers to the member of the class Applies to all static elements of a class: static properties static methods typdefs enumerations unions nested class declarations Object member reference operator. Refers to a member of a class instance Chapter 5 Copyright 2012 G. Tumbush, C. Spear v1.2 28

29 Accessing Static Variables... Only one copy of a static variable exists. Static variables can be accessed through the class or handle class Transaction; static int count = 0; int id; function new(); id = count++; // new initial begin Transaction t1, t2; Print count value before object created # 1) Transaction::count = 0 # First id = 0d0, count = 0d1 # Second id = 0d1, count = 0d2 # 2) Transaction::count = 0d2 class scope resolution operator $display("1) Transaction::count = %0d", Transaction::count); t1 = new(); $display("first id = 0d%0d, count = 0d%0d", t1.id, t1.count); t2 = new(); $display("second id = 0d%0d, count = 0d%0d", t2.id, t2.count); $display("2) Transaction::count = 0d%0d", Transaction::count); end 29

30 Static Variables Exercise Using the previous MemTrans exercise create a static variable last_address that holds the initial value of the address variable from the most recently created object, as set in the constructor. After allocating objects of class MemTrans (done in last exercise) print out the current value of last_address. class MemTrans; logic [7:0] data_in; logic [3:0] address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new(logic [7:0] data_init = 0, logic [3:0] address_init = 0); data_in = data_init; address = address_init; initial begin MemTrans mt1, mt2; mt1 = new(,.address_init(2)); mt2 = new(3, 4); mt1.address = 4 hf; mt1.print; $display(" "); mt2.print; mt2 = null; end 30

31 Static Variables Exercise Using the previous MemTrans exercise create a static variable last_address that holds the initial value of the address variable from the most recently created object, as set in the constructor. class MemTrans; logic [7:0] data_in; logic [3:0] address; static logic [3:0] last_address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new(logic [7:0] data_init = 0, logic [3:0] address_init = 0); data_in = data_init; address = address_init; last_address = address; 31

32 Static Variables Exercise After allocating objects of class MemTrans (done in last exercise) print out the current value of last_address. initial begin # Data_in = 00, address = f MemTrans mt1, mt2; # Data_in = 03, address = 4 mt1 = new(,.address_init(2)); # last_address is 4 mt2 = new(3, 4); # last_address is 4 mt1.print; mt2.print; $display("last_address is %h", MemTrans::last_address); // or $display("last_address is %h", mt2.last_address); mt2 = null; end 32

33 Initializing static variables Useful when every instance of a class needs info from an object of another class class Transaction; static Config cfg; A handle with static storage initial begin Transaction::cfg = new(.num_trans(42)); end Create a new config object and assign handle of new Config object to static handle cfg in class Transaction 33

34 class Transaction; static int count = 2; int id; function new(); id = count++; static function void dec_count(); --count; Static Methods Manipulating static variables with a method accessed with the class name requires a static method Static methods can only access static class properties or methods of their own class. Static methods can be called anywhere within a SystemVerilog program, even without any class instantiation (as shown below). method dec_count must be declared as static # 3) Transaction.count = 1 # 3) Transaction.count = 1 initial begin $display("3) Transaction.count = %0d", Transaction::count); Transaction::dec_count(); $display("3) Transaction.count = %0d", Transaction::count); end 34

35 Static Methods Exercise Using the previous MemTrans exercise create a static method called print_last_address that prints out the value of static variable last_address After allocating objects of class MemTrans, call the method print_last_address to print out the value of last_address class MemTrans; logic [7:0] data_in; logic [3:0] address; static logic [3:0] last_address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new(logic [7:0] data_init = 0, logic [3:0] address_init = 0); data_in = data_init; address = address_init; last_address = address; MemTrans::last_address = address; 35

36 Static Methods Exercise Using the previous MemTrans exercise create a static method called print_last_address that prints out the value of static variable last_address class MemTrans; logic [7:0] data_in; logic [3:0] address; static logic [3:0] last_address; function void print; $display( Data_in = %h, address = %h, data_in, address); function new(logic [7:0] data_init = 0, logic [3:0] address_init = 0); data_in = data_init; address = address_init; MemTrans::last_address = address; static function void print_last_address; $display("last_address is %h", last_address); 36

37 Static Methods Exercise After allocating objects of class MemTrans, call the method print_last_address to print out the value of last_address initial begin MemTrans mt1, mt2; mt1 = new(,.address_init(2)); mt2 = new(3, 4); m1.address = 4 hf; mt1.print; mt2.print; MemTrans::print_last_address; or mt2.print_last_address; <- don t recommend this. mt2 = null; end 37

38 5.12 Scoping Rules int limit = 3; program automatic p; int limit; class Foo; int limit = 5, array[]; function void print (int limit); for (int i=0; i<limit; i++) $display( %m: array[%0d]=%0d, i, array[i]); initial begin int limit = $root.top.limit; Foo bar; // Declare bar = new(); // Construct bar.print(limit); bar.print(bar.limit); end endprogram # top.p.foo.print: array[0]=0 # top.p.foo.print: array[1]=0 # top.p.foo.print: array[2]=0 # # top.p.foo.print: array[0]=0 # top.p.foo.print: array[1]=0 # top.p.foo.print: array[2]=0 # top.p.foo.print: array[3]=0 # top.p.foo.print: array[4]=0 38

39 5.12 Scoping Rules (cont.) SystemVerilog searches up the scopes for variables program automatic test; int i; class Bad; logic [31:0] data[] = {1,2,3,4,5}; function void display; for (i=0;i<data.size(); i++) $display( data[%0d]d=%x, i, data[i]); initial begin Bad stuff; stuff = new(); stuff.display; $display("int i = %0d",i); end endprogram # data[0]= # data[1]= # data[2]= # data[3]= # data[4]= # int i = 5 Declare classes in a package. 39

40 5.12 Scoping Rules (cont.) SystemVerilog searches up the scopes for variables program automatic test; int i; class Bad; logic [31:0] data[] = {1,2,3,4,5}; function void display; for (int i=0;i<data.size(); i++) $display( data[%0d]d=%x, i, data[i]); initial begin Bad stuff; stuff = new(); stuff.display; $display("int i = %0d",i); end endprogram # data[0]= # data[1]= # data[2]= # data[3]= # data[4]= # int i = 0 Declare classes in a package. 40

41 What is this? Keyword this allows unambiguous reference to class variables/methods, etc. Commonly used in custom constructors where argument to constructor matches a class variable. Lazy programming??? class Scoping; string oname; function new(string oname); this.oname = oname; class Scoping; string oname; function new(string new_oname); oname = new_oname; initial begin Scoping mine; mine = new("test"); $display("%s",mine.oname); end # test 41

42 Another example: What is this? (cont.) module sample5p21(); class ASICwithAnkit ; int a, b; function new (int default_a = 333, int default_b = 444); this.a = default_a; b = default_b; Custom Constructor initial begin ASICwithAnkit AwA = new (123); ASICwithAnkit AwB = new (,456); $display ("AwA.a = %d", AwA.a); $display ("AwA.b = %d", AwA.b); end # AwA.a = 123 # AwA.b = 444 endmodule 42

43 5.13 Using one Class Inside Another Objects of a class can be created inside another class Enables reuse and is similar to composition class Statistics; time startt; static int ntrans = 0; static time total_elapsed_time = 0; extern function void start(); extern function void stop(); // Statistics function void Statistics::start(); startt = $time; $display("startt = %0t", startt); // start total_elapsed_time = total_elapsed_time + how_long function void Statistics::stop(); time how_long = $time - startt; $display("how_long = %0t", how_long); ntrans++; $display("ntrans = %0d", ntrans); total_elapsed_time += how_long; $display("total_elapsed_tim = %0t", total_elapsed_time); 43

44 Using Statistics inside another Class (cont.) class Transactions; bit [31:0] addr, csm, data[8]; Statistics stats; function new(); stats = new(); task transmit_me(); stats.start(); #100; stats.stop(); endtask // Transactions Transactions t1; // Declare handle initial begin t1 = new(); // Allocate a Transactions object t1.transmit_me; end # startt = 0 # how_long = 100 # ntrans = 1 # total_elapsed_tim =

45 Compilation Order Issue Compilation order of classes is not as lenient as modules Example: two classes each need a handle to the other. class Transaction; Statistics stats; class Statistics; Invalid type 'Statistics'. typedef class Statistics; class Transaction; Statistics stats; class Statistics; 45

46 Classes within Classes Exercise Complete function print_all in class MemTrans to print out data_in and address using base class PrintUtilities. Demonstrate its usage. class PrintUtilities; function void print_4(input string name, input [3:0] val_4bits); $display("%t: %s = %h", $time, name, val_4bits); function void print_8(input string name, input [7:0] val_8bits); $display("%t: %s = %h", $time, name, val_8bits); class MemTrans; bit [7:0] data_in; bit [3:0] address; PrintUtilities print; function new(); print = new(); function void print_all;... 46

47 class MemTrans; bit [7:0] data_in; bit [3:0] address; PrintUtilities print; function new(); print = new(); // new Classes within Classes Exercise function void print_all; print.print_8("data_in", data_in); print.print_4("address", address); // print_data_address program automatic test; // import my_package::*; initial begin MemTrans mt1, mt2; mt1 = new(); mt1.print_all; mt1.print.print_8("data_in", mt1.data_in); end endprogram # 0: data_in = 00 # 0: address = 0 # 0: data_in = 00 47

48 Passing objects/handles to methods What happens when an object (instance of a class) is passed to a method? The handle to the object is passed, not the object. A copy of the handle is made task generator; Transaction gen; gen = new; transmit(gen); endtask task transmit(input Transaction trans);... endtask gen handle object of class Transaction trans handle 48

49 Modifying a handle in a task Specify ref on method arguments you want to modify function automatic void create(ref Transaction tr); function void create(transaction tr); tr = new(); tr.addr = 42;... original tr cannot be modified as copied Transaction t; initial begin create(t); $display(t.addr); end What does t point to? # 42 49

50 task generator_bad(int n); Transaction t; t = new(); repeat (n) begin t.addr = $random(); $display( Sending addr = %h, t.addr); transmit(t); end endtask Modifying Objects in Flight Be sure to create a new object for each transaction Otherwise every object could be the same initial begin generator_bad(5); end 1 object shared by n transmit calls class Transaction; logic[3:0] addr; static int count = 0; int id; function new(); id = count++; // new $display("transaction::count = %0d", Transaction::count); $display("t.addr = %h", generator_bad.t.addr); # Sending addr = 4 # Sending addr = 1 # Sending addr = 9 # Sending addr = 3 # Sending addr = d # Transaction::count = 1 # t.addr = d 50

51 task generator_bad(int n); Transaction t; repeat (n) begin t = new(); t.addr = $random(); $display( Sending addr = %h, t.addr); transmit(t); end endtask Modifying Objects in Flight Be sure to create a new object for each transaction Otherwise every object could be the same initial begin generator_bad(5); end class Transaction; logic[3:0] addr; static int count = 0; int id; function new(); id = count++; // new $display("transaction::count = %0d", Transaction::count); $display("t.addr = %h", generator_bad.t.addr); # Sending addr = 4 # Sending addr = 1 # Sending addr = 9 # Sending addr = 3 # Sending addr = d # Transaction::count = 5 # t.addr = d 51

52 Array of Handles Your testbench might need to store and reference many objects An array of handles is convenient for this. tarray is made of handles, not objects. task generator(); Transaction tarray[10]; foreach (tarray[i]) begin tarray[i] = new(); transmit(tarray[i]); end endtask 52

53 Objects and Handles Exercise program automatic test; import my_package::*; initial begin end task generator endtask Declare an array of 5 Transaction handles Call a generator task to create the objects Complete the generator task header Create objects for every handle in the array and transmit the object. task transmit(transaction tr);... endtask // transmit endprogram 53

54 Objects and Handles Exercise program automatic test; import my_package::*; initial begin Transaction tarray[5]; generator(tarray); end Declare an array of 5 Transaction handles Call a generator task to create the objects task generator(ref Transaction gen_array[5]); foreach (gen_array[i]) begin Complete the generator task header gen_array[i] = new(); Create objects for every handle in the transmit(gen_array[i]); array and transmit the object. end endtask task transmit(transaction tr); endtask // transmit endprogram 54

55 5.15 Copying Objects Pass a copy of an object to a method to keep it from being modified Any custom constructor is not called class Transaction; bit [31:0] addr; static int count = 0; int id; Statistics stats; function new(); stats = new(); id = count++; # src: id = 0, startt = 0 # src: id = 0, startt = 42 # src: id = 0, startt = 42 # dst: id = 0, startt = 42 # src: id = 0, startt = 96 # dst: id = 0, startt = 96 src Transaction src, dst; initial begin src = new(); src.stats.startt=42; dst src id=0 stats dst = new src; id=0 stats id=0 stats startt=42 startt=42 dst.stats.startt = 96; 96 55

56 Writing a Deep Copy Function Suggested for all but the most trivial classes class Transaction; bit [31:0] addr; static int count = 0; int id; Statistics stats; function new(); stats = new(); id = count++; function Transaction copy(); copy = new(); copy.addr = addr; copy.stats = stats.copy(); class Statistics; time startt; function Statistics copy(); copy = new(); copy.startt = startt; UVM data macros do this for you automatically! 56

57 Using the Deep Copy Function Transaction src, dst; initial begin src = new(); src.stats.startt=42; src id=0 stats startt=42 dst = src.copy(); src dst id=0 stats id=1 stats startt=42 startt=42 end dst.stats.startt = 96; src dst id=0 stats id=1 stats startt=42 startt=96 57

58 Copy Exercise For the following class create a copy function and demonstrate its usage. Assume the Statistics class has its own copy function. package automatic my_package; class MemTrans; bit [7:0] data_in; bit [3:0] address; Statistics stats; function new(); data_in = 3; address = 5; stats = new(); ; endpackage 58

59 5.17 Public vs Local C++/Java All variables in a class are local by default Classes provide accessor functions to allow access and modify data Long term software stability is paramount. SystemVerilog All variables in a class are public by default Allows greatest control over DUT Variables can be labeled local or protected. local - Member is available only to the method of the same class. Moreover, a local member will not be available even to the subclasses. Protected - similar to a local declaration, but a member will be visible inside subclasses Tradeoff between software stability and flexibility. 59

60 local example: class baseclass; local int i; 5.17 Public vs Local program top; initial begin localvar lvar = new(); lvar.i = 123; Same error if declared protected end endprogram ** Error: localexample.sv(18): Access to local member 'i' from outside a class context is illegal. 60

61 local subclass example: class parentclass; local int i; 5.17 Public vs Local Class subclass extends parentclass; function new(); i = 10; // new Compiles sucessfully if protected ** Error: localexample.sv(9): Illegal use of local name baseclass::i' ** Error: localexample.sv(9): Undefined variable: i. 61

62 5.18 Building a Testbench Test Scenario Generator Environment Functional Command Agent Driver Scoreboard Assertions Checker Monitor Functional Coverage Signal DUT 62

List of Examples List of Figures List of Tables. Acknowledgments 1. VERIFICATION GUIDELINES 1

List of Examples List of Figures List of Tables. Acknowledgments 1. VERIFICATION GUIDELINES 1 Contents List of Examples List of Figures List of Tables Preface Acknowledgments xiii xxvii xxix xxxi xxxvii 1. VERIFICATION GUIDELINES 1 1.1 The Verification Process 2 1.2 The Verification Methodology

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

System-Level Verification Platform using SystemVerilog Layered Testbench & SystemC OOP

System-Level Verification Platform using SystemVerilog Layered Testbench & SystemC OOP , pp.221-230 http://dx.doi.org/10.14257/ijca.2014.7.2.21 System-Level Verification Platform using SystemVerilog Layered Testbench & SystemC OOP Young-Jin Oh and Gi-Yong Song * Department of Electronics

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Data Abstraction. Hwansoo Han

Data Abstraction. Hwansoo Han Data Abstraction Hwansoo Han Data Abstraction Data abstraction s roots can be found in Simula67 An abstract data type (ADT) is defined In terms of the operations that it supports (i.e., that can be performed

More information

CSE 303: Concepts and Tools for Software Development

CSE 303: Concepts and Tools for Software Development CSE 303: Concepts and Tools for Software Development Hal Perkins Autumn 2008 Lecture 24 Introduction to C++ CSE303 Autumn 2008, Lecture 24 1 C++ C++ is an enormous language: All of C Classes and objects

More information

List of Code Samples. xiii

List of Code Samples. xiii xiii List of Code Samples Sample 1-1 Driving the APB pins 16 Sample 1-2 A task to drive the APB pins 17 Sample 1-3 Low-level Verilog test 17 Sample 1-4 Basic transactor code 21 Sample 2-1 Using the logic

More information

INF5430. SystemVerilog for Verification. Chapter Randomization

INF5430. SystemVerilog for Verification. Chapter Randomization INF5430 SystemVerilog for Verification Chapter 6.1-12 Randomization Chapter 6: Randomization Directed testing: Checks only anticipated bugs Scales poorly as requirements change Little upfront work Linear

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

Verification Prowess with the UVM Harness

Verification Prowess with the UVM Harness Verification Prowess with the UVM Harness Interface Techniques for Advanced Verification Strategies Jeff Vance, Jeff Montesano Verilab Inc. October 19, 2017 Austin SNUG 2017 1 Agenda Introduction UVM Harness

More information

Chap 4 Connecting the Testbench and. Design. Interfaces Clocking blocks Program blocks The end of simulation Top level scope Assertions

Chap 4 Connecting the Testbench and. Design. Interfaces Clocking blocks Program blocks The end of simulation Top level scope Assertions Chap 4 Connecting the Testbench and Interfaces Clocking blocks Program blocks The end of simulation Top level scope Assertions Design 1 4 Connecting the Testbench and Design Testbench wraps around the

More information

Programming in C. main. Level 2. Level 2 Level 2. Level 3 Level 3

Programming in C. main. Level 2. Level 2 Level 2. Level 3 Level 3 Programming in C main Level 2 Level 2 Level 2 Level 3 Level 3 1 Programmer-Defined Functions Modularize with building blocks of programs Divide and Conquer Construct a program from smaller pieces or components

More information

Sunburst Design - Advanced SystemVerilog for Design & Verification by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc.

Sunburst Design - Advanced SystemVerilog for Design & Verification by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc. World Class Verilog & SystemVerilog Training Sunburst Design - Advanced SystemVerilog for Design & Verification by Recognized Verilog & SystemVerilog Guru, Cliff Cummings of Sunburst Design, Inc. Cliff

More information

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring

Outline. Java Models for variables Types and type checking, type safety Interpretation vs. compilation. Reasoning about code. CSCI 2600 Spring Java Outline Java Models for variables Types and type checking, type safety Interpretation vs. compilation Reasoning about code CSCI 2600 Spring 2017 2 Java Java is a successor to a number of languages,

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010

CSE 374 Programming Concepts & Tools. Hal Perkins Spring 2010 CSE 374 Programming Concepts & Tools Hal Perkins Spring 2010 Lecture 19 Introduction ti to C++ C++ C++ is an enormous language: g All of C Classes and objects (kind of like Java, some crucial differences)

More information

Object Oriented Programming. Solved MCQs - Part 2

Object Oriented Programming. Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 Object Oriented Programming Solved MCQs - Part 2 It is possible to declare as a friend A member function A global function A class All of the above What

More information

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 19 Introduction to C++ CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 19 Introduction to C++ C++ C++ is an enormous language: All of C Classes and objects (kind of like Java, some crucial differences) Many

More information

SystemVerilog Lecture 3. Prof. Gerald E. Sobelman Dept. of Electrical and Computer Engineering University of Minnesota Minneapolis, MN USA

SystemVerilog Lecture 3. Prof. Gerald E. Sobelman Dept. of Electrical and Computer Engineering University of Minnesota Minneapolis, MN USA SystemVerilog Lecture 3 Prof. Gerald E. Sobelman Dept. of Electrical and Computer Engineering University of Minnesota Minneapolis, MN 55455 USA 1 Outline Design Example: Booth Multiplier Design Example:

More information

The Top Most Common SystemVerilog Constrained Random Gotchas

The Top Most Common SystemVerilog Constrained Random Gotchas The Top Most Common SystemVerilog Constrained Random Gotchas Author: Ahmed Yehia Presenter: Gabriel Chidolue Accellera Systems Initiative 1 Motivation More time is taken in debug than any other project

More information

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures

More information

Instantiation of Template class

Instantiation of Template class Class Templates Templates are like advanced macros. They are useful for building new classes that depend on already existing user defined classes or built-in types. Example: stack of int or stack of double

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a.

Intro to OOP Visibility/protection levels and constructors Friend, convert constructor, destructor Operator overloading a<=b a. Intro to OOP - Object and class - The sequence to define and use a class in a program - How/when to use scope resolution operator - How/when to the dot operator - Should be able to write the prototype

More information

Creating Stimulus and Stimulating Creativity:

Creating Stimulus and Stimulating Creativity: Creating Stimulus and Stimulating Creativity: Using the VMM Scenario Generator Jonathan Bromley Doulos Ltd, Ringwood, UK jonathan.bromley@doulos.com 2 Outline Introduction: motivation for scenarios The

More information

CSC 533: Organization of Programming Languages. Spring 2005

CSC 533: Organization of Programming Languages. Spring 2005 CSC 533: Organization of Programming Languages Spring 2005 Language features and issues variables & bindings data types primitive complex/structured expressions & assignments control structures subprograms

More information

Polymorphism. Arizona State University 1

Polymorphism. Arizona State University 1 Polymorphism CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 15 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State University

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

CS304 Object Oriented Programming Final Term

CS304 Object Oriented Programming Final Term 1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes? Generalization (pg 29) Sub-typing

More information

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8

Design Issues. Subroutines and Control Abstraction. Subroutines and Control Abstraction. CSC 4101: Programming Languages 1. Textbook, Chapter 8 Subroutines and Control Abstraction Textbook, Chapter 8 1 Subroutines and Control Abstraction Mechanisms for process abstraction Single entry (except FORTRAN, PL/I) Caller is suspended Control returns

More information

CLASSES AND OBJECTS IN JAVA

CLASSES AND OBJECTS IN JAVA Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class

More information

CSE 591: Advanced Hardware Design Professor: Kyle Gilsdorf

CSE 591: Advanced Hardware Design Professor: Kyle Gilsdorf CSE 591: Advanced Hardware Design Professor: Kyle Gilsdorf (Kyle.Gilsdorf@asu.edu) What: System Verilog Verification Environment for Lab #2 Table of Contents 1. Overview 2 1. Verification 3 2. Feature

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

More information

Getting Started with OVM 2.0

Getting Started with OVM 2.0 A Series of Tutorials based on a set of Simple, Complete Examples Introduction In this tutorial, the emphasis is on getting a simple example working rather than on understanding the broad flow of the constrained

More information

Object Oriented Design

Object Oriented Design Object Oriented Design Chapter 6 Example Activity Diagram 1 Outline Chapter 6 Topics 6.6 C++ Standard Library Header Files 6.14 Inline Functions 6.16 Default Arguments 6.17 Unary Scope Resolution Operator

More information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

More information

Contents. 8-1 Copyright (c) N. Afshartous

Contents. 8-1 Copyright (c) N. Afshartous Contents 1. Introduction 2. Types and Variables 3. Statements and Control Flow 4. Reading Input 5. Classes and Objects 6. Arrays 7. Methods 8. Scope and Lifetime 9. Utility classes 10 Introduction to Object-Oriented

More information

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file?

QUIZ on Ch.5. Why is it sometimes not a good idea to place the private part of the interface in a header file? QUIZ on Ch.5 Why is it sometimes not a good idea to place the private part of the interface in a header file? Example projects where we don t want the implementation visible to the client programmer: The

More information

D Programming Language

D Programming Language Group 14 Muazam Ali Anil Ozdemir D Programming Language Introduction and Why D? It doesn t come with a religion this is written somewhere along the overview of D programming language. If you actually take

More information

Object-Oriented Design (OOD) and C++

Object-Oriented Design (OOD) and C++ Chapter 2 Object-Oriented Design (OOD) and C++ At a Glance Instructor s Manual Table of Contents Chapter Overview Chapter Objectives Instructor Notes Quick Quizzes Discussion Questions Projects to Assign

More information

SystemVerilog Essentials Simulation & Synthesis

SystemVerilog Essentials Simulation & Synthesis SystemVerilog Essentials Simulation & Synthesis Course Description This course provides all necessary theoretical and practical know-how to design programmable logic devices using SystemVerilog standard

More information

Cadence Technical Analysis of System Verilog DECEMBER 2002

Cadence Technical Analysis of System Verilog DECEMBER 2002 Cadence Technical Analysis of System Verilog DECEMBER 2002 1 CADENCE DESIGN SYSTEMS, INC. Outline Criteria for Language Critique/Design Critique of Existing LRM/Donations Recommendations Moving Forward

More information

CA31-1K DIS. Pointers. TA: You Lu

CA31-1K DIS. Pointers. TA: You Lu CA31-1K DIS Pointers TA: You Lu Pointers Recall that while we think of variables by their names like: int numbers; Computer likes to think of variables by their memory address: 0012FED4 A pointer is a

More information

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object

More information

C++: Const Function Overloading Constructors and Destructors Enumerations Assertions

C++: Const Function Overloading Constructors and Destructors Enumerations Assertions C++: Const Function Overloading Constructors and Destructors Enumerations Assertions Const const float pi=3.14159; const int* pheight; // defines pointer to // constant int value cannot be changed // pointer

More information

Example: Count of Points

Example: Count of Points Example: Count of Points 1 public class Point { 2... 3 private static int numofpoints = 0; 4 5 public Point() { 6 numofpoints++; 7 } 8 9 public Point(int x, int y) { 10 this(); // calling Line 5 11 this.x

More information

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am CMSC 202 Section 010x Spring 2007 Computer Science II Final Exam Name: Username: Score Max Section: (check one) 0101 - Justin Martineau, Tuesday 11:30am 0102 - Sandeep Balijepalli, Thursday 11:30am 0103

More information

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University (5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University Key Concepts 2 Object-Oriented Design Object-Oriented Programming

More information

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

MaanavaN.Com CS1203 OBJECT ORIENTED PROGRAMMING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING SUB CODE / SUBJECT: CS1203 / Object oriented programming YEAR / SEM: II / III QUESTION BANK UNIT I FUNDAMENTALS PART-A (2 MARKS) 1. What is Object Oriented

More information

C++ & Object Oriented Programming Concepts The procedural programming is the standard approach used in many traditional computer languages such as BASIC, C, FORTRAN and PASCAL. The procedural programming

More information

PG DIPLOMA COURSE IN VERIFICATION USING SYSTEMVERILOG & UVM NEOSCHIP TECHNOLOGIES

PG DIPLOMA COURSE IN VERIFICATION USING SYSTEMVERILOG & UVM NEOSCHIP TECHNOLOGIES PG DIPLOMA COURSE IN VERIFICATION USING SYSTEMVERILOG & UVM An Initiative by Industry Experts With Qualification from IITs and IISCs Address: NEOSCHIP TECHNOLOGIES 3rd Floor, Sai Durga Enclave, 1099/833-1,

More information

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS Pages 792 to 800 Anna Rakitianskaia, University of Pretoria INITIALISING POINTER VARIABLES Pointer variables are declared by putting

More information

SystemVerilog For Design Second Edition

SystemVerilog For Design Second Edition SystemVerilog For Design Second Edition A Guide to Using SystemVerilog for Hardware Design and Modeling by Stuart Sutherland Simon Davidmann Peter Flake Foreword by Phil Moorby 4y Spri ringer Table of

More information

Extending SystemVerilog Data Types to Nets

Extending SystemVerilog Data Types to Nets Extending SystemVerilog Data Types to Nets SystemVerilog extended Verilog by adding powerful new data types and operators that can be used to declare and manipulate parameters and variables. Extensions

More information

More C++ : Vectors, Classes, Inheritance, Templates

More C++ : Vectors, Classes, Inheritance, Templates Vectors More C++ : Vectors,, Inheritance, Templates vectors in C++ basically arrays with enhancements indexed similarly contiguous memory some changes defined differently can be resized without explicit

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.

More information

IBS Software Services Technical Interview Questions. Q1. What is the difference between declaration and definition?

IBS Software Services Technical Interview Questions. Q1. What is the difference between declaration and definition? IBS Software Services Technical Interview Questions Q1. What is the difference between declaration and definition? The declaration tells the compiler that at some later point we plan to present the definition

More information

III. Classes (Chap. 3)

III. Classes (Chap. 3) III. Classes III-1 III. Classes (Chap. 3) As we have seen, C++ data types can be classified as: Fundamental (or simple or scalar): A data object of one of these types is a single object. int, double, char,

More information

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com More C++ : Vectors, Classes, Inheritance, Templates with content from cplusplus.com, codeguru.com 2 Vectors vectors in C++ basically arrays with enhancements indexed similarly contiguous memory some changes

More information

C++ (Non for C Programmer) (BT307) 40 Hours

C++ (Non for C Programmer) (BT307) 40 Hours C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular

More information

STRUCTURING OF PROGRAM

STRUCTURING OF PROGRAM Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the

More information

Lesson 6 Introduction to Object-Oriented Programming

Lesson 6 Introduction to Object-Oriented Programming Lesson 6 Introduction to Object-Oriented Programming Programming Grade in Computer Engineering Outline 1. Motivation 2. Classes, objects and attributes 3. Constructors 4. Methods 5. Composition 6. Object

More information

C++ : Object Oriented Features. What makes C++ Object Oriented

C++ : Object Oriented Features. What makes C++ Object Oriented C++ : Object Oriented Features What makes C++ Object Oriented Encapsulation in C++ : Classes In C++, a package of data + processes == class A class is a user defined data type Variables of a class are

More information

Chapter 10 Introduction to Classes

Chapter 10 Introduction to Classes C++ for Engineers and Scientists Third Edition Chapter 10 Introduction to Classes CSc 10200! Introduction to Computing Lecture 20-21 Edgardo Molina Fall 2013 City College of New York 2 Objectives In this

More information

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented

More information

JAVA: A Primer. By: Amrita Rajagopal

JAVA: A Primer. By: Amrita Rajagopal JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently

More information

OUTCOMES BASED LEARNING MATRIX

OUTCOMES BASED LEARNING MATRIX OUTCOMES BASED LEARNING MATRIX Course: CTIM 372 Advanced Programming in C++ Department: Computer Technology and Information Management 3 credits/4 contact hours Description: This course is a continuation

More information

Software Design and Analysis for Engineers

Software Design and Analysis for Engineers Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 2 Date:

More information

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity. OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.

More information

(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University

(12-1) OOP: Polymorphism in C++ D & D Chapter 12. Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University (12-1) OOP: Polymorphism in C++ D & D Chapter 12 Instructor - Andrew S. O Fallon CptS 122 (April 3, 2019) Washington State University Key Concepts Polymorphism virtual functions Virtual function tables

More information

Ch. 3: The C in C++ - Continued -

Ch. 3: The C in C++ - Continued - Ch. 3: The C in C++ - Continued - QUIZ What are the 3 ways a reference can be passed to a C++ function? QUIZ True or false: References behave like constant pointers with automatic dereferencing. QUIZ What

More information

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++ Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and

More information

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS

Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS Contents Preface... (vii) CHAPTER 1 INTRODUCTION TO COMPUTERS 1.1. INTRODUCTION TO COMPUTERS... 1 1.2. HISTORY OF C & C++... 3 1.3. DESIGN, DEVELOPMENT AND EXECUTION OF A PROGRAM... 3 1.4 TESTING OF PROGRAMS...

More information

! Data is stored in variables. - Perhaps using arrays and structs. ! Program is a collection of functions that perform

! Data is stored in variables. - Perhaps using arrays and structs. ! Program is a collection of functions that perform Ch 13: Introduction to Classes 13.1 Procedural Programming! Data is stored in variables CS 2308 Fall 2012 Jill Seaman - Perhaps using arrays and structs.! Program is a collection of functions that perform

More information

September 10,

September 10, September 10, 2013 1 Bjarne Stroustrup, AT&T Bell Labs, early 80s cfront original C++ to C translator Difficult to debug Potentially inefficient Many native compilers exist today C++ is mostly upward compatible

More information

Objects and Classes: Working with the State and Behavior of Objects

Objects and Classes: Working with the State and Behavior of Objects Objects and Classes: Working with the State and Behavior of Objects 1 The Core Object-Oriented Programming Concepts CLASS TYPE FACTORY OBJECT DATA IDENTIFIER Classes contain data members types of variables

More information

About Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming In C++ classes provide the functionality necessary to use object-oriented programming OOP is a particular way of organizing computer programs It doesn t allow you to do anything

More information

Fast Track to Productivity Using Questa Verification IP by David Aerne and Ankur Jain, Verification Technologists, Mentor Graphics

Fast Track to Productivity Using Questa Verification IP by David Aerne and Ankur Jain, Verification Technologists, Mentor Graphics Fast Track to Productivity Using Questa Verification IP by David Aerne and Ankur Jain, Verification Technologists, Mentor Graphics ABSTRACT The challenges inherent in verifying today s complex designs

More information

CMSC330 Fall 2013 Practice Problems 6 Solutions

CMSC330 Fall 2013 Practice Problems 6 Solutions CMSC330 Fall 2013 Practice Problems 6 Solutions 1. Programming languages a. Describe how functional programming may be used to simulate OOP. An object may be simulated as a tuple, where each element of

More information

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING

Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING Government Polytechnic, Muzaffarpur. Name of the Lab: OBJECT ORIENTED PROGRAMMING THROUGH C++ Practical: OOPS THROUGH C++ Subject Code: 1618407 PROGRAM NO.1 Programming exercise on executing a Basic C++

More information

CSci 4061 Introduction to Operating Systems. Programs in C/Unix

CSci 4061 Introduction to Operating Systems. Programs in C/Unix CSci 4061 Introduction to Operating Systems Programs in C/Unix Today Basic C programming Follow on to recitation Structure of a C program A C program consists of a collection of C functions, structs, arrays,

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes

More information

User Experience with UVM

User Experience with UVM User Experience with UVM Stephen D Onofrio & Peter D Antonio Stacking Verification Components in UVM 2012 The MITRE Corporation. All Rights Reserved. Approved for Public Release: 12-0309 Distribution Unlimited

More information

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information

Sample Copy. Not for Distribution.

Sample Copy. Not for Distribution. A Practical Approach to Learn JAVA i EDUCREATION PUBLISHING RZ 94, Sector - 6, Dwarka, New Delhi - 110075 Shubham Vihar, Mangla, Bilaspur, Chhattisgarh - 495001 Website: www.educreation.in Copyright, 2018,

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

Modeling Usable & Reusable Transactors in SystemVerilog Janick Bergeron, Scientist

Modeling Usable & Reusable Transactors in SystemVerilog Janick Bergeron, Scientist Modeling Usable & Reusable Transactors in SystemVerilog Janick Bergeron, Scientist Verification Group, Synopsys Inc janick@synopsys.com Transactors Definition Building blocks of verification environments

More information

Run-time Environments

Run-time Environments Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction

More information

ECE 2400 Computer Systems Programming Fall 2018 Topic 7: Concrete Data Types

ECE 2400 Computer Systems Programming Fall 2018 Topic 7: Concrete Data Types ECE 2400 Computer Systems Programming Fall 2018 Topic 7: Concrete Data Types School of Electrical and Computer Engineering Cornell University revision: 2018-10-11-00-22 1 List CDTs 4 1.1. List CDT Interface.............................

More information

Run-time Environments

Run-time Environments Run-time Environments Status We have so far covered the front-end phases Lexical analysis Parsing Semantic analysis Next come the back-end phases Code generation Optimization Register allocation Instruction

More information

Initializers: Array initializers can be used with class base types as well. The elements of the initializer can be expressions (not just constants).

Initializers: Array initializers can be used with class base types as well. The elements of the initializer can be expressions (not just constants). CMSC 131: Chapter 15 (Supplement) Arrays II Arrays of Objects Array of Objects: The base type of an array can be a class object. Example: Array of Strings. String[ ] greatcities = new String[5]; greatcities[2]

More information

Interview Questions of C++

Interview Questions of C++ Interview Questions of C++ Q-1 What is the full form of OOPS? Ans: Object Oriented Programming System. Q-2 What is a class? Ans: Class is a blue print which reflects the entities attributes and actions.

More information

Cpt S 122 Data Structures. Course Review Midterm Exam # 2

Cpt S 122 Data Structures. Course Review Midterm Exam # 2 Cpt S 122 Data Structures Course Review Midterm Exam # 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 2 When: Monday (11/05) 12:10 pm -1pm

More information

TYPES, VALUES AND DECLARATIONS

TYPES, VALUES AND DECLARATIONS COSC 2P90 TYPES, VALUES AND DECLARATIONS (c) S. Thompson, M. Winters 1 Names, References, Values & Types data items have a value and a type type determines set of operations variables Have an identifier

More information

Assumptions. History

Assumptions. History Assumptions A Brief Introduction to Java for C++ Programmers: Part 1 ENGI 5895: Software Design Faculty of Engineering & Applied Science Memorial University of Newfoundland You already know C++ You understand

More information

Object-Oriented Programming

Object-Oriented Programming - oriented - iuliana@cs.ubbcluj.ro Babes-Bolyai University 2018 1 / 56 Overview - oriented 1 2 -oriented 3 4 5 6 7 8 Static and friend elements 9 Summary 2 / 56 I - oriented was initially created by Bjarne

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

CS 240 Final Exam Review

CS 240 Final Exam Review CS 240 Final Exam Review Linux I/O redirection Pipelines Standard commands C++ Pointers How to declare How to use Pointer arithmetic new, delete Memory leaks C++ Parameter Passing modes value pointer reference

More information