Q1(a) Explain ‘super loop’ based and ‘OS’ based embedded
firmware design approaches.
1. Super Loop Based Embedded Firmware Design:
This is a simple, non-preemp ve approach used mostly in small embedded
systems.
It uses a single infinite loop (called a "super loop") in the main func on.
All tasks (like reading sensors, upda ng display, etc.) are wri en inside
this loop and executed one a er another.
Structure:
int main() {
init(); // Ini aliza on code
while(1) {
task1(); // e.g., read sensor
task2(); // e.g., control motor
task3(); // e.g., update display
}
}
Advantages:
Simple to understand and implement.
No need for an opera ng system.
Less memory usage.
Limita ons:
Poor handling of real- me tasks.
Difficult to priori ze tasks.
No mul tasking.
2. OS Based Embedded Firmware Design:
This approach uses a Real-Time Opera ng System (RTOS) to manage tasks.
Each task runs as a separate thread/process.
The RTOS schedules tasks using algorithms like Round Robin, Priority-
based, etc.
Supports mul tasking, delays, synchroniza on, and priori es.
Structure:
c
CopyEdit
void task1() {
while(1) {
// task code
}
}
void task2() {
while(1) {
// task code
}
}
int main() {
OS_init();
OS_createTask(task1);
OS_createTask(task2);
OS_start(); // starts the scheduler
}
Advantages:
Be er task management.
Supports real- me opera ons.
Easier to handle complex systems.
Limita ons:
Needs more RAM/ROM.
More complex to design and debug.
Summary Table:
Feature Super Loop OS-Based Firmware
Complexity Low High
Real- me Handling Poor Good
Memory Requirement Low High
Task Management Manual, Sequen al Automa c, Concurrent
Best Suited For Simple Applica ons Complex, Real- me Applica ons
Let me know if you'd like this in simpler words or in a diagramma c format.
✅ What is In-Circuit Emulator (ICE)?
An In-Circuit Emulator (ICE) is a hardware tool used to debug and test
embedded systems while they are running in real- me.
It replaces or connects to the microcontroller in your embedded system.
Allows the programmer to monitor, control, and modify the program
while it is running.
Helps in finding bugs that are difficult to detect through normal tes ng.
How ICE Works:
ICE connects to the target system (hardware) using a special connector.
It runs the same code as the actual microcontroller, but with debugging
support.
Allows you to set breakpoints, watch variables, and step through code
line by line.
It o en comes with a host PC so ware for user interface.
Neat Diagram:
Features of ICE:
Full control over execu on (run, pause, step-by-step).
Real- me debugging.
Access to internal registers, memory, and I/O pins.
Can simulate different opera ng condi ons.
Advantages:
Powerful tool for real- me debugging.
Saves me in finding and fixing bugs.
Allows deep inspec on of the embedded system behavior.
Limita ons:
Expensive hardware.
May not support all microcontrollers.
Some mes slows down system performance during debugging.
What are the advantages and limita ons of High-Level Language
Based Development?
In embedded systems, High-Level Languages (like C, C++, Python) are used
instead of low-level languages (like Assembly) because they are easier to
understand and maintain.
Advantages of High-Level Language (HLL) Based Development:
1. Easy to Write and Read:
o Programs are easier to understand, debug, and maintain.
o Syntax is closer to human language.
2. Portability:
o Code can be reused on different microcontrollers with minimal
changes.
3. Faster Development:
o Developers can build and test applica ons more quickly using
standard libraries and func ons.
4. Large Community Support:
o More tutorials, libraries, and tools are available.
5. Structured Programming:
o Encourages use of func ons, modules, and clean coding prac ces.
6. Compiler Op miza ons:
o Modern compilers can op mize high-level code to run almost as
fast as assembly.
Limita ons of High-Level Language (HLL) Based Development:
1. Less Control Over Hardware:
o Compared to assembly, you have less direct control over memory,
registers, and I/O pins.
2. Larger Code Size:
o HLL generates more code than assembly, which can be a problem
in memory-constrained systems.
3. Slower Execu on:
o High-level code may not be as fast as hand-wri en assembly,
especially for me-cri cal tasks.
4. Dependence on Compiler:
o The quality of output depends on the compiler’s op miza on
capabili es.
Summary Table:
Advantages Limita ons
Easier to write and understand Less control over hardware
Faster development with libraries Bigger code size
Portable across pla orms Slightly slower execu on
Easier debugging and maintenance Dependent on compiler quality
Q2(a) Outline conversion process from Assembly language to
machine level language with a neat diagram.
What is Assembly to Machine Language Conversion?
Assembly language is a low-level programming language with
mnemonics (e.g., MOV, ADD, SUB) that are easier to read than machine
code.
A translator called an assembler is used to convert assembly code into
machine code (binary code that the processor can execute).
Conversion Process Steps:
1. Write Assembly Code:
o Example:
less
CopyEdit
MOV A, #05H
ADD A, #03H
2. Use Assembler:
o An assembler reads the assembly instruc ons and converts them
into machine code.
o It assigns memory addresses, generates opcodes, and creates the
object code.
3. Generate Machine Code (Object Code):
o Machine code is a set of binary or hexadecimal instruc ons that
the processor understands.
o Example (for above code):
less
CopyEdit
74 05 ; MOV A, #05H
24 03 ; ADD A, #03H
Neat Diagram:
Types of Assemblers:
One-pass assembler: Translates code in a single scan.
Two-pass assembler: First pass builds symbol table, second pass
generates machine code.
Summary:
Stage Descrip on
Assembly Code Human-readable mnemonics (MOV, ADD, etc.)
Assembler Translates mnemonics into binary instruc ons
Machine Code Final executable binary (0s and 1s)
Q3(a): Round Robin Scheduling Calcula on
Given:
Processes: P1, P2, P3
Burst Times:
o P1 = 6 ms
o P2 = 4 ms
o P3 = 2 ms
Time Slice (Quantum): 2 ms
Order of arrival: P1 → P2 → P3
Goal: Calculate
o WT (Wai ng Time)
o TAT (Turn Around Time)
o AWT (Average Wai ng Time)
o ATAT (Average Turn Around Time)
Step 1: Gan Chart (Time Chart)
We'll execute each process for 2 ms in round-robin fashion un l all are finished:
Time Running Process
0–2 P1
Time Running Process
2–4 P2
4–6 P3 (completes)
6–8 P1
8–10 P2
10–12 P1 (completes)
Step 2: Comple on Time (CT)
Process Comple on Time (CT)
P1 12 ms
P2 10 ms
P3 6 ms
Step 3: Turn Around Time (TAT)
Formula:
TAT = CT – Arrival Time (Here, all arrival mes = 0)
Process TAT = CT – AT
P1 12 – 0 = 12 ms
P2 10 – 0 = 10 ms
P3 6 – 0 = 6 ms
Step 4: Wai ng Time (WT)
Formula:
WT = TAT – Burst Time
Process WT = TAT – BT
P1 12 – 6 = 6 ms
P2 10 – 4 = 6 ms
P3 6 – 2 = 4 ms
Step 5: Averages
AWT = (6 + 6 + 4) / 3 = 16 / 3 = 5.33 ms
ATAT = (12 + 10 + 6) / 3 = 28 / 3 = 9.33 ms
Final Answer:
Process BT CT TAT WT
P1 6 12 12 6
P2 4 10 10 6
P3 2 6 6 4
AWT = 5.33 ms
ATAT = 9.33 ms
What is an Opera ng System (OS) Architecture?
The OS architecture in embedded systems defines how different components
of the OS interact with the hardware and user applica ons.
It is typically layered or modular to provide abstrac on, task management, I/O
management, and inter-process communica on.
Basic Architecture Layers:
pgsql
CopyEdit
+-----------------------------+
| Applica on Layer | ← User Programs (e.g., UI, Control Logic)
+-----------------------------+
| System Call Interface | ← Interface between applica on & kernel
+-----------------------------+
| Kernel | ← Core OS: manages CPU, memory, processes
+-----------------------------+
| Hardware Abstrac on | ← Interfaces for hardware access
+-----------------------------+
| Hardware | ← CPU, RAM, I/O Devices
+-----------------------------+
Key Components of OS Architecture:
1. Applica on Layer:
Includes user-level so ware.
Uses system calls to interact with OS.
2. System Call Interface:
Provides func ons to access OS services.
Acts as a bridge between applica ons and kernel.
3. Kernel:
The core part of the OS that controls everything.
Process Management – handles task switching.
Memory Management – allocates and deallocates memory.
I/O Management – controls input/output devices.
Scheduler – decides which process runs when.
4. Hardware Abstrac on Layer (HAL):
Provides uniform access to hardware.
Makes the OS portable across hardware pla orms.
5. Hardware:
The actual physical components (CPU, RAM, sensors, etc.).
Neat Diagram:
Layer Func on
Applica on Layer User program logic
System Call Interface Communicates with the OS
Kernel Core management (CPU, memory, I/O)
Hardware Abstrac on Layer Uniform access to hardware
Hardware CPU, Memory, Devices
Three processes with process IDs P1, P2, P3 with es mated comple on me 10, 5, 7 milliseconds
respec vely, enter the ready queue together in the order P1, P2, P3 in FCFS scheduling algorithm.
Calculate the wai ng me and Turn Around Time (TAT) for each process and the average wai ng
me and Turn Around Time.
Given:
Scheduling Algorithm: FCFS (First-Come, First-Served)
Order of execu on: P1 → P2 → P3
Burst Times (BT):
o P1 = 10 ms
o P2 = 5 ms
o P3 = 7 ms
Arrival Times (AT): All arrive at 0 ms
Step 1: Comple on Time (CT)
Process BT (ms) Start Time Comple on Time (CT)
P1 10 0 0 + 10 = 10
P2 5 10 10 + 5 = 15
P3 7 15 15 + 7 = 22
Step 2: Turn Around Time (TAT)
Formula:
TAT=CT−ATTAT = CT - ATTAT=CT−AT
(Since AT = 0 for all)
Process CT AT TAT = CT – AT
P1 10 0 10 – 0 = 10 ms
P2 15 0 15 – 0 = 15 ms
P3 22 0 22 – 0 = 22 ms
Step 3: Wai ng Time (WT)
Formula:
WT=TAT–BTWT = TAT – BTWT=TAT–BT
Process TAT BT WT = TAT – BT
P1 10 10 10 – 10 = 0 ms
P2 15 5 15 – 5 = 10 ms
P3 22 7 22 – 7 = 15 ms
Step 4: Averages
Average Wai ng Time (AWT):
0+10+153=253=8.33 ms\frac{0 + 10 + 15}{3} = \frac{25}{3} = 8.33\ \text{ms}30+10+15=325=8.33 ms
Average Turn Around Time (ATAT):
10+15+223=473=15.67 ms\frac{10 + 15 + 22}{3} = \frac{47}{3} = 15.67\ \text{ms}310+15+22=347
=15.67 ms
Final Answer:
Process BT CT TAT WT
P1 10 10 10 0
P2 5 15 15 10
P3 7 22 22 15
Average WT = 8.33 ms
Average TAT = 15.67 ms
What is Task Scheduling?
Task scheduling is the process by which an opera ng system or scheduler
decides the order and ming in which mul ple tasks (or processes) are
executed on a processor.
In embedded systems, efficient scheduling is crucial because:
Tasks may have real- me constraints
There are limited resources (CPU, memory, etc.)
The system must run reliably and predictably
Purpose of Task Scheduling:
Ensure fair CPU usage
Meet deadlines (especially in real- me systems)
Maximize CPU u liza on
Minimize wai ng me and response me
Common Scheduling Algorithms:
FCFS (First-Come, First-Served)
SJF (Shortest Job First)
Round Robin
Priority Scheduling
Rate Monotonic Scheduling (RMS) – for real- me systems
Earliest Deadline First (EDF) – for hard real- me tasks
Selec on Factors for Scheduling Algorithms:
Factor Explana on
1. Real- me Does the task have a deadline? (Hard or So real-
Requirement me)
Some tasks are more important (e.g., emergency
2. Task Priority
alarm vs. display update)
3. CPU U liza on Scheduler should keep the CPU as busy as possible
Time from request to first response — important for
4. Response Time
interac ve systems
Time a task waits in the queue — should be
5. Wai ng Time
minimized
6. Throughput Number of tasks completed per unit me
Factor Explana on
7. Context Switching Frequent switching between tasks increases
Overhead overhead and reduces performance
Behavior must be predictable, especially for real- me
8. Determinism
tasks
Important in embedded systems that run on
9. Power Consump on
ba eries
Example Comparison:
Algorithm Best For
FCFS Simple, non- me-cri cal systems
Round Robin Fairness among tasks
SJF Minimizing average wai ng me
RMS/EDF Real- me embedded systems
Conclusion:
Choosing the right scheduling algorithm depends on:
Type of embedded system (so /hard real- me)
Task characteris cs (priority, ming)
System goals (efficiency, predictability)
With a neat diagram, explain the various steps involved in VHDL-based VLSI
IC design process."
Here’s the answer with diagram and explana on in simple steps:
VHDL-Based VLSI Design Process
VHDL is used to model and simulate hardware before fabrica ng it. The main
steps are:
1. Design Entry
Write the VHDL code for your digital system (like a counter, ALU, etc.).
You describe the system’s behavior using en ty and architecture.
2. Func onal Simula on
Simulate the VHDL code using a simulator.
Check whether the design behaves correctly as per the given inputs.
3. Synthesis
Convert the high-level VHDL code into a gate-level netlist.
Two sub-steps:
o Compila on: Translates VHDL to a generic netlist.
o Op miza on: Maps the netlist to target technology (FPGA or
ASIC), op mizing for area, speed.
4. Technology Mapping
The synthesized design is mapped to specific gates available in the
chosen technology's library.
5. Place and Route
Placement: Assigns posi ons to gates/modules inside the chip (like on an
FPGA fabric).
Rou ng: Connects the gates/modules as per the netlist.
6. Timing Simula on
Run simula on with actual delay values to verify the design will s ll
work under real- me condi ons.
7. Fabrica on (Only in ASIC Flow)
A er simula on is successful, the chip design is sent for manufacturing
(fabrica on)