1Computer-Organization.pptx
Document Details
Uploaded by GroundbreakingDoppelganger
STI College
Tags
Full Transcript
Computer Organization Basics Languages and Compilers Processor Structure Number System Review *Property of STI IT1710 Retrieved from: https://www.keepcalm-o-mati...
Computer Organization Basics Languages and Compilers Processor Structure Number System Review *Property of STI IT1710 Retrieved from: https://www.keepcalm-o-matic.co.uk/p/keep-calm-and-study-computer-engineering-10/ *Property of STI IT1710 Computer Organization Basics Languages and Compilers A computer programming language expresses a set of detailed instructions or standard form of commands, containing unique keywords and syntax, which are compiled to perform a specific task by the central processing unit (CPU) of a computer. Numerous programming languages have been developed, but each language has its *Property of STI IT1710 Computer Organization Basics Computer programming languages can be classified based on the level of abstraction. It can either be a low-level or high-level language. Low-level languages require programmers to manage in detail all the computer's distinctive features relative to data storage and operations. High-level languages provide notations that can be easily written and read by programmers (Hammendinger, 2021). *Property of STI IT1710 Computer Organization Basics 1. Low-Level Languages – These are programming languages that deal with a computer's hardware components and constraints, and work to manage a computer's operational semantics. Low-level language is also referred to as the computer's native language. *Property of STI IT1710 Computer Organization Basics 1. Low-Level Languages a.Assembly language – It is a low- level language that uses short human-readable instructions, also known as mnemonic codes, which allow programmers to introduce names for block of memory that hold data. Assembly language is designed to be easily translated into machine language. *Property of STI IT1710 Example: mov, add, jmp, and clr Computer Organization Basics 1. Low-Level Languages b. Machine language – It is a low- level language composed of a set of executable instructions that are in binary formal, also known as numeric code. Machine language is also referred to as machine code. Machine language is difficult to read and write, since it does not exhibit the *Property of STI conventional IT1710 mathematical notation or human language. Computer Organization Basics 2. High-Level Languages These are programming languages that enable program development through user- friendly programming context, which are generally independent of the computer's hardware architecture. The style and context of languages under this category are easier to understand and implement. Thus, they are considered as close-to-human language. *Property of STI IT1710 Computer Organization Basics Compiler is a computer software that translates (compiles) source codes written in high-level language into a set of low-level language instructions that can be understood by a computer's CPU. *object code or object module – refers to the formal output of the compilation process. *Property of STI IT1710 Computer Organization Basics Major phases in a compiler (Chakraborty. 2021): 1. Scanning – The scanner reads the characters in the source code, from left to right, and groups it to have a collective meaning. *Property of STI IT1710 Computer Organization Basics 2. Lexical Analysis – The compiler converts the groups of characters into series of characters known as tokens. Tokens are characterized by regular expressions which can be recognized and understood by a lexical analyzer. The lexical analyzer uses a symbol table to store the words in the source code that corresponds to the generated tokens. *Property of STI IT1710 Computer Organization Basics *Property of STI IT1710 Computer Organization Basics Lexical Analyzer Implementation - Reads the text character by character - In place of every lexeme, we are going to see a token - Eliminates comments - Eliminates white spaces - Converts lexemes into tokens - Remove and display errors *Property of STI IT1710 Computer Organization Basics Major phases in a compiler (Chakraborty. 2021): Lexical Analyzer Implementation Example: index = 2 * count + 17; *Property of STI IT1710 Computer Organization Basics Major phases in a compiler (Chakraborty. 2021): 3. Syntactic Analysis – The compiler checks the proper arrangement of the tokens as per their usage in the corresponding source code grammar. Syntax pertains to the correct order of a set of tokens, or sometimes referred to as keywords, that leads to the desired results. The process of syntax *Property of STI IT1710 Computer Organization Basics Major phases in a compiler (Chakraborty. 2021): 4. Semantic Analysis – This phase involves several intermediate processes. In general, this examines whether the constructed parse tree complies with the rules of the language. The meaning of the structured tokens are then interpreted by the interpreter and analyzer IT1710 component to finally generate an *Property of STI Computer Organization Basics Assembler and Object Codes Assembler It is a program that translates assembly language into machine codes that can be executed by the computer (Stallings, 2019). *Property of STI IT1710 Computer Organization Basics Assembler and Object Codes Assemblers are classified based on the number of times it takes to read the source code before translating. There are single-pass and multi-pass assemblers, and there are some high-end assemblers that provide enhanced functionality by enabling the use of control statements, data abstraction services, and support for *Property of STI IT1710 object-oriented programming Computer Organization Basics Assembler and Object Codes Object Code It is the machine language representation of a programming source code wherein it encompasses a sequence of statements in binary form that are generated after compiling a particular source program. It is the output file or program of a compiler or an IT1710 assembler which can then be *Property of STI Computer Organization Basics Assembler and Object Codes Object Code Object codes are stored in object files. This includes instructions to be executed by the computer. Note that object files may require intermediate processing by the operating system (OS) before the hardware executes the instructions. *Property of STI IT1710 Computer Organization Basics Linker and Executable Codes Linker It is a utility program that combines one (1) or more object files from separately compiled programs into a single file containing loadable or executable codes (Stallings, 2019). *Property of STI IT1710 Computer Organization Basics Linker and Executable Codes Executable Code It is the output file, or program, of a linker that indicates tasks according to the encoded instructions the central processing unit (CPU) can directly execute (Stallings, 2019). Moreover, the code generated by a source code language processor such as an assembler or a compiler can *Property of STI IT1710 also be considered as an executable Computer Organization Basics Loader and Translator Loader A loader is a major part of an operating system that is responsible for loading executable files, including libraries, into the memory and executes them. It calculates the size of the program and creates memory space for it. It initializes various registers *Property of STI to initiate IT1710 execution Computer Organization Basics Loader and Translator Translator It is the general term for a programming language processor that converts a computer program from one (1) language to another. It takes a program written in source code and converts it into machine code (Teach Computer Science, n.d.). *Property of STI IT1710 Computer Organization Basics Loader and Translator Translator There are three (3) types of translator: the compiler, interpreter, and assembler. *Property of STI IT1710 Computer Organization Basics Loader and Translator Translator There are three (3) types of translator: the compiler, interpreter, andThe executi assembler. on process is The execution process is The execution process is fast slow efficient Translated programs are Translated programs are Translated programs are machine independent machine independent machine dependent Utilized by C, C++, Utilized by PHP, Python, Utilized by assembly COBOL, and Pascal Ruby, and Perl language *Property of STI IT1710 Computer Organization Basics Processor Structure A processor is an integrated electronic circuit that performs the calculations that runs a computer. Processors can be found in different electronic devices, such as smartphones, personal computers, printers, and even routers. The purpose of a processor is to receive input as program instructions and *Property of STI IT1710 execute millions of calculations. Computer Organization Basics Processor Structure Logically distinct functional components of a processor (Ledin, 2020): Control Unit (CU) – This manages the overall operation of the processor. It controls the movement of data and instructions in and out of the device, including the operation of the arithmetic logic unit. The control *Property of STI IT1710 unit of a modern processor is a Computer Organization Basics Processor Structure Logically distinct functional components of a processor (Ledin, 2020): Arithmetic Logic Unit (ALU) – This is a combinational circuit that executes the actual computations and bit manipulation operations in a processor under the direction of the control unit. ALU requires input data IT1710 values, called the operands, and a *Property of STI Computer Organization Basics Processor Structure Register Set – This is a temporary internal storage that serves as source and destination locations for instruction operations. Registers provide the fastest data access in a processor but are limited to a very small number of locations. Note that the width of a register in bits is generally the same as the processor word size. *Property of STI IT1710 Computer Organization Basics Processor Structure Operations that are performed by a processor (Stallings, 2019): Fetch instruction: The processor reads the instruction from memory, which can be a register, cache, or the main memory. Interpret instruction: The instruction is decoded to determine required actions. Fetch data: The execution of an instruction may require reading data from memory or an input/output (I/O) module. *Property of STI IT1710 Computer Organization Basics Processor Structure Operations that are performed by a processor (Stallings, 2019): Process data: The execution of an instruction may require some arithmetic or logical operation on data. Write data: The result of an execution may require writing data to memory or an I/O module *Property of STI IT1710 Computer Organization Basics Processor Structure *Property of STI IT1710 Computer Organization Basics Processor Structure Figure 1 shows the major components of a processor and specifies the data transfer and logic control paths. The component labeled as Internal CPU bus is needed to transfer data between various registers and the ALU. In addition, the figure contains some basic elements in an ALU. *Property of STI IT1710 Computer Organization Basics Number System Review A bit is the smallest unit of information in a digital computer. It represents a discrete data element containing the value zero (0) or one (1). Bits are marked individually within a binary number, with bit zero as the rightmost and least significant bit (LSB). *Property of STI IT1710 Computer Organization Basics Number System Review A byte is composed of eight bits placed together to form a single value. It is the smallest unit of information that can be read from or write to a computer memory by most modern processors. The following illustration contains an example of a bit and a byte *Property of STI IT1710