Esd Cie-1
Esd Cie-1
Justify the need for Real-Time Clock (RTC) and Watchdog Timer (WDT) in an Embedded
System. What is the significance of a Watchdog Timer?
In an embedded system, the Real-Time Clock (RTC) and Watchdog Timer (WDT) are essential
components that serve critical roles in functionality and reliability.
•
Applications: RTCs are used in various devices, including digital clocks, data loggers,
and automation systems. For example, in a smart meter, the RTC logs energy
consumption at precise intervals, allowing accurate billing based on time-of-day usage.
Quality attributes in embedded systems define the system's performance, usability, reliability,
and overall quality. These attributes are broadly classified into operational and non-
operational categories.
1. Response Time: Measures the time taken for the system to respond to inputs or events.
It is crucial for real-time systems like braking systems in vehicles, where delays can lead
to safety risks.
2. Throughput: Represents the data-handling capacity of the system within a given time.
High throughput is important in systems like network routers or video streaming devices.
3. Reliability: Indicates the system's ability to perform consistently over time without
failure. This attribute is critical for applications requiring high uptime, such as
healthcare devices.
4. Maintainability: Refers to the ease with which the system can be maintained or
repaired. Systems with long lifespans, like industrial machinery, require high
maintainability to minimize downtime.
6. Safety: Prevents the system from causing harm to users or the environment, essential
for systems like medical devices and automotive controls.
1. Testability and Debug-ability: Allows for efficient testing and debugging, reducing time
to detect and correct issues, especially in complex systems.
2. Evolvability: Describes how easily the system can be updated or enhanced, vital for
systems that need regular feature updates.
3. Portability: Measures how easily the system can be adapted to different environments
or hardware platforms.
4. Time to Prototype and Market: Indicates the speed of development and production,
impacting competitive advantage.
5. Cost (Per Unit and Total Cost): Involves the cost of development, manufacturing, and
maintenance, influencing the system's economic feasibility.
Quality Attribute Determining Warranty: Reliability is the primary quality attribute that affects
a product's warranty. High reliability implies that the product will consistently perform well over
time, minimizing the likelihood of failures, which justifies a longer warranty period. A highly
reliable product assures the customer of its long-term performance, which is a key factor in
determining warranty duration.
3.Design an 8KX8 RAMmodule using 2KX8 RAM chips. The module should be connected on
an 8-bit processor witha 16-bit address bus, and occupy the address range starting from
the address A000. Show the circuit and the memory map.
Decoder needed=2X4
2^m=2K=2^1x 2^10=2^11(A0..A10)
Decoder needed=2X4
Each of these factors helps ensure that the microcontroller and memory meet the application’s
functional and operational requirements efficiently and cost-effectively.
6. Design the SRAM Cell Implementation for Writing a “1” into the Cell.
Static Random Access Memory (SRAM) is a type of volatile memory used for high-speed data
storage. An SRAM cell is typically implemented using a bistable circuit (latch) formed by two
cross-coupled inverters. Each SRAM cell can store a single bit of data (either “1” or “0”) by
holding it in a stable state until it is changed or power is removed.
1. Bistable Circuit: The basic storage element in an SRAM cell is a latch composed of two
cross-coupled inverters. This latch holds the data bit in a stable state.
2. Access Transistors: Two NMOS transistors are connected to the latch to control read
and write operations. These access transistors are connected to bit lines (BL and BL')
and are controlled by a word line (WL).
3. Bit Lines (BL and BL'): The bit lines are used to read from and write to the SRAM cell.
The bit lines are typically complementary (BL and BL') to provide higher stability and
noise resistance.
4. Word Line (WL): The word line is activated to enable the access transistors during read
and write operations.
1. Pre-charge the Bit Lines: During a write operation, both bit lines (BL and BL') are pre-
charged to a specific voltage level.
2. Set BL and BL' Values: To write a “1” into the cell, the bit line (BL) is set to a high voltage
(logic “1”), and the complementary bit line (BL') is set to a low voltage (logic “0”).
3. Activate the Word Line (WL): When the WL is activated, the access transistors connect
the bit lines to the cell’s storage nodes.
4. Data Writing: The high voltage on BL causes one side of the cross-coupled inverters to
drive the node to “1” and the other node to “0”. This state is latched into the cell, storing
the bit value as “1”.
5. Deactivation: After the data is written, the WL is deactivated, and the access
transistors disconnect the cell from the bit lines. The cell now retains the “1” value until
overwritten or powered off.
This process ensures that a “1” is successfully written and stored in the SRAM cell, allowing for
stable, fast data access and low power consumption compared to DRAM.
7. An Embedded Engineer Needs to Make a Judicious Choice of the Memory Type for a
Specific Application. Analyze the Type to Be Used with an Example for Each Type.
Choosing the right memory type in an embedded system is crucial to meet application
requirements, such as speed, capacity, and power efficiency. Here’s an analysis of common
memory types, along with examples of their typical applications.
Finally design Smart Card hardware system with component function and specifications
UNIT-2
1. With an example, illustrate how the use of a barrel shifter with an ALU improves
the power and flexibility of many data processing operations.
In ARM processors, the barrel shifter is a powerful component that works alongside the
Arithmetic Logic Unit (ALU) to perform efficient data manipulation in a single instruction. The
barrel shifter enhances the processor’s capability by allowing a shift or rotation operation to be
applied directly to an operand before it enters the ALU. This capability is integrated within many
ARM instructions, which means that the processor can perform a shift or rotate and an
arithmetic or logical operation simultaneously. This feature not only reduces the number of
instructions needed but also saves execution time and power, which is essential in embedded
systems.
• Logical Shift Left (LSL): Shifts bits to the left, filling in zeros on the right.
• Logical Shift Right (LSR): Shifts bits to the right, filling in zeros on the left.
• Arithmetic Shift Right (ASR): Shifts bits to the right, preserving the sign bit for signed
numbers.
• Rotate Right (ROR): Rotates bits to the right, wrapping bits around to the left.
• Rotate Right with Extend (RRX): Rotates bits to the right with the carry flag, useful in
handling carry operations in extended precision arithmetic.
Example: Suppose we need to multiply a value by 32 and then add another value. Normally,
multiplication could require several cycles if done using repeated additions or a dedicated
multiplier circuit. However, with a barrel shifter, multiplication by powers of 2 can be done in
one instruction using a left shift.
In this example:
Here, the use of a barrel shifter saves instructions and cycles by performing the multiplication
in one shift operation instead of using multiple instructions or a dedicated multiplier. The barrel
shifter provides flexibility to handle various shift and rotate operations without extra cycles or
dedicated hardware, making it ideal for embedded applications where power and processing
efficiency are critical.
2. With a neat diagram explain the different general purpose registers of ARM processors.
In ARM processors, general-purpose registers play a critical role in executing instructions and
holding temporary data. ARM architectures, particularly the ARM Cortex-M and ARM7 families,
are designed with a set of general-purpose registers, as well as specific registers dedicated to
system control. ARM processors typically use a 32-bit architecture with 16 main registers,
labeled from R0 to R15.
Here’s an explanation of the different general-purpose registers in ARM, along with a diagram to
illustrate their roles:
Diagram of ARM General Purpose Registers
Here is a typical layout of the ARM processor registers:
markdown
Copy code
-------------------------------------
| Program Counter (R15) | <-- Holds address of next instruction
-------------------------------------
| Link Register (R14) | <-- Stores return address for subroutines
-------------------------------------
| Stack Pointer (R13) | <-- Points to top of the stack
-------------------------------------
| R12 | <-- General-purpose register
-------------------------------------
| R11 | <-- General-purpose register (frame pointer)
-------------------------------------
| R10 | <-- General-purpose register
-------------------------------------
| R9 | <-- General-purpose register
-------------------------------------
| R8 | <-- General-purpose register
-------------------------------------
| R7 | <-- General-purpose register
-------------------------------------
| R6 | <-- General-purpose register
-------------------------------------
| R5 | <-- General-purpose register
-------------------------------------
| R4 | <-- General-purpose register
-------------------------------------
| R3 | <-- General-purpose register
-------------------------------------
| R2 | <-- General-purpose register
-------------------------------------
| R1 | <-- General-purpose register
-------------------------------------
| R0 | <-- General-purpose register (function argument/return value)
-------------------------------------
Explanation of ARM General-Purpose Registers
1. R0–R12: These are general-purpose registers available for any kind of data storage or
computation during program execution.
o R0–R3: Often used to hold arguments for functions and to return results. For
instance, R0 typically stores the return value of functions.
o R4–R12: Commonly used as general-purpose registers in computations and can
hold any intermediate values, loop counters, pointers, or flags as needed by the
program.
2. R13 (Stack Pointer):
o The Stack Pointer (SP) is used to point to the top of the stack, a memory area
used for temporary storage of data, return addresses, and local variables in
subroutines.
o It is crucial for managing function calls and returns, especially in applications
with recursive calls.
3. R14 (Link Register):
o The Link Register (LR) stores the return address for subroutines. When a
function is called, the address of the next instruction is stored in the LR, allowing
the program to return to this point after the function completes.
o In many ARM subroutine calls, the BL (branch with link) instruction
automatically places the return address in R14.
4. R15 (Program Counter):
o The Program Counter (PC) holds the address of the next instruction to execute.
ARM processors increment this register automatically after each instruction,
pointing to the next operation in sequence.
o In certain instructions, it can be modified directly to control program flow, such
as in branching instructions for loops or conditional statements.
Additional Points on ARM Register Organization
• Current Program Status Register (CPSR): Though not one of the general-purpose
registers, the CPSR holds flags that reflect the current state of the processor (such as
zero, negative, carry, overflow flags, and other control flags).
• Register Usage in Calling Conventions: In ARM’s Application Binary Interface (ABI),
registers are assigned specific roles:
o R0–R3 are used for parameter passing and function return values.
o R4–R11 are typically preserved across function calls, meaning if a function
modifies these registers, it must restore them before returning.
ARM processors support two primary instruction sets: the ARM instruction set and the Thumb
instruction set. Both sets are designed to maximize the processor’s efficiency and adaptability
in different scenarios, such as high-performance and low-power applications.
4. What are banked registers? Show how the banked registers are utilized when the
user mode changes to IRQ mode.
Banked registers are special registers in ARM architecture that exist as separate versions for
different processor modes (User, FIQ, IRQ, Supervisor, etc.). Banked registers allow the
processor to switch modes without saving and restoring specific registers, making mode
switching faster and more efficient. ARM has banked registers for critical registers, such as the
Stack Pointer (SP) and Link Register (LR), to avoid data corruption and ensure smooth
transitions between modes.
For example, in IRQ (Interrupt Request) mode, which is used to handle standard interrupts,
the ARM processor has dedicated registers:
• R13_irq (Stack Pointer for IRQ mode): Stores the IRQ mode stack pointer, allowing the
processor to use a separate stack for interrupts.
• R14_irq (Link Register for IRQ mode): Holds the return address for the IRQ mode,
preserving the return address from User mode.
1. The processor saves the User mode’s Program Counter (PC) and Current Program
Status Register (CPSR) in the banked Link Register (R14_irq) and Saved Program Status
Register (SPSR_irq).
2. It loads the IRQ mode stack pointer (R13_irq) to manage the interrupt’s call stack
separately.
3. After handling the interrupt, the processor uses the banked registers to restore the
previous state without affecting the User mode’s registers.
This approach improves interrupt handling speed and efficiency by isolating mode-specific
data, which is crucial for real-time applications where interrupts need to be processed
promptly without corrupting the state of the main program.
5. What are interrupts or exceptions? How are they handled in ARM processors?
Interrupts (or exceptions) are events that temporarily halt the normal execution flow of a
program to handle specific, often critical, conditions. They allow the processor to respond to
events, such as hardware signals, software requests, or system errors, by invoking a specific
routine, known as an interrupt handler or exception handler.
In ARM processors, interrupts are handled through predefined exception vectors, which are
specific memory locations associated with each interrupt type. Common exceptions in ARM
include Reset, Undefined Instruction, Supervisor Call (SVC), Prefetch Abort, Data Abort, IRQ
(Interrupt Request), and FIQ (Fast Interrupt Request).
ARM’s interrupt handling is efficient due to its use of banked registers, allowing quick context
switching and enabling real-time responsiveness essential for embedded systems.
7. Indicate how the CPSR that resides in the register file of the ARM core is used to
monitor and control internal operations.
The Current Program Status Register (CPSR) is a special-purpose register in ARM architecture
that monitors and controls the processor’s internal state and status. It contains flags and mode
bits that provide information on the processor’s current state and control specific operations.
1. Condition Flags:
o Negative (N): Set if the result of an arithmetic operation is negative.
o Zero (Z): Set if the result of an operation is zero.
o Carry (C): Set if an arithmetic operation results in a carry out or borrow.
o Overflow (V): Set if an arithmetic operation causes an overflow. These flags are
updated by ALU operations and are used by conditional instructions to
determine the execution flow based on computation results.
2. Mode Bits:
o M[4:0]: Indicates the current operating mode, such as User, FIQ, IRQ,
Supervisor, Abort, or Undefined.
o Interrupt Disable Bits (I and F): Control whether IRQ and FIQ interrupts are
enabled or disabled. Setting these bits prevents the processor from handling
specific types of interrupts, which is useful during critical code sections where
interrupts could disrupt operations.
3. Thumb State (T) Bit:
o Indicates whether the processor is in ARM (32-bit instructions) or Thumb (16-bit
instructions) state. This bit controls the instruction set the processor executes,
allowing flexibility between ARM and Thumb mode.
• The condition flags (N, Z, C, V) directly affect the execution of conditional instructions
like BEQ (Branch if Equal) or BNE (Branch if Not Equal), enabling the processor to take
different execution paths based on computation results.
• The mode bits (M[4:0]) control the current processor mode. When an exception occurs,
the CPSR mode bits change to reflect the new mode (e.g., IRQ mode for an interrupt),
ensuring the processor executes the correct exception handler.
• The interrupt disable bits allow specific code sections to be executed without the risk of
interruption, which is crucial for atomic operations.
By using CPSR to control these aspects, ARM processors efficiently handle internal states,
enabling robust, flexible, and responsive system operation.
Answer:
• Operation: The MOV (move) instruction loads the immediate value 0x02 into register
R0.
• Result: R0 = 0x02
• Operation: The ADD instruction adds the value in R0 to itself and stores the result in R1.
• Calculation: R1 = R0 + R0 = 0x02 + 0x02 = 0x04
• Result: R1 = 0x04
• Operation: The MOV instruction loads the immediate value 0x9B1D into register R2.
• Result: R2 = 0x9B1D
• Operation: The MOV instruction loads the negative value -0x281 into register R3. ARM uses two’s
complement notation for negative numbers.
• Calculation: To represent -0x281 in a 32-bit register:
o First, find the positive hex value: 0x281 = 641 in decimal.
o Take the two’s complement: 0xFFFFFFFF - 0x281 + 1 = 0xFFFFFD7F.
• Result: R3 = 0xFFFFFD7F
• Operation: The LSL (Logical Shift Left) instruction shifts the bits of R1 left by 6 positions and
stores the result in R4.
• Calculation: R4 = R1 << 6 = 0x04 << 6 = 0x0100
• Result: R4 = 0x0100
• Operation: This LSL instruction shifts the bits of R3 left by the number of positions
specified in R0 (which is 2).
• Calculation: R5 = R3 << 2 = 0xFFFFFD7F << 2
o The value 0xFFFFFD7F in binary is 1111 1111 1111 1111 1111 1101 0111 1111.
o Shifting this by 2 bits left results in 1111 1111 1111 1111 1111 0101 1111 1100 in
binary, which is 0xFFFFF5FC in hexadecimal.
• Result: R5 = 0xFFFFF5FC
• Operation: The LSR (Logical Shift Right) instruction shifts the bits of R2 right by 5
positions and stores the result in R6.
• Calculation: R6 = R2 >> 5 = 0x9B1D >> 5
o The value 0x9B1D in binary is 1001 1011 0001 1101.
o Shifting this by 5 bits right results in 0000 0100 1101 1000 in binary, which is
0x04D8 in hexadecimal.
• Result: R6 = 0x04D8