Documente Academic
Documente Profesional
Documente Cultură
4. write a class task "deposite" that takes a deposite amount as the input argument & add it to the
"balance" class property.
7. access the proprerties ,task,&function of teh class using the object created.
QB.
bit[3:0] data;
bit[15:0] addr;
bit[15:0] mem;
4. create ans object from the handle p1 inside the initial begin
Q3.
3. write the task write(input bit wr,input string addr,inpt int data).
5. iterate through the array using first &next built-in functions in the task check() in the extended class
mem_asso_v1.
6. call the tasks inside initial-begin-end block.
Q4.
1. class accont_c
3. write a function "summmary_withdraw " which will return the balance after withdrawal
4. inside the initial block call the function "summary_withdraw" to see the new balance.
Q5.
2. a class "packet" has an object of class "parity_calc" &a "header" & "data" field.
6. now change the value of header of p2 & see that the value header in p1 is not changed.
POLYMORPHISM:
Q1.
1. Creat class packet with field “payload”. Inside tsk send() calculate even parity & display
it.
2. In task send() of the extended class badpacket1, calculate the odd parity /bad parity
&display it.
3. Creat parent &child class objects from the handels declared.
4. Call the send task of base &extended class objects &observe the result.
5. Assign extended class object to base class object.
6. Class send task with base class object &observe the result.
QUEUE:
Q1.
1. Create a packet class that has addr[8bits],data[8bits] & parity [8bit] as class properties. Declare a
queue that can store the packets.
2. Create check_addr function which will lock for one addr match,no addr match & multiple addr match.
3. Inside the initial begin and block add multiple packets to the queue.
4. Call the function in the initial block & chek the o/p.