ARM Viva Question and Answer
ARM Viva Question and Answer
Programming
Viva - Voce
ARM Programming
2. What is 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 for maximum
throughput. Instructions can be decoded in one pipeline stage. There is no need for an
instruction to be executed by a miniprogram called microcode as on CISC processors.
3. What is 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. In contrast, CISC processors have dedicated registers for specific purposes.
4. Explain 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. Memory accesses are costly, so
separating memory accesses from data processing provides an advantage because you can use
data items held in the register bank multiple times without needing multiple memory accesses.
In contrast, with a CISC design the data processing operations can act on memory directly.
5. Explain Variable cycle execution for certain instructions.
Not every ARM instruction executes in a single cycle. For example, load-store-multiple
instructions vary in the number of execution cycles depending upon the number of registers
being transferred. The transfer can occur on sequential memory addresses, which increases
performance since sequential memory accesses are often faster than random accesses. Code
density is also improved since multiple register transfers are common operations at the start
and end of functions.
9. What is Peripherals ?
Theperipherals provide all the input-output capability external to the chip and are
responsible for the uniqueness of the embedded device.
10. What is a bus?
A Bus is used to communicate between different parts of the device.
General-purpose registers hold either data or an address. They are identified with the letter r
prefixed to the register number. For example, register 4 is given the label r4. The active
registers available in user mode—a protected mode normally used when executing
applications. The processor can operate in seven different modes. All the registers shown are
32 bits in size.
There are up to 18 active registers: 16 data registers and 2 processor status registers. The data
registers are visible to the programmer as r0 to r15.
The ARM processor has three registers assigned to a particular task or special function: r13,
r14, and r15. They are frequently given different labels to differentiate them from the other
registers.
Special-purpose registers:
Register r13 is traditionally used as the stack pointer (sp) and stores the head of the stack
in the current processor mode.
Register r14 is called the link register (lr) and is where the core puts the return
address whenever it calls a subroutine.
Register r15 is the program counter (pc) and contains the address of the next instruction
to be fetched by the processor.
Depending upon the context, registers r13 and r14 can also be used as general-purpose
registers, which can be particularly useful since these registers are banked during a processor
mode change.
15. Explain current program status register (CPSR) with neat diagram.
The ARM core uses the cpsr to monitor and control internal operations. The cpsr is a dedicated
32-bit register and resides in the register file. Figure shows the basic layout of a generic
program status register. Note that the shaded parts are reserved for future expansion.
The cpsr is divided into four fields, each 8 bits wide: flags, status, extension, and control. In
current designs the extension and status fields are reserved for future use. The control field
contains the processor mode, state, and interrupt mask bits. The flags field contains the
condition flags.
Condition flags are updated by comparisons and the result of ALU operations that specify the
S instruction suffix. For example, if SUBS subtract instruction results in a register value of
zero, then the Z flag in the cpsr is set. This particular subtract instruction specifically updates
the cpsr.
A pipeline is the mechanism a RISC processor uses to execute instructions. Using a pipeline
speeds up execution by fetching the next instruction while other instructions are being
decoded and executed.
When an exception or interrupt occurs, the processor sets the pc to a specific memory
address. The address is within a special address range called the vector table. The entries in
the vector table are instructions that branch to specific routines designed to handle a
particular exception or interrupt.
The memory map address 0x00000000 is reserved for the vector table, a set of 32-bit words.
On some processors the vector table can be optionally located at a higher address in memory
(starting at the offset 0xffff0000).
20. Reset Vector: Reset vector is the location of the first instruction executed by the processor
when power is applied. This instruction branches to the initialization code.
21. Undefined instruction vector is used when the processor cannot decode an instruction.
22. Software interrupt vector is called when you execute a SWI instruction. The SWI
instruction is frequently used as the mechanism to invoke an operating system routine.
23. Prefetch abort vector occurs when the processor attempts to fetch an instruction from an
address without the correct access permissions. The actual abort occurs in the decode stage.
24. Data abort vector is similar to a prefetch abort but is raised when an instruction attempts to
access data memory without the correct access permissions.
25. Interrupt request vector is used by external hardware to interrupt the normal
execution flow of the processor. It can only be raised if IRQs are not masked in the cpsr.
26. Fast interrupt request vector is similar to the interrupt request but is reserved for
hardware requiring faster response times. It can only be raised if FIQs are not masked in the
cpsr.
Memory Data and program(code) are stored in Data and Program (Code) are stored in
same memory different memory )
Memory Type It has only RAM for Data & Code It has RAM for Data and ROM for
Code.
Buses Common bus for Address and Separate Bus Address and Data / Code
Data/Code
Data / Code Data or Code in one cycle Data and Code in one cycle
Transfer
Control Signals Less More
Space It needs less Space It needs more space
Cost Less Costly
1 Unstructured Language (No Formal Structure) Structured Language ( Well Define Structure )
2. Differs with respect to processors and Controllers Core Idea remain same with respect to processor and
Controllers
3 Low Level Interface High Level Interface. It can use Assembly as well.
4. Architecture Specific – Based on Instruction Set General Purpose
5. Assembler converts it into Machine Codes. Compiler converts into Machine Codes
PIC Programming
• Polling:
-PIC continuously monitor the status of each device
-Each device get the attention of the CPU as the same level of priority.
• Interrupt:
-Devices get the attention of the CPU only when it needs a service.
Dr. S. Sugumaran, Asso Prof, ECE, Page
SITAMS 12
20ECE474 – ARM and PIC
-Can service many devices with different level
Programming of priorities.
TMR1H,
TIMER1 16-bit T1CON 0.2usec 104.857ms
TMR1L