Computer Organization Basics PDF
Document Details
Uploaded by Deleted User
Tags
Related
Summary
This document provides an overview of computer organization basics, including different programming languages, such as high-level and low-level languages. It details the concept of compilers, their major phases, and discusses the importance of programming languages in controlling computer behavior.
Full Transcript
IT2104 Computer Organization Basics High-Level Languages – These are programmin...
IT2104 Computer Organization Basics High-Level Languages – These are programming languages that enable Languages and Compilers program development through user-friendly programming context, which A computer programming language expresses a set of detailed instructions are generally independent of the computer's hardware architecture. High- or standard form of commands, containing unique keywords and syntax, which level language has a higher level of abstraction from the computer's native are compiled to perform a specific task by the central processing unit (CPU) of language semantics, and focuses on the programming logic rather than a computer. Numerous programming languages have been developed, but the underlying hardware components. The style and context of languages each language has its specific purpose (JavaTpoint, n.d.). Programs and under this category are easier to understand and implement. Thus, they applications are created through computer programming languages to control are considered as close-to-human language. However, every single the behavior and output of a computing machine that uses different algorithms. program written in a high-level language must still be interpreted into a machine language before being executed by the computer (Techopedia, Computer programming languages can be classified based on the level of n.d.). Example: Java, Python, PHP, and Ruby 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 A compiler is a computer software that translates (compiles) source codes distinctive features relative to data storage and operations. On the contrary, written in high-level language into a set of low-level language instructions that high-level languages provide notations that can be easily written and read by can be understood by a computer's CPU. The formal output of the compilation programmers (Hammendinger, 2021). process is called object code or object module. The term compiler was coined Low-Level Languages – These are programming languages that deal by Grace Hopper, an American computer scientist who designed one of the with a computer's hardware components and constraints, and work to first compilers in the early 1950s (Encyclopedia Britannica, 2021). manage a computer's operational semantics. Low-level language is also referred to as the computer's native language. Hence, it is usually Major phases in a compiler (Chakraborty. 2021): represented in the form of zeros and ones. This category of computer Scanning – The scanner reads the characters in the source code, from programming language provides very little to no abstraction at all. Their left to right, and groups it to have a collective meaning. primary function is to operate and manage the computing hardware and Lexical Analysis – The compiler converts the groups of characters into components. Thus, programs and applications written in low-level series of characters known as tokens. Tokens are characterized by regular language are directly executable on the computing hardware without any expressions which can be recognized and understood by a lexical interpretation or translation (Techopedia, n.d.). analyzer. The lexical analyzer uses a symbol table to store the words in o Assembly language – It is a low-level language that uses short the source code that corresponds to the generated tokens. human-readable instructions, also known as mnemonic codes, which Syntactic Analysis – The compiler checks the proper arrangement of the allow programmers to introduce names for block of memory that hold tokens as per their usage in the corresponding source code grammar. data. Assembly language is designed to be easily translated into Syntax pertains to the correct order of a set of tokens, or sometimes machine language. However, it still requires detailed knowledge of the referred to as keywords, that leads to the desired results. The process of internal computer architecture, and does not provide more syntax analysis is also known as parsing, which generates a parse tree. sophisticated means of organizing complex information Semantic Analysis – This phase involves several intermediate (Hammendinger, 2021). Example: mov, add, jmp, and clr processes. In general, this examines whether the constructed parse tree o Machine language – It is a low-level language composed of a set of complies with the rules of the language. The meaning of the structured executable instructions that are in binary formal, also known as tokens are then interpreted by the interpreter and analyzer component to numeric code. Machine language is also referred to as machine code. finally generate an intermediate code, known as the object code. Machine language is difficult to read and write, since it does not exhibit the conventional mathematical notation or human language. Example: 101100111110 01 Handout 1 *Property of STI [email protected] Page 1 of 4 IT2104 Assembler and Object Code Executable Code Assembler It is the output file, or program, of a linker that indicates tasks according to It is a program that translates assembly language into machine codes that the encoded instructions the central processing unit (CPU) can directly can be executed by the computer (Stallings, 2019). execute (Stallings, 2019). Moreover, the code generated by a source code This bridges the symbolically coded instructions written in assembly language processor such as an assembler or a compiler can also be language and the computer processor, including memory and other considered as an executable code. computational components, by assembling and converting assembly Note that machine language files can directly be executable as a runnable codes into object codes that are composed of zeros and ones. program, or may require linking with other object codes such as libraries It generally allows software and application developers to access, operate, to produce a complete executable program. and manage a computer's hardware architecture and components. Assemblers are classified based on the number of times it takes to read Loader and Translator the source code before translating. There are single-pass and multi-pass Loader assemblers, and there are some high-end assemblers that provide A loader is a major part of an operating system that is responsible for enhanced functionality by enabling the use of control statements, data loading executable files, including libraries, into the memory and executes abstraction services, and support for object-oriented programming them. It calculates the size of the program and creates memory space for structures (Techopedia, n.d.). it. It initializes various registers to initiate execution (Tutorialspoint, n.d.). The loading process for small programs is almost instantaneous, but for Object Code large and complex applications with multiple and/or large libraries, such It is the machine language representation of a programming source code as games and Computer-Aided Design (CAD), the loading process takes wherein it encompasses a sequence of statements in binary form that are a considerable amount of time (Techopedia, n.d.). generated after compiling a particular source program. It is the output file or program of a compiler or an assembler which can Translator then be transformed to another executable form by a linker (Stallings, It is the general term for a programming language processor that converts 2019). a computer program from one (1) language to another. It takes a program Object codes are stored in object files. This includes instructions to be written in source code and converts it into machine code (Teach Computer executed by the computer. Note that object files may require intermediate Science, n.d.). processing by the operating system (OS) before the hardware executes There are three (3) types of translator: the compiler, interpreter, and the instructions. Some examples of object files are common object file assembler. Table 1 shows the summary of comparison among the three format (COFF) and an executable file with a.exe file extension. (3) translators. Linker and Executable Code Compiler Interpreter Assembler Linker Translates high-level Translates high-level Translates assembly It is a utility program that combines one (1) or more object files from language to low-level language to low-level language to machine separately compiled programs into a single file containing loadable or language language language It completes the It completes the It completes the executable codes (Stallings, 2019). translation of the whole translation of the translation in two (2) The major tasks of a linker are to search and locate reference modules or program at a time program line by line passes routines in a program, and to determine the memory location where the Reports the errors Reports the errors Reports the errors during codes will be loaded. detected after the detected while doing the the assembly conversion conversion 01 Handout 1 *Property of STI [email protected] Page 2 of 4 IT2104 The execution process is The execution process is The execution process is Process data: The execution of an instruction may require some fast slow efficient arithmetic or logical operation on data. Translated programs are Translated programs are Translated programs are Write data: The result of an execution may require writing data to memory machine independent machine independent machine dependent or an I/O module. Utilized by C, C++, Utilized by PHP, Python, Utilized by assembly COBOL, and Pascal Ruby, and Perl language Table 1. Summary of comparison of the different types of translator. 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 execute millions of calculations. Every operation performed on a computing device, such as opening an application or duplicating a file, the processor interprets program instructions (Techopedia, n.d.). 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, Figure 1. A simplified internal structure of a processor. including the operation of the arithmetic logic unit. The control unit of a Source: Computer Organization and Architecture: Designing for Performance 11th edition, 2019 p. 656 modern processor is a synchronous sequential digital circuit. Arithmetic Logic Unit (ALU) – This is a combinational circuit that Figure 1 shows the major components of a processor and specifies the data executes the actual computations and bit manipulation operations in a transfer and logic control paths. The component labeled as Internal CPU bus processor under the direction of the control unit. ALU requires input data is needed to transfer data between various registers and the ALU. In addition, values, called the operands, and a specific code indicating the operation the figure contains some basic elements in an ALU. to be performed. Number Systems Review Register Set – This is a temporary internal storage that serves as source and destination locations for instruction operations. Registers provide the A bit is the smallest unit of information in a digital computer. It represents fastest data access in a processor, but are limited to a very small number a discrete data element containing the value zero (0) or one (1). Bits are of locations. Note that the width of a register in bits is generally the same marked individually within a binary number, with bit zero as the rightmost as the processor word size. and least significant bit (LSB). A byte is composed of eight bits placed together to form a single value. It Operations that are performed by a processor (Stallings, 2019): is the smallest unit of information that can be read from or write to a Fetch instruction: The processor reads the instruction from memory, computer memory by most modern processors. The following illustration which can be a register, cache, or the main memory. contains an example of a bit and a byte. 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. 01 Handout 1 *Property of STI [email protected] Page 3 of 4 IT2104 In a positional number system, the ultimate numeric value is determined binary values in programming is less common, and the hexadecimal by the position the number holds, and not by the number itself. The number system is favored due to its compactness. placement of digits works through the use of a base number with a series Binary complements are utilized by digital computers for the logical of exponents applied to the base. Note that the decimal number system manipulations and to simplify the addition and subtraction operation. There has a base of 10; the binary number system has a base of 2; and the are two (2) types of complements which are the following (Reddy, 2019): hexadecimal number system has a base of 16 (Coughlan, n.d.). o 1's complement – The only process involved in this operation is the The binary number system, also known as the base-2 number system, inversion of the given binary number. This operation is seldomly used is a system that represents counting numbers by using the numerals 0 and for representing signed (positive or negative) binary numbers since, 1. Any number of bits, n, can take on 2n values. Thus, 1byte, which 010 has two representations in 1's complement which are: contains 8bits, can take on 28 or 256 different combinational values (Ledin, -010 that is represented with 1s (e.g., 111112 in a 5-bit register); 2020). As an example, the binary 100112 below is equivalent to 1910 as a and decimal number. +010 that is represented with 0s (e.g., 000002 in a 5-bit register). Example: The 1's complement of 1001 0011 is 0110 1100. o 2's complement – The processes involved in this operation are the inversion of the given binary number and the addition of 1 to the LSB. This operation is highly utilized in representing signed (positive or negative) binary numbers. The most significant bit (MSB) of a 2's complement data value is the sign bit which can either be: 0 that represents a positive value (+); and 1 that represents a negative value (–). Note that in 2's complement, 010 has only one (1) representation that The hexadecimal number system, also known as the base-16 number is always considered positive (e.g., 000002 in a 5-bit register) system, encompasses binary numbers that are separated into groups of 4bits. Since there are 4bits in a hexadecimal group, the possible numbers References: Britannica, T. Editors of Encyclopedia. (2021, May 4). Compiler. Retrieved on June 30, 2021 from Encyclopedia Britannica. of binary combinations that a group can take on is 24 or 16. The first 10 of https://www.britannica.com/technology/compiler these 16 numbers are assigned to the digits 0 to 9, while the last six (6) Chakraborty, K. (2021, February 22). Compiler. Retrieved on July 6, 2021 from https://www.techopedia.com/definition/3912/compiler Coughlan, D. (n.d.). Positional number systems. Retrieved on July 12, 2021 from numbers are assigned to the letters A to F (Ledin, 2020). As an example, https://courses.lumenlearning.com/collegesuccess2x48x115/chapter/positional-number-systems/ Encyclopedia.com. (n.d.). Binary number system. Retrieved on July 12, 2021 from https://www.encyclopedia.com/computing/news-wires- the hexadecimal number 2B9F16 below is equivalent to 1116710 in decimal white-papers-and-books/binary-number-system number. Encyclopedia.com. (n.d.). Hexadecimal notation. Retrieved on July 12, 2021 from https://www.encyclopedia.com/computing/dictionaries- thesauruses-pictures-and-press-releases/hexadecimal-notation Hemmendinger, D. (2021, January 29). Computer programming language. Retrieved on June 30, 2021 from Encyclopedia Britannica: https://www.britannica.com/technology/computer-programming-language JavaTpoint. (n.d.). What is a programming language?. Retrieved on June 30, 2021 from https://www.javatpoint.com/classification-of- programming-languages Ledin, J. (2020). Modern computer architecture and organization. Packt Publishing Reddy, A. ( 2019, February 21). 1's complement vs 2's complement. Retrieved on July 13, 2021 from https://www.tutorialspoint.com/1-s- complement-vs-2-s-complement Stallings, W. (2019). Computer organization and architecture: Designing for performance (11th ed.). Pearson Education, Inc. Teach Computer Science. (n.d.). Translators. Retrieved on July 8, 2021 from https://teachcomputerscience.com/translators/ Techopedia. (n.d.). Assembler. Retrieved on July 6, 2021 from https://www.techopedia.com/definition/3971/assembler Techopedia. (n.d.). High-level language (HLL). Retrieved on June 30, 2021 from https://www.techopedia.com/definition/3925/high-level- language-hll As an additional example, the binary 111010102 can be represented more Techopedia. (n.d.). Low-level language. Retrieved on June 30, 2021 form https://www.techopedia.com/definition/3933/low-level-language Techopedia. (n.d.). Processor. Retrieved on July 9, 2021 from https://www.techopedia.com/definition/28254/processor compactly by breaking it into two 4-bit groups (1110 and 1010) and write Tutorialspoint. (n.d.). Compiler design – overview. Retrieved on July 7, 2021 from them as the hexadecimal digits EA16. This only proves that the use of https://www.tutorialspoint.com/compiler_design/compiler_design_overview.htm 01 Handout 1 *Property of STI [email protected] Page 4 of 4