Iat-4 Mces
Iat-4 Mces
1). Differentiate between i) RISC and CISC Processors ii) Microcontroller and microprocessor.
i).
ii).
2). Explain the architecture of a typical embedded device based on ARM core with a neat diagram.
Typical embedded system mainly has two parts i.e., embedded hardware and embedded software.
Embedded hardwares are based around microprocessors and microcontrollers, also include
memory, bus, Input/Output, Controller, where as embedded software includes embedded operating
systems, different applications and device drivers. Basically these two types of architecture
i.e., Havard architecture and Von Neumann architecture are used in embedded systems.
Architecture of the Embedded System includes Sensor, Analog to Digital Converter, Memory,
Processor, Digital to Analog Converter, and Actuators etc.
The below figure illustrates the overview of basic architecture of embedded systems :
1. Analysis
2. Design
3. Implementation
If we will go a little bit deeper to the development steps it includes these 7 steps :
1. Requirement analysis
2. Examine
3. Design
4. Develop
5. Test
6. Deploy
7. Maintenance
Now Let’s discuss some of the advantages and disadvantages of Embedded systems.
3). a). Discuss the following with diagram. i) Von Neuman architecture with cache ii) Harvard
architecture with TCM.
Harvard Architecture:
It is a computer architecture with physically separate storage and signal
pathways for program data and instructions. Unlike Von Newmann
architecture which employs a single bus to both fetch instructions from
memory and transfer data from one part of a computer to another, Harvard
architecture has separate memory space for data and instruction.
The ARM core uses reduced instruction set computer (RISC) architecture. RISC is a design philosophy
aimed at delivering simple but powerful instructions that execute within a single cycle at a high clock
speed.
The RISC philosophy concentrates on reducing the complexity of instructions performed by the
hardware because it is easier to provide greater flexibility and intelligence in software rather than
hardware. As a result, a RISC design places greater demands on the compiler.
In contrast, the traditional complex instruction set computer (CISC) relies more on the hardware for
instruction functionality, and consequently the CISC instructions are more complicated. The
following Figure illustrates these major differences.
4). With an example, explain the following ARM instructions i) BIC ii) MVN iii) ADC iv) RSC v) LDR.
i). BIC:
Example: This example shows a more complicated logical instruction called BIC, which carries out a
r2 = 0b0101
POST r0 = 0b1010
ii). MVN
PRE none...
POST r0 = 0xff00ffff
As you can see, there are alternatives to accessing memory, but they depend upon the constant you
are trying to load.
The LDR pseudo-instruction either inserts an MOV or MVN instruction to generate a value (if
possible)
or generates an LDR instruction with a pc-relative address to read the constant from a literal pool—a
data area embedded within the code.
iii). ADC
iv). LDR
Example:
PRE r0 = 0x00000000
r1 = 0x00090000
mem32[0x00009000] = 0x01010101
mem32[0x00009004] = 0x02020202
r1 = 0x00009004
Preindexing:
POST(2) r0 = 0x02020202
r1 = 0x00009000
Postindexing:
POST(3) r0 = 0x01010101
r1 = 0x00009004
ENTRY
MOV R0,#4;
CMP R0,#0
BEQ ANS
CMP R0,#1
BEQ ANS
MOV R1,R0
UP SUBS R1,R1,#1
BEQ STOP;
MUL R2,R1,R0
MOV R0,R2
B UP
STOP B STOP;
Swap Instruction: The swap instruction is a special case of a load-store instruction. It swaps the
contents of memory with the contents of a register.
This instruction is an atomic operation—it reads and writes a location in the same bus operation,
preventing any other instruction from reading or writing to that location until it completes.
Example: The swap instruction loads a word from memory into register r0 and overwrites the
memory
r0 = 0x00000000
r1 = 0x11112222
r2 = 0x00009000
r0 = 0x12345678
r1 = 0x11112222
r2 = 0x00009000
6). a). Explain the barrel shifter operation in ARM processor, with a neat diagram.
Barrel Shifter:
In above Example, we showed a MOV instruction where N is a simple register. But N can be more
than
just a register or immediate value; it can also be a register Rm that has been preprocessed by the
barrel
Data processing instructions are processed within the arithmetic logic unit (ALU).
A unique and powerful feature of the ARM processor is the ability to shift the 32-bit binary
pattern in one of the source registers left or right by a specific number of positions before it enters
the ALU.
o This shift increases the power and flexibility of many data processing operations.
o This is particularly useful for loading constants into a register and achieving fast
There are data processing instructions that do not use the barrel shift, for example, the
MUL (multiply), CLZ (count leading zeros), and QADD (signed saturated 32-bit add)
instructions.
Figure shows the data flow between the ALU and the barrel shifter.
We apply a logical shift left (LSL) to register Rm before moving it to the destination register. This
is the same as applying the standard C language shift operator « to the register.
b). Write an ALP for forward and backward branch by considering an example.
Example: This example shows a forward and backward branch. Because these loops are address
specific,
we do not include the pre- and post-conditions. The forward branch skips three instructions. The
B forward
forward
---------------------------------------------------
backward
B backward
In this example, forward and backward are the labels. The branch labels are placed at the beginning
of the line and are used to mark an address that can be used later by the assembler to calculate the
branch offset.
SET – 2
1). Explain the architecture of a typical embedded device based on ARM core with a neat diagram.
Already Done.
Embedded devices use an on-chip bus that is internal to the chip and that allows different peripheral
devices to be interconnected with an ARM core. There are two different classes of devices attached
to the bus:
1. The ARM processor core is a bus master—a logical device capable of initiating a data transfer with
another device across the same bus.
2. Peripherals tend to be bus slaves—logical devices capable only of responding to a transfer request
from a bus master device.
A physical level—covers the electrical characteristics and bus width (16, 32, or 64 bits).
The protocol—the logical rules that govern the communication between the processor and a
peripheral.
b). Discuss the RISC design philosophy and mention the four rules.
Already done
4). Explain the following ARM instructions i) RSB ii) BL iii) LDMIA iv) OR v) RRX with an example.
i). RSB
Example: The following reverse subtract instruction (RSB) subtracts r1 from the constant value #0,
writing the result to r0. You can use this instruction to negate numbers.
PRE r0 = 0x00000000
r1 = 0x00000077
ii). LDMIA:
Example: In this example, register r0 is the base register Rn and is followed by !, indicating that the
register is updated after the instruction is executed. You will notice within the load multiple
instruction
that the registers are not individually listed. Instead the “-” character is used to identify a range of
Each register can also be listed, using a comma to separate each register within “{” and “}” brackets.
mem32[0x80014] = 0x02
mem32[0x80010] = 0x01
r0 = 0x00080010
r1 = 0x00000000
r2 = 0x00000000
r3 = 0x00000000
POST r0 = 0x0008001c
r1 = 0x00000001
r2 = 0x00000002
r3 = 0x00000003
iii). ORR
Example: This example shows a logical OR operation between registers r1 and r2. Register r0 holds
the
result.
PRE r0 = 0x00000000
r1 = 0x02040608
r2 = 0x10305070
POST r0 = 0x12345678
iv). RRX
5). a). Write an ALP to find larger of two numbers stored in memory location ARRAY and store the
result in R0.
Not found.
Multiply Instructions: The multiply instructions multiply the contents of a pair of registers and,
depending upon the instruction, accumulate the results in with another register. The long multiplies
accumulate onto a pair of registers representing a 64-bit value. The final result is placed in a
destination register or a pair of registers.
Example: This example shows a simple multiply instruction that multiplies registers r1 and r2
together
and places the result into register r0. In this example, register r1 is equal to the value 2, and r2 is
equal to
PRE r0 = 0x00000000
r1 = 0x00000002
r2 = 0x00000002
POST r0 = 0x00000004
r1 = 0x00000002
r2 = 0x00000002
6). a). Explain the barrel shifter operation in ARM processor, with a neat diagram.
Already done.