4 Von Neumann Architecture CPUMemorySystem BusVon Neumann computer architecture without explicit IOSystem bus is a set of three busesAddress: unidirectional and controlled by CPUData: bidirectional, transfer data and instructionControl: a heterogeneous collection of control, status, clock and power lines.E.g., compilers, assemblers, linkers or operating systemReal-time designCertain considerations in the design of system & application programs intended to run in real-time environments.
5 Central Processing Unit Control UnitPCRInstructionaccessAddressBusIRDataBusDatapathALUDataaccessRegisters
6 Instruction processing FetchDecodeLoadExecuteStoreA system is an assembly of components connected together in an organized way.A system is fundamentally altered if a component joins or leaves it.It has a purpose.It has a degree of permanence.It has been defined as being of particular interest.Clock cyclesSequential instruction cycle with five phases
7 Instruction setAn instruction set describes a processor’s functionality and its architecture.Most instructions make reference to either memory locations, pointers to a memory location, or a register.Traditionally the distinction between computer organization and computer architecture is that the latter involves using only those hardware details that are visible to the programmer, while the former involves implementation details.
8 Instruction Forms 0-address form 1-address form 2-address form Stack machineRPN calculatorsE.g., NOP1-address formUses implicit register (accumulator), E.g., INC R12-address formHas the form: op-code operand1, operand2,E.g., ADD R1, R23-address formHas the form: op-code operand1, operand2, resultantE.g., SUB R1, R2, R3
9 Core InstructionsThere are generally six kinds of instructions. These can be classified as:horizontal-bit operatione.g. AND, IOR, XOR, NOTvertical-bit operatione.g. rotate left, rotate right, shift right, and shift leftControle.g. TRAP, CLI, EPI, DPI, HALTdata movemente.g. LOAD, STORE, MOVEmathematical/special processingother (processor specific)e.g. LOCK, ILLEGAL
10 Addressing Modes Three basic modes Others are combinations of these immediate datadirect memory locationindirect memory location: INC &memoryOthers are combinations of theseregister indirectOne of the working registers for storing a pointer to a data structure located in memory.double indirect
11 Two principal techniques for implementing control unit MicroprogrammingDefine an instruction by a microprogram including a sequence of primitive hardware commands, for activating appropriate datapath functions.Hard-wired logicConsist of combinational and sequential circuitsOffer noticeably faster execution; but take more space, difficult to create or modify instructions.
12 IO and interrupt considerations EnhancedSystem BusCPUMemoryInput/Output, including the availability of all associated outputsEnhanced von Neumann architecture with separate memory and I/O elementsIO specific registers form memory segments to status, mode and data registers of configurable I/O ports.
13 Memory-Mapped I/O provides a convenient data transfer mechanism. Not require the use of special CPU I/O instructions.Certain designated locations of memory appear as virtual I/O ports.Load R1, &speed ;motor speed into register R1STORE R1, &motoraddr ;Store to address of ; motor controlwhere speed is a bit-mapped variable and motoraddr is a memory-mapped location.I/O ports can be operated through all instructions that have a memory operand.
14 Input from an appropriate memory-mapped location involves executing a LOAD instruction on a pseudo-memory location connected to an input device.Output uses a STORE instruction.
15 Programmed I/O It offers a separate address space for I/O registers. An additional control signal “memory/IO” for distinguishing between memory and I/O accesses.It saves the limited address space.Special data movement instructions IN and OUT are used to transfer data to and from the CPU.IN R1, & port; Read the content of port and store to R1OUT &port, R1; Write the content of R1 to port.Both require the efforts of the CPU and cost time that could impact real-time performance;Normally, the identity of the operative CPU register is embedded in the instruction code.IN: transfers data from a specified I/O device into a specified CPU register.OUT: outputs from a register to some I/O device.
16 Hardware interrupts Maskable and non-maskable interrupts Maskable: used for events that occur during regular operation conditionsNonmaskable: reserved for extremely critical eventsThey are hardware mechanism for providing prompt services to external events.Reduce real-time punctuality and make response times nondeterministic.Processors provide two atomic instructionsEPI: enable priority interrupt (EPI) andDPI: disable priority interrupt (DPI)Atomic instructions used for many purposesbuffering, within interrupt handlers, and for parameter passing.asynchronous and
18 Different classes of memory Volatile RAM and Nonvolatile ROM are two distinct groups of memoryRAM : Random-access memoryROM: Read-only memoryToday, the borderline between two groups are no longer clear. (EEPROM and flash)Address Bus(A0-An)Programmed during the manufacturing process or at application factory.EEPROM and Flash are in-system programmable.Interface lines of a generic memory component.Generic memory2 𝑚+1 × 𝑛+1BitsData Bus(D0-Dn)ReadChip Select(Write)
19 Writable ROM: EEPROM and flash Common featuresCan be rewritten in a similar way as RAM, but much slower, (up to 100 times slower than read)Wears, typically be rewritten for up to 1,000,000 timesCommon practices in RTSEEPROM can be written sparsely, normally used as a non-volatile program and parameter storage.Flash can only be erased in large blocks, used for storing both application programs and large data records.Use flash as low-cost mass memory, and load application programs from flash to RAM for execution.Run programs from faster RAM instead of ROM.electrically erasable programmable ROMNonwritable mask-programmed ROM used as a low-cost memory with very large production volume
20 Static RAM(SRAM) and dynamic RAM (DRAM) Comparisons of SRAM and DRAMSRAM: more space intensive, more expensive, but faster to accessDRAM: compact, cheaper, but slower to access; need refreshing circuitry to avoid any loss of dataCommon practicesUse DRAM in need of a large memoryUse SRAM in case of no more than moderate memory need
21 Summary of memory types and usages Selection of the appropriate technology is a systems design issue.
22 Timing diagram of a memory-read bus cycle Memory AccessWhy is this important?Illustration of the clock synchronized memory transfer process between a device and the CPU. The symbolism “<>” shown in the data and address signals indicates that multiple lines are involved during this period in the transfer.Timing diagram of a memory-read bus cycle
23 How to determine bus cycle length Worst-case access times of memory and I/O portsLatencies of address decoding circuitry and possible buffers on the system busSync bus protocol: possible to add wait states to the default bus cycle, dynamically adapt it to different access timesAsync bus protocol: no wait states, data transfer based on handshaking type protocol (CPU, system bus, memory devices)Overall power consumptionGrow with increasing CPU clock rate
25 Hierarchical memory organization Primary and secondary memory storage forms a hierarchy involving access time, storage density, cost and other factors.The fastest possible memory is desired in real-time systems, but economics dictates that the fastest affordable technology is used as required.In order of fastest to slowest, memory should be assigned, considering cost as follows:internal CPU memoryregisterscachemain memorymemory on board external devices
26 Locality of ReferenceRefers to the relative “distance” in memory between consecutive code or data accesses.If data or code fetched tends to reside relatively close in memory, then the locality of reference is high.When programs execute instructions that are relatively widely scattered locality of reference is low,Well-written programs in procedural languages tend to execute sequentially within code modules and within the body of loops, and hence have a high locality of reference.Object-oriented code tends to execute in a much more non-linear fashion. But portions of such code can be linearized (e.g. array access).
27 CacheA small block of fast memory where frequently used instructions and data are kept. The cache is much smaller than the main memory.Usage:Upon memory access check the address tags to see if data is in the cache.If present, retrieve data from cache,If data or instruction is not already in the cache, cache contents are written back and new block read from main memory to cache.The needed information is then delivered from cache to CPU and the address tags adjusted.
28 Cache Performance benefits are a function of cache hit radio. Since if needed data or instructions are not found in the cache, then the cache contents need to be written back (if any were altered) and overwritten by a memory block containing the needed information.Overhead can become significant when the hit ratio is low.Therefore a low hit ratio can degrade performance.If the locality of reference is low, a low number of cache hits would be expected, degrading performance.Using a cache is also non-deterministic – it is impossible to know a priori what the cache contents and hence the overall access time will be.
29 Wait StatesWhen a microprocessor must interface with a slower peripheral or memory device, a wait state may be needed to be added to the bus cycles.Wait states extends the microprocessor read or write cycle by a certain number of processor clock cycles to allow the device or memory to “catch up.”For example, EEPROM, RAM, and ROM may have different memory access times. Since RAM memory is typically faster than ROM, wait states would need to be inserted when accessing RAM.Wait states degrade overall systems performance, but preserve determinism.
31 Pipelining is a form of speculative execution Pipelining imparts an implicit execution parallelism in the different stages of processing an instruction.increase the instruction throughputWith pipelining, more instructions can be processed in different phases simultaneously,Suppose 4-stage pipelinefetch – get the instruction from memorydecode – determine what the instruction isexecute – perform the instruction decodedstore – store the results to memoryimproving processor performance.
32 Pipelining Sequential execution of 4-stages of 3 instructions (12 clock cycles)3 instructions finishedin 6 clock cyclesSequential instruction execution versus pipelined instruction execution.Nine complete instruction can be completed in the pipelined approach in the same time it takes to complete three instructions in the sequential (scalar) approach.
33 Pros of pipeline Under ideal conditions Instruction phases are all of equal lengthEvery instruction needs the same amount of timeContinuously full pipelineIn general, the best possible instruction completion time of an N-stage pipeline is 1/N times of the completion time of the non-pipelined case.Utilize ALU and CPU resources more effectively
34 Cons of pipelining Requires buffer registers between stages Additional delay compared with non-pipelineDegrade performance in certain situationsFor branch instructions in the pipeline, the prefetched instructions further in the pipeline may be no longer valid and must be flushed.External interrupts (unpredictable situations)Data dependencies between consecutive instructions
35 SuperpipelinesAchieve superpipelined architectures by decomposing the instruction cycle further.6-stage pipelines: fetch, two decodes(indirect addressing modes), execute, write-back, commit.In practice, more than10 stages in CPUs with GHz-level ratesConsDegrade by cache misses and pipeline flushing/refill (locality of instruction reference violates)Extensive pipeline is a source of significant non-determinism in RTS.use redundant hardware to replicate one or more stages in the pipeline.
36 ASICs (Applications Specific Integrated Circuit ) A special purpose IC designed for one application only, In essence, they are systems-on-chip includinga microprocessor, memory, I/O devices and other specialized circuitry.ASICs are used in many embedded applicationsImage processing, avionics systems, medical systems.Real-time design issues are the same for them as they are for most other systems.
37 PAL(Programmable logic array) / PLA (Programmable array logic) One-time programmable logic devices for special purpose functionality in embedded systems.PAL is a programmable AND array followed by a fixed number input OR element. Each OR element has a certain number of dedicated product terms.PLA is same as PAL, but the AND array is followed by a programmable width OR array.ComparisonsPLA is much more flexible and yields more efficient logic, but is more expensive.PAL is faster (uses fewer fuses) and is less expensive.Allow the product terms to be shared between macrocells, increasing device density.
38 FPGAs (Field programmable gate array) FPGA allows construction of a system-on-a-chip with an integrated processor, memory, and I/O.Differs from the ASIC in that it is reprogrammable, even while embedded in the system.A reconfigurable architecture allows for the programmed interconnection and functionality of a conventional processor.Move algorithms and functionality from residing in the software side into the hardware side.Widely used in embedded, mission-critical systems where fault-tolerance and adaptive functionality is essential.
39 Multi-core processors I & DCachesI & DCachesI & DCachesI & DCachesInternal cache busSystem busCommon I/O CacheQuad-core processor architecture with individual on-chip caches and a common on-chip cache
40 Pros and cons Parallel processing True task concurrency for multitasking real-time applicationsRequire a complete collection software tools for support the parallel development process.Learn to design algorithms for parallelism; otherwise, the potential of multi-core arch remains largely unused.Load balancing between cores is hard and needs expertise and right tools for performance analysis
41 Nondeterministic instruction processing in multi-core architecture. Timing consuming to port existing single CPU software efficiently to multi-core environment.Reduce the interests of companies to switch to multi-core in matured real-time applications.Nondeterministic instruction processing in multi-core architecture.Fast and punctual inter-core communication is a key issue when developing high-performance system.Communication channel is a well-known bottleneckA theoretical foundation for estimating speedup when number of parallel cores increase in Chapter 7The limit of parallelism in terms of speed up appears to be a software property, not a hardware on.