CS684: Embedded System Course

Assignment 1: Reactive Kernel

Prerequisite:

  • Before starting this assignment, go through the resources provided on Reactive Kernel Resources
  • Inspect and analyze the C codes, both written by hand and synthesized.

Resources:

  • Download the Assignment-1.tar.gz file. Extract the file using command tar -xzvf Assignment-1.tar.gz
  • You will find following directory structure:

Problem Statement:

Write reactive kernel for finding
1. Mean of cubes
2. Frequency of first element in a series

I. Mean of cubes:

At each step, input is a single integer x. Mean of cubes has to be found for a sequence of x’s seen so far. Following is the expected output:

  • For compiling and running the program follow these steps:
cd </path/to/cube_avg>
gcc -c cube_avg.c
gcc -c main.c
gcc -o cube_avg main.o cube_avg.o
./cube_avg

II. Frequency of first element in a series:

At each step, input is a single integer x. You have to calculate the number of times the first element of the series is occurring in a series of inputs Following is the expected output:

  • For compiling and running the program follow these steps:
cd </path/to/freq>
gcc -c freq.c
gcc -c main.c
gcc -o freq main.o freq.o
./freq

Note: Your output should be exactly same as expected output including variables name as it will be autoevaluated.


Submission Instructions:

  • This assignment is an individual task
  • Complete the necessary files given in the folder
  • Compress the folder Assignment-1 in a .tar.gz file and provide the name as <rollno>_Assignment_1.tar.gz
  • Submit it on moodle

Note: Make sure you have removed all the print statements from the file except the lines wihich prints sum of squares and frequency. Else your submission will not be evaluated.