Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
10 views

C Module Lab5 Cohort02 Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

C Module Lab5 Cohort02 Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Digital Design Verification

Lab # 05
FUNCTIONS AND WORKING WITH MULTIPLE FILES

Release Date: 30-July-2024

NUST Chip Design Centre (NCDC), Islamabad, Pakistan


Revision History
Revision Revision Revision Approved
Nature of Revision
Number Date By By
1.0 30/07/2024 Dr. Abid Complete manual -
1.1 06/08/2024 Engr Hira Revision in manual

2
Contents

Objective ............................................................................................................................... 4
Tools ..................................................................................................................................... 4
Lab Task # 01 : String Library................................................................................................ 4
Lab Task # 02........................................................................................................................ 5
Lab Task # 03........................................................................................................................ 5
Lab Task # 04........................................................................................................................ 5
Submission: .......................................................................................................................... 6

Lab # 05 www.ncdc.pk 3
Objective
The objective of this lab is to enable students to answer following questions:
• How to use functions?
• How to use multiple files in a project?

Tools
• GNU debugger
• GC compiler

Lab Task # 01: String Library

Take an input sentence (maximum length N = 100) and perform the following
operations on the sentence using functions. Prepare string.h and string.cpp as library
files and use that library in main.

a. Length of the sentence


b. Sentence in lowercase
c. Sentence in uppercase
d. Number of words in the sentence
e. Number of vowels
f. Frequency of the vowels

Flow Chart: 20 Minutes Code: 20 Minutes

Scientific Computing - Linear Algebra Library

At the core of all scientific computations for nuclear simulation, weather modeling or
circuit simulation is linear algebra. In linear algebra, there are typically three levels of
operations that are the most common which usually involve arrays. You need to create
a linearalgebra.h and linearalgebra.cpp for this library.

Lab # 05 www.ncdc.pk 4
Lab Task # 02
Level 1 Operations - xTy

Write a function which takes inputs x and y from the user (x, y are vectors of size N).
Your program should then compute the dot product.

Flow Chart: 15 Minutes Code: 15 Minutes

Lab Task # 03
Level 2 Operations - Matrix Vector Multiply (y=Ax)
Write a function which takes inputs A and x from the user (A is of size M x N, x is of
size Nx1) and compute the matrix vector multiplication. You should reuse dot
products in this function.
Flow Chart: 30 Minutes Code: 30 Minutes

Lab Task # 04
Level 3 Operations - Matrix Vector Multiply (C=AB)
Write a function which takes inputs A and B from the user (A is of size M x N, B is of
size NxK) and compute the matrix matrix multiplication. You should reuse dot
products in this function. You might have to take transpose of B.
Flow Chart: 30 Minutes Code: 30 Minutes

Lab # 05 www.ncdc.pk 5
Signal Processing Library

Lab Task # 05

Write a signal processing library to carry out the following functions. Your signal will
be an array of floats.
• Find average value of the signal
• Detect number of zero crossings in the signal
• Detect number of glitches in the signal
• Filtering of the signal with a given transfer function (size of signal and transfer
function will be fixed)

Image Processing Library


Task #06:
Write an image processing library to carry out the following functions. Your image will
be a 3D array containing RGB values.
• Find the type of pixels in the image. Your function should take pixel type as
input (0 — black, 1 - white, 2 - yellow)
• Perform RGB to GrayScale conversion
• Perform convolution on the 2D grayscale image with following filter

Lab # 05 www.ncdc.pk 6
H = [ 1 1 1 ; 1 1 1; 1 1 1]/9;

Submission:
Please submit .c and .h files of all the tasks along with the screenshots of outputs on
LMS in a proper report. Add snaps of all the flow charts in your report.

Lab # 05 www.ncdc.pk 7

You might also like