0% found this document useful (0 votes)
11 views4 pages

Manual For Experiment-1

Manual for Experiment-1

Uploaded by

shashilu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Manual For Experiment-1

Manual for Experiment-1

Uploaded by

shashilu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Solution Manual for Experiment #1

Design using System Verilog UEC521

Aim: Familiarization with SystemVerilog data types and arrays, including performing
operations on fixed and dynamic arrays.

Perform the following activities:

1. Write the SystemVerilog code to:


i. Declare a 2-state array, my_array, that holds four 12-bit values
ii. Initialize my_array so that:
my_array[0] = 12'h012
my_array[1] = 12’h345
my_array[2] = 12'h678
my_array[3] = 12’h9AB

iii. Traverse my_array and print out bits [5:4] of each 12-bit element
a. With a for loop
b. With a foreach loop
2. Write the SystemVerilog code to:
i. Declare a 2-state two dimensional array, array_2d (4 rows and 3 columns), that
holds 12 integer values.
ii. Initialize my_array so that:
array_2d[0][0] = 0
array_2d[0][1] = 1
array_2d[0][2] = 2
array_2d[1][0] = 3
array_2d[1][1] = 4
array_2d[1][2] = 5
array_2d[2][0] = 6
array_2d[2][1] = 7
array_2d[2][2] = 8
array_2d[3][0] = 19
array_2d[3][1] = 20
array_2d[3][2] = 21
iii. Print out the values stored in array_2d and verify them with initialized values.
Hint: use foreach loop.

3. Write the System Verilog code to:


i. Declare two bit-type fixed-size array of size 10 which can store 8bits values. Initialize
first array with values {2,4,6,8,10,12,14,16,18,20} and second array with values
{1,3,5,7,9,11,13,15,17,19}.
ii. Display the values stored in two array declared in step-i.
iii. Copy the contents of first array into second array and compare two arrays and display
the result of comparison.
4. Write the SystemVerilog code for the following requirements.
i. Declare the two integer type dynamic array.
ii. Store the following values in the first dynamic array-{ 3,6,9,12,15,18} and
{2,4,6,8,10,12,14} in the second dynamic array.
iii. Print the sum of the elements stored in the arrays.
iv. Insert the contents of the first array into second array (after its last element).
v. Delete the first array and try to print the contents of the first and second array.
Write remark if you have any observation.

You might also like