Lab1 (Packed and Unpacked Arrays)
Lab1 (Packed and Unpacked Arrays)
Lab1 (Packed and Unpacked Arrays)
Lab 1
1. Design and verify following circuits using logic:
a. Tri-State Buffer.
b. 1-bit Full Adder (using continuous assignment).
c. D-Flip Flop (using procedural assignment).
d. 2x1 Mux (using Tri-State buffers, identify the problem)
3. Define an unpacked array of byte with 4 rows and 10 columns. Initialize array with
following values, use special notations to achieve the same and perform operations
given below :
Row0: {1,2,3,1,2,3,1,2,3,4}
Row1: {1,2,3,1,2,3,1,2,3,4}
Row2: {1,2,1,2,1,2,3,1,2,3}
Row3: {4,4,4,4,5,5,3,3,3,3}
a. Print initial value of array using foreach and for loop.
b. Declare one more array with same dimensions, randomize it and print all values.
c. Replace {1,2,3,1,2,3} present in Row2 of original array with the random content
present at the same locations in the new array.
4. Declare a 2-D (4 x 8) packed array of bits, initialize it with random value. Try to
access this array in different combinations and store results in temporary variables.
5. Define a 3-D (2 x 4 x 8) packed array of logic and 3-D (2 x 4 x 8) unpacked array of bit.
Randomize value of unpacked array and copy it to packed array. Verify your result.
6. Define a dynamic array where each element is capable of storing 10-bits. Allocate 20
memory locations to this array. Randomize values at all these location and print
array size. Now double the size of array by keeping contents of initial 20 locations
same as previous. Assign value to few new locations and then print content and size
of array.
www.futurewiz.co.in