A Hierarchy of Languages Application Programs High-Level Languages Machine independent Machine specific Assembly Language Machine Language Hardware Computer Organization and Architecture High-Level Language Low-Level Language Dr.Tarek Abdul Hameed 4 Assembly and Machine Language ?Used to wire and interconnect the various components 23 Computer Organization and Architecture Dr.Tarek Abdul Hameed Fetch - Execute Cycle Infinite Cycle implemented in Hardware Instruction Fetch Instruction Decode Execute Memory Access Writeback Result Computer Organization and Architecture Fetch instruction Compute address of next instruction Generate control signals for instruction Read operands from registers Compute result value Read or write memory (load/store) Writeback result in a register Dr.Tarek Abdul Hameed 24 Microprocessors Building Blocks Computer Organization and Architecture Dr.Tarek Abdul Hameed 25 Microprocessor Memory Bus RAM I/O Data Cache Control Unit Bus Interface Unit System Bus Instruction Decoder Instruction Cache Computer Organization and Architecture Arithmetic & Logic Unit Registers Floating Point Unit Registers 26 Dr.Tarek Abdul Hameed Bus Interface Unit ?Computer Organization and Architecture Dr.Tarek Abdul Hameed 8 Translating Languages Program (C Language): swap(int v[], int k) { int temp; temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; } Compiler MIPS Assembly Language: sll $2,$5, 2 add $2,$4,$2 lw $15,0($2) lw $16,4($2) sw $16,0($2) sw $15,4($2) jr $31 Computer Organization and Architecture A statement in a high-level language is translated typically into several machine-level instructions MIPS Machine Language: Assembler 00051080 00821020 8C620000 8CF20004 ACF20000 AC620004 03E00008 9 Dr.Tarek Abdul Hameed Advantages of High-Level Languages ?Also known as the "Integer Unit" ? It performs whole-number math calculations (subtract, multiply, divide, etc) comparisons (is greater than, is smaller than, etc.) and logical operations (NOT, OR, AND, etc) ? The new breed of popular microprocessors have not one but two almost identical ALU's that can do calculations simultaneously, doubling the capability Computer Organization and Architecture Dr.Tarek Abdul Hameed 29 Floating-Point Unit (FPU) ? Also known as the "Numeric Unit" ?Sparc, Ultra Sparc 1985 0n ?Allows you to view machine instructions, memory, and registers Computer Organization and Architecture Dr.Tarek Abdul Hameed 12 Assemble and Link Process Source File Source File Assembler Assembler Source File Assembler Object File Object File Object File Linker Link Libraries Executable File A project may consist of multiple source files Assembler translates each source file separately into an object file Linker links all object files together with link libraries Computer Organization and Architecture Dr.Tarek Abdul Hameed 13 Components of a Computer System Computer ?Network: newly added component for communication Memory Control Processor Datapath I/O Devices Input B U S Network Computer Organization and Architecture Output Disk Dr.Tarek Abdul Hameed 14 Memory ?Tasks include fetching instructions & data, storing data, managing input/output devices Computer Organization and Architecture Dr.Tarek Abdul Hameed 32 That was the structure, now let's talk about the language of a microprocessor Computer Organization and Architecture 33 Dr.Tarek Abdul Hameed Instruction Set ?Most new PC's are equipped with this RAM which is able to synchronize itself with the processor, enabling data transfer at more than twice the speed of previous RAM technologies) 18 Computer Organization and Architecture Dr.Tarek Abdul Hameed Main (Internal) Memory ?Control: generates control signals for each instruction Next Program Counter Program Counter Instruction Cache Instruction Registers A L U Data Cache Control Computer Organization and Architecture Dr.Tarek Abdul Hameed 22 Datapath Components ?Then, it passes on the decoded instruction to the ALU or FPU Computer Organization and Architecture Dr.Tarek Abdul Hameed 28 Arithmetic & Logic Unit (ALU) ?Bigger instruction-sets mean more complex chips (higher costs, reduced efficiency), but shorter programs Computer Organization and Architecture Dr.Tarek Abdul Hameed 34 Instruction Set Architecture (ISA) ?DRAM is called Dynamic RAM because the memory content needs to be refreshed periodically (every few milliseconds) due to leakage of electrical charge.Indirectly via an assembler Computer Organization and Architecture Dr.Tarek Abdul Hameed 5 Compiler and Assembler Computer Organization and Architecture Dr.Tarek Abdul Hameed 6 Instructions and Machine Language ?SRAMis called static because the memory retains its contents as long as power is supplied-It does not have to be periodically refreshed as in DRAM. It is used to store BIOS (Basic Input/Output System-helps to load and locate an operating system), external to microprocessor, and computer instruction sets, internal to microprocessor ?Writing to a PROM destroys the internal links, so a basic PROM can only be programmed once 19 Dr.Tarek Abdul Hameed Computer Organization and Architecture The Need for a Memory Hierarchy ?Access time: milliseconds Faster Memory Bus Memory I/O Bus Bigger Disk, Tape, etc Computer Organization and Architecture Dr.Tarek Abdul Hameed 21 Processor ?Also receives the processed data and sends it to the main memory Computer Organization and Architecture Dr.Tarek Abdul Hameed 27 Instruction Decoder ?However, Assembly language programs are not portable Computer Organization and Architecture Dr.Tarek Abdul Hameed 10 Why Learn Assembly Language?Writing compact code Computer Organization and Architecture Dr.Tarek Abdul Hameed 11 Assembly Language Programming Tools ?Up to 264 bytes of physical address space 15 Computer Organization and Architecture Dr.Tarek Abdul Hameed Address Space Computer Organization and Architecture Address Space is the set of memory locations (bytes) that can be addressed 16 Dr.Tarek Abdul Hameed Address, Data, and Control Bus ?When you turn the computer on, ROM automatically prepares the computer system and loads the initial display screen prompt ?This unit receives the programming instructions and decodes them into a form that is understandable by the processing units, i.e. the ALU or FPU ?TheALUcandothese calculations as well, but will do them very slowly Computer Organization and Architecture Dr.Tarek Abdul Hameed 30 Registers ?Processed data goes back to the data cache and then to main memory from these registers Computer Organization and Architecture Dr.Tarek Abdul Hameed 31 Control Unit ?Alpha (now Compaq, now HP) in 1990's Computer Organization and Architecture 36 Dr.Tarek Abdul Hameed More computer families ?Computer Organization and Architecture Dr.Tarek Abdul Hameed 7 Instruction Fields ?Operands fields which specify where to get the source and destination operands for the operation specified by the opcode.Cache memory is small in size but fast Computer Organization and Architecture Dr.Tarek Abdul Hameed 20 Typical Memory Hierarchy ?input-output control Computer Organization and Architecture Dr.Tarek Abdul Hameed 35 Some Computer families ?Avariation of ROM is PROM (Programmable Read Only Memory), in which the user can load programs and data that are read only.It performs calculations that involve numbers represented in the scientific notation (also known as floating-point numbers).Compatibility of software between various implementations ?RAM-RandomAccessMemory.??????..??????????