5 parts of computer system- (ALU + register, Control Unit, Memory System, Input Device, Output Device) connected by common bus Data path- register file- storage locations in CPU used to hold data/address, ALU- gets instructions/data/ from registers/memory Control path- CU- control unit, contains hardware instruction logic, decodes & manages execution of instruction in ALU Memory architecture- Von Neuman- organize programs & data into single memory, programs/data share same memory space Harvard architecture- separate memories for program and data 2 types of memory devices- RAM (random access memory) & ROM (read only memory) RAM- volatile- data lost when power removed, ROM- non-volatile, data remains even after power removed Memory Map- shows how memory addresses in memory space are used/not used Common bus contains address bus, data bus, control bus Software for embedded system is in ROM Assembler- program that translates an assembly program to an executable file. Absolute assembler- all machine codes of the programs generated by the assembler are located absolutely at the specified memory locations. Directive “ORG” used to provide address info. Advantage- simple, disadvantages- all source code must be in program, project cannot easily be split into smaller elements. Relocatable assembler- produces “object-file” which binary codes for the operations (opcode). Program can be split into multiple parts Linker- takes object files, links them together, & resolves all addresses or operands. Compiler- translates high level language programs to assembly or object file. Structured Program Design- 1) Design, 2) Coding, 3) Module, 4) System, 5) Documentation, 3 basic elements in structured programming- sequence, decision, repetition 4 fields of assembler source code- label, operation, operands, comments Label- string of alphanumeric characters A-Z, a-z, 0-9, _, . & started with alphabetical character Operation- 3 types of operations 1) Mnemonics- instructions for target ex. Ldaa, bra, lds, ldd, jsr, dbne, jmp 2) Pseudo instruction (i.e. Macros) set of instructions for the target machine 3) Directives- instructions for assembler Ex. ORG sets memory location for next instruction in an absolute assembler (Pseudo operations) EQU equates symbol (label) to a value DC.B/DC.W allocate memory locations Define Constant. Byte All mnenomics, macros, and some directives (DB DS) will allocate memory for machine code. Operand Field- can be symbol, constant, or expression Symbol- 8-bit/16-bit integer value Constant- can be in hexadecimal, decimal, octal, binary, ASCII Expression- assembler evaluates expression to produce a value for operand Ex. ONE: EQU 1 TWO: EQU 2 ADD: DC.B ONE + TWO Macro- set of assembly instructions 3 stages 1) Macro definition 2) Macro invocation 3) Macro expansion Ex. Ldaa #-90 DIV4 becomes ldaa #-90 asra asra Conditional Code Register: Ex. 01101101 + 10010101 = 100000010 (+109) + (-107) = +2. H = 1, N = 0, Z = 0, V = 0, C = 1; H = half carry (if carry after C3 = 1, H = 1), N = 1 if negative number, 0 if positive, Z = 1 if number = 0, otherwise 0, V = overflow = C7 XOR C8 (1 XOR 1 = 0), C = last carry bit (C8). Two’s Complement- 10010101 = -01101011 (starting from the right, skip 0s until you hit a 1, keep that 1, then toggle everything after)