0% found this document useful (0 votes)
5 views2 pages

Eitra Datatype Exercise Session1

The document outlines a series of programming exercises involving string manipulation, array operations, clock generation, and memory management in System Verilog. Each exercise requires the creation of separate modules with specific functionalities, such as calculating string sizes, sorting arrays, and packing data. Additionally, it includes instructions for preparing a Perl script to execute the modules based on user input for the exercise number.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Eitra Datatype Exercise Session1

The document outlines a series of programming exercises involving string manipulation, array operations, clock generation, and memory management in System Verilog. Each exercise requires the creation of separate modules with specific functionalities, such as calculating string sizes, sorting arrays, and packing data. Additionally, it includes instructions for preparing a Perl script to execute the modules based on user input for the exercise number.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1. Declare string A with value assigned as “ABCD”. Perform below operations separately.

a. Calculate size of string using method.


b. Convert all string value to lower case.
c. Get ASCII value of B.
2. Declare string array string str[4]
str [0] = “Language is a vital tool for communication”
str [1] = “Moreover a language distinguishes the differences”
str [2] = “A language shapes the way people perceive the world”
str [3] = “It is not only a means of communicating thoughts”
a. Prepare code to calculate total line which have word “language”
b. Prepare code to calculate total line which have string “Languages is” in line.
3. Write a code for clock generation of 900MHz having duty cycle of 60%.
4. Write the system Verilog code to Declare a 2-state array, dt_array that holds four 12bit
values
a. initialize dt_array so that:
i. dt_array[0] = 12’h012
ii. dt_array[1] = 12’h35
iii. dt_array[2] = 12’h600
iv. dt_array[3] = 12’h9AB;
b. Traverse dt_array and print out bits [5:4] of each 12-bit element
i. Using a for loop
ii. Using a foreach loop
5. Write a code for sorting down all the array members stored in fixed array in ascending and
descending orders. Array contains 10 members 45, 23, 12, 56, 789, 111, 256,2,76,100.
a. Write a code for finding second largest from array.
b. Write code for getting all the fields having value larger than 100 from array and
storing them into another array.
6. Pack data from unpacked array “bit [15:0] a_unpack[15] = ‘hex{ 3,2,9,23, 456, 12, 0, 54, 789,
1, FFFA, 67, 69, AB, FD, 1A}” to packed array “bit [255:0] a_pack”.
Note : Packing must be in pack array LSB to MSB.
a_unpack[0] = 3 // 16’b 0000 0000 0000 0011
a_unpack[1] = 2// 16’b 0000 0000 0000 0010
After packing a_pack[31:0] = 32’b 0000 0000 0000 0010 0000 0000 0000 0011 like this.
7. Write array having locations at 56, 1000, 10000, 11, 234 with some random value.
a. Using array methods check value of first location and last location.
b. Check value at location 0.
c. Access all locations of array mentioned above and update value as 100 in all
locations.
8. Example for Dynamic array,
a. Declare one dynamic array having size of 15 with datatype integer. Assign default 69
value to all elements.
b. Now runtime change size of dynamic array to 29. Keep previous default value as it is
for old indexes.
c. Assign value as 10 to all 21 to 28 locations of array.
d. Now declare another dynamic array having size of 50 and copy all elements of
previous array here.
9. Generate 12 Memories [Memory no 0 to 11] having similar size of width 32 bit and depth 1k
bit using Fixed array in little endian format.
a. Now access bit 21 of depth 7 at memory no 11 and write data as 1.
b. Now set 0 to all members of depth 1 of memory no 1.
c. Invert values of all members of depth 5 of memory no 7.
d. Access bit no 0 to 15 at memory depth 2 of memory no 0 and write all 1s.

Instructions:

1. Prepare separate module for each exercise.


2. You need to keep module name as per mention below,

module data_type_session_1_ex_1;

module data_type_session_1_ex_2;

module data_type_session_1_ex_10;

3. Keep module name same as filename. Like for data_type_session_1_ex_1.sv for first
exercise.
4. Prepare Perl script which perform below operations,
a. It takes exercise number as input argument.
b. Based on provided input exercise number it shall run particular module code and
generate transcript/run file.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy