MCES - IA 1-Solution
MCES - IA 1-Solution
08
Figure: An ARM-based Embedded Device, a Microcontroller
Diagram: 3M
We can separate the device into four main hardware components:
1. The ARM processor controls the embedded device. An ARM processor comprises a core
(the execution engine that processes instructions and manipulates data) plus the
surrounding components (memory and cache) that interface it with a bus.
2. Controllers coordinate important functional blocks of the system. Two commonly found
controllers are interrupt and memory controllers.
3. The peripherals provide all the input-output capability external to the chip and are
responsible for the uniqueness of the embedded device.
4. A bus is used to communicate between different parts of the device.
Advanced System Bus (ASB), Advanced Peripheral Bus(APB). Advanced High
Performance Bus (AHB).
Reusable design, run at higher clock speeds.
ARM has introduced two variations on the AHB bus: Multi-layer AHB and AHB-Lite.
The Multi-layer AHB bus allows multiple active bus masters.
AHB-Lite is a subset of the AHB bus and it is limited to a single bus master.
Brief Explanation: 5M
1
b) Discuss ARM design philosophy.
Solution:
THE ARM DESIGN PHYLOSOPHY:
Battery power: The ARM processor has been specially designed to be small to reduce
power consumption and extend battery operation
High code density:useful for applications that have limited on-board memory, such as
mobile phones and mass storage devices. 04
Low-cost:Embedded systems are price sensitive - essential for high-volume applications
like digital cameras.
Hardware debug technology within the processor so that software engineers can view
what is happening while the processor is executing code. With greater visibility, software
engineers can resolve issues faster.
1 M for each point
2 a) Define pipeline. Illustrate ARM7 pipeline with suitable example.
Solution:
A pipeline is the mechanism in a RISC processor, which is used to execute instructions.
Pipeline speeds up execution by fetching the next instruction while other instructions are
being decoded and executed. Definition: 2M
ARM7 pipeline
08
The Figure shows a sequence of three instructions being fetched, decoded, and executed
by the processor.
The three instructions are placed into the pipeline sequentially.
In the first cycle, the core fetches the ADD instruction from memory.
In the second cycle, the core fetches the SUB instruction and decodes the ADD
instruction.
In the third cycle, both the SUB and ADD instructions are moved along the pipeline. The
ADD instruction is executed, the SUB instruction is decoded, and the CMP instruction is
fetched.
This procedure is called filling the pipeline.
About the stages: 3M
Explanation of these stages in pipeline: 3M
b) Compare microprocessors and microcontrollers.
Solution: (Any four of the following)
Microprocessor Microcontroller 04
A silicon chip representing a central processing A microcontroller is a highly integrated chip that
unit (CPU), which is capable of performing contains a CPU, scratchpad RAM, special and
arithmetic as well as logical operations general purpose register arrays, on chip ROM/
2
according to a pre-defined set of instructions FLASH memory for program storage, timer and
interrupt control units and dedicated I/O ports
It is a dependent unit. It requires the combination It is a self-contained unit and it doesn't require
of other chips like timers, program and data external interrupt controller, timer, UART, etc. for
memory chips, interrupt controllers, etc. for its functioning
functioning
General purpose in design and operation Mostly application-oriented or domain-specific
Doesn't contain a built in I/O port. - external multiple built-in I/O ports
programmable peripheral interface chips like
8255
Targeted for high end market where performance Targeted for embedded market where performance
is important is not so critical
08
Diagram – 4M
Brief one line introduction to all blocks – 4M
b) With the help of basic layout diagram, explain the current program register.
Solution:
04
The Jazelle J and Thumb T bits in the cpsr reflect the state of the processor.
J = 0, T=0 => ARM state
T=1 => Thumb state
Mode:
six privileged modes (abort, fast interrupt request, interrupt request, supervisor, system,
and undefined), one non-privileged mode (user).
Interrupt Masks:
Interrupt masks are used to stop specific interrupt requests from interrupting the processor.
The I bit masks IRQ when set to binary 1; and similarly, the F bit masks FIQ when set to
3
binary
Condition flags and a short description on what causes them to be set.
Flag Flag Name Set When
V oVerflow the result causes a signed overflow
C Carry the result causes an unsigned carry
Z Zero the result is zero
N Negative bit 31 of the result is a binary 1
2 M for diagram
2M for explanation for each field
4 a) Explain the different operating modes of ARM processor.
Solution:
Six privileged modes (abort, fast interrupt request, interrupt request, supervisor, system,
and undefined)
The processor enters abort mode when there is a failed attempt to access memory.
Fast interrupt request and interrupt request modes correspond to the two interrupt levels
available on the ARM processor.
Supervisor mode is the mode that the processor is in after reset and is generally the mode 08
that an operating system kernel operates in.
System mode is a special version of user mode that allows full read-write access to the
cpsr.
Undefined mode is used when the processor encounters an instruction that is undefined or
not supported by the implementation.
One non-privileged mode (user):User mode is used for programs and applications.
Mentioning all 7 modes: 2M
Brief explanation of all: 6M
b) Discuss the design rules of RISC architecture.
Solution:
THE RISC DESIGN PHYLOSOPHY:
Instructions—RISC processors have a reduced number of instruction classes and can each
execute in a single cycle.
Pipelines—The processing of instructions is broken down into smaller units that can be
executed in parallel by pipelines. Ideally the pipeline advances by one step on each cycle 04
for maximum throughput. Instructions can be decoded in one pipeline stage.
Registers—RISC machines have a large general-purpose register set. Any register can
contain either data or an address. Registers act as the fast local memory store for all data
processing operations.
Load-store architecture - the processor operates on data held in registers. Separate load
and store instructions transfer data between the register bank and external memory.
1 M for each point
5 a) Explain Embedded System Software with a neat diagram.
Solution:
EMBEDDED SYSTEM SOFTWARE:
08
04
6 a) Define conditional execution. Mention any six conditional mnemonics with their
appropriate meaning and condition flags.
Solution:
Conditional execution controls whether or not the core will execute an instruction. Most
instructions have a condition attribute that determines if the core will execute it based on the
setting of the condition flags.
Definition: 2M
Condition Mnemonics: (Any six among the following to be mentioned) ----- 6M
08
5
• ARM10 uses branch prediction – reduces the effect of pipeline flush
• Predicting the possible branches
• Loading the new branch address prior to the execution of the instruction.
• An instruction in the execute stage will complete even though an interrupt has been raised.
7 a) List and explain all arithmetic instructions of ARM7.
Solution:
08
04
04
b) Determine the effective address and contents of base address register for the following
instructions considering R0 = 0xA0000 and R1 = 0x20. Also, indicate the indexing
method used in each of the instructions.
i. LDR R2, [R0, R1, LSL #2]!
Indexing: Pre-index with writeback
Effective Address = Base + offset = 0xA0000 + ( 0x20 * 4) = 0xA0000 + 0x80 = 0xA0080 04
Base = Base + offset = 0xA0080
ii. STR R3, [R0], #-4
Indexing: Post-index
Effective Address = Base = 0xA0000
Base = Base + offset = 0xA0000 + (-4)= 0x9FFFC
6
c) Determine the post condition for the following preconditions
R5=0X65, R7=0XA994567B, R8=0XFFFFFF,R9=R10= 0
RSBS R9, R7, R8
SBC R10, R5, #4
POST: RSBS: R9 = R8 – R7 = R8 + 2’s complement (R7)
02
7
memory contents)
i. LDR R4, [R0, R1, LSL #1]!
Solution: EA = Base + offset = 0x000C0000 + (4 * 2) = 0x000C0008
R4 Mem32[0x000C0008]
R0 = base + offset = 0x000C0008
POST: R4 = 0x33333333, R0 = 0x000C0008, R1 = 0x00000004
Calculation: 3M
ii. STR R3, [R0, R1, LSL #2]!
Solution: EA = Base + offset = 0x000C0000 + (0x04 * 0x04) = 0x000C0000 + 0x10
R3 Mem32[0x000C0010]
R0 = base + offset = 0x000C0010
POST: R3 = 0x789ABCDE, R0 = 0x000C0010, R1 = 0x00000004
Mem32[0x000C0010] = 0x789ABCDE
Calculation: 3M
c) Pre: R1 = 0x7846, R2 = 0x1111, R3 = 0xFFFFFFFF, R4 = 0x44
Instruction: UMLAL R1, R2, R3, R4. Determine the post condition.
Solution:
3FFFFFFFC
+3FFFFFFFC
= 43FFFFFFBC
To perform [R2 R1 ] = [R2 R1 ] + (R3 * R4) :
[R2 R1 ] = 0 0 0 0 1 1 1 1 0 0 0 0 7 8 4 6
04
R3 * R4 = 0 0 0 0 0 0 4 3 F F F F F F B C
SUM: 000011550000 7 8 02
Higher 32-bits will be moved to RdHi = R2 and lower 32-bits will be moved to RdLo
= R1
Therefore, R1 = 0x00007802 and R2 = 0x00001155
POST: