Welcome to Evaluation-1
This repository contains the starter files and structure for your first evaluation.
You will demonstrate your understanding of C programming, Bash scripting, Makefile, Git workflow, and RISC-V assembly (Spike).
- Time Limit: 3 hours
- Work individually. Collaboration is not allowed.
- You must complete the tasks in this repository and push your work to your fork.
- After finishing, create a Pull Request to the original repo everything stored in a folder with your name.
- You may use manuals, documentation, and your own notes.
- Internet is allowed only for standard docs/libraries.
- Do not use AI assistants (ChatGPT, Copilot, etc.) or copy code from external sources.
├── bitops.c # C program for Task-1 (bit manipulation)
├── fib.s # RISC-V assembly program for Task-2 (Fibonacci)
├── run\_tests.sh # Bash test harness for Task-1
├── Makefile # Build & test automation
└── README.md # Instructions (this file)
Implement and extend bitops.c to support the following operations on 32-bit unsigned integers:
- Count number of set bits (
1s) - Reverse all bits
- Check if the number is a power of two
- Set a specific bit (at position
k) - Clear a specific bit (at position
k) - Toggle a specific bit (at position
k) - Extract a range of bits
[m:n] - Perform logical AND / OR between two numbers
⚡ Note: Use optimized bitwise logic (&, |, ^, ~, <<, >>) instead of brute-force loops.
- Generate test inputs (normal + edge cases:
0,UINT32_MAX, powers of 2, alternating patterns). - Run the program with these inputs.
- Compare outputs with expected results.
- Print a summary report (Passed/Failed).
make build→ Compile the C programmake test→ Run the Bash test harnessmake clean→ Remove build artifacts
- Commit your work frequently with meaningful commit messages.
- Add documentation in this README (examples, commands, notes).
- Push to your fork and create a Pull Request at the end.
Implement fib.s to compute the first n Fibonacci numbers.
Steps:
- Hardcode
nin the.datasection. - Use an iterative algorithm in RISC-V assembly.
- Store results in memory.
Run with:
spike fib-
Implemented
bitops.cwith all required operations -
Completed
run_tests.shto generate and verify results -
Configured
Makefilefor build, test, clean -
Implemented
fib.sfor Fibonacci in RISC-V assembly -
Updated
README.mdin your folder (dont change the original Readme) with:- Algorithm explanations
- How to build & run
- Example outputs
-
Committed work regularly with meaningful messages
-
Pushed work to forked repo
-
Created a Pull Request
make build
./bitopsmake testmake cleanriscv64-unknown-elf-gcc fib.s -o fib
spike fibTip: Write clean, modular code. Document your steps and explain optimizations in this README. Good luck.
---
Would you like me to also **add TODO placeholders inside `bitops.c`, `run_tests.sh`, `Makefile`, and `fib.s`**, so students get a clear skeleton to start from instead of a blank file?