Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

TEST AND VERIFICATION SOLUTIONS

Training
SYSTEMVERILOG ASSIGNMENT-1

Q.No. Questions (Datatypes and Arrays)


1) a) Write a code to understand difference between
 Signed, unsigned
 16/32/64 bit data types
 2 state or 4 state data types
https://www.edaplayground.com/x/m544

2) a) Show the difference between signed and unsigned


 Declare module top
 Declare byte b;
 Declare bit [7:0] c;
 assign b=-10; c = -10;
 Compare b to -10 and c to -10; notice the result
 Compare b to c, notice the result
 Now try declaring signed bit [7:0] c;
 Do all steps a-f again; check will they match?
https://www.edaplayground.com/x/EqSS

3) a) Write a code to understand the difference between real, shortreal and


time (use %f, %1.10f, %t and $time to display)
https://www.edaplayground.com/x/PXb9

b) Write a code to understand difference between int and integer


https://www.edaplayground.com/x/rz8y

c) Write logic in system verilog to store and print a string by name ‘vlsi’
 Print the length of the string
 Declare another string ‘temp’ then using putc method change ‘vlsi’ as
‘ulsi’ and store it in temp and print it.
 Change it into upper case and print
 Compare the two strings variables
https://www.edaplayground.com/x/t4gj

4) a) User defined data types [typedef]


 Declare a nibble as data type (4 bits).
 Declare a variable as nibble
 Assign a value for the variable and print it
https://www.edaplayground.com/x/8wxd

5) a) Declare a variable ‘arr’ as array (size=5) of queue of integers (3)


 Declare queue of integers as a data type
 Declare array of queue of integers as a data type-
 Use above data type to declare a variable ‘arr’
 Assign values to the variable
 Print all the elements of array
https://www.edaplayground.com/x/njTe
6) a)  Declare module top
 Instantiate all possible data types
- int, longint, byte, string, time
- Single and multi dimensional arrays, queue
 For all these data variable initialize values
 Print all the array fields using %p
 Print all array fields using nested for loop
https://www.edaplayground.com/x/FNHq

You might also like