FormularioMicrocontrollers and DSP: definizioni, teoremi e formule delle note, in ordine di capitolo
In questa pagina 7
I. Processor Structure
Fetch-Execute Cycle and Datapath
Formula (single-cycle clock period). Every instruction takes one clock cycle; the period must fit the slowest instruction. With delays memory 200 ps, register file 100 ps, ALU 200 ps:
Instruction Instr. mem. Reg. read ALU Data mem. Reg. write Total arithmetic 200 100 200 — 100 600 ps load 200 100 200 200 100 800 ps store 200 100 200 200 — 700 ps branch 200 100 200 — — 500 ps Period = 800 ps (1.25 GHz) for all instructions. Separate instruction and data memories and several adders are needed, since each unit can be used once per cycle.
II. Arithmetic-Logic Unit Circuits
Adders
Formula (full adder).
Formula (ripple-carry delay, worst case). full adders in cascade, . With the carry delay () and the sum delay () of one full adder, and : in the worst case (all , the carry crosses all stages) the last bit waits carry delays: and if set-up is counted.
Formula (carry-bypass delay and optimal block size). Worst case: the carry is generated at the first stage of the first block and crosses it (), skips the following blocks through multiplexers, then crosses stages of the last block:
Formula (linear carry-select). Blocks of bits, blocks:
Formula (square-root carry-select).
Shift Registers, Shifters and Multipliers
Formula (array multiplier: cells and delay). AND gates generate the partial products and a matrix of full adders sums the rows (the carry of each row propagates to the next). For : AND gates and full adders. The critical path crosses about cells: linear in with area .
Arithmetic Logic Unit
Formula (magnitude comparator). Compare bits from the most significant: if at the first differing bit , . With :
III. Control and Instruction Set
Instruction Formats and Addressing Modes
Formula (scaled index). The factor steps uniformly through arrays of bytes, halfwords, words, doublewords. In ARM
LDR r0, [r1, r2, LSL #2]reads elementr2of a word array starting atr1.
IV. Arithmetic
Binary Arithmetic
Formula (subtraction). : compute the opposite of (invert the bits, add 1; see Signed Integer RepresentationsSigned integers on n bits: sign-magnitude, one's complement, two's complement and excess K, with representable ranges, computing the opposite, sign extension and a 4-bit comparison table.Signed Integer Representations →) and add. In hardware: invert the bits of and set the adder carry in to 1, so no subtractor is needed.
Fixed-Point and Floating-Point Numbers
Formula (value of an IEEE 754 number).
Format Bits Sign Exponent Mantissa Bias Decimal digits single precision 32 1 8 23 127 about 7 double precision 64 1 11 52 1023 about 16
Formula (largest and smallest normalized, spacing).
- Largest normalized: .
- Smallest positive normalized: (pattern ).
- Spacing of consecutive floats with exponent : . Near 1 it is (machine epsilondistance between 1 and the next float); near it is 2: from there on not all integers are representable.
V. ARM Core and Programming
Arrays, Strings and Structures in ARM Assembly
Formula (address of an array element). An array of elements of bytes occupies consecutive bytes. Element is at address
Formula (address of a matrix element, row-major). A matrix
int m[R][C]is stored by rows: element is at
VI. Memory
Memory Hierarchy and Locality
Formula (average access time with a cache). If a miss costs the cache access plus the memory access:
Formula (average time with two cache levels). With two cache levels: , where are the local miss rates.
Cache Memory
Formula (direct mapping). Each block can go into one line only:
Address fields, from the most significant: tag, line ( bits), word ( bits).
Formula (set-associative mapping with ways). The lines are divided into sets of lines. A block goes into a fixed set, in any line of the set:
Address fields: tag, set ( bits), word.
Formula (address fields of a cache). With capacity , line (= block) of bytes, ways and byte-addressed memory:
External Memory - Disks, RAID and Optical Storage
Formula (disk capacity). Capacity = surfaces x tracks per surface x sectors per track x bytes per sector.
Formula (disk access time)
- Positioning (seek): moving the head onto the track; a datum of the disk (average value).
- Rotational latency: waiting for the sector to pass under the head; on average half a revolution:
- Transfer of bytes on a track of bytes (fraction of a revolution):
VII. Peripherals and Interrupts
Direct Memory Access
Formula (interrupts versus DMA). Transferring 4 KB in 4-byte words = 1024 words.
- Interrupt: 1024 interrupts; if each costs 200 cycles between context saving, routine and return, about 205 000 CPU cycles.
- DMA: initial programming (for example 100 cycles) + one final interrupt (200 cycles) is about 300 CPU cycles, plus any cycles taken on the bus.