PT_Midterm_Reviewer (1).pdf

Full Transcript

PT MIDTERM 頑 張 って ! —‘ u ’— Introduction Computer Central Memory M1 main disadvantage is the integrated circuits los...

PT MIDTERM 頑 張 って ! —‘ u ’— Introduction Computer Central Memory M1 main disadvantage is the integrated circuits lose the Organization/Architecture information they have stored when the electricity flow is interrupted The Basic System Components Architecture - basic operational design of a computer Input and Output Units (I/O) system it is necessary that the processor communicates with John Von Neumann - pioneer in computer design, the exterior through interfaces which allow the input credited for the architecture of most computers in use and output of information from the processor and today the memory ↳ it is possible to introduce information to be For example, the 80x86 family uses the Von Neumann processed and to later visualize the processed data architecture (VNA) A typical Von Neumann system has three major components: Auxiliary Memory Units 1 Central processing unit (or CPU) stored information on these magnetic media means 2 Memory receive the name of files 3 Input/output (or I/O) ↳ file is made of a variable number of registers, generally of a fixed size; the registers may contain The way a system designer combines these information or programs components impacts system performance: Generation of Computers First Generation in 1940’s were computers whose architecture was based on massive electronic valve (vacuum tube) e.g. electronically digital vacuum computers, universal vacuum computer UNVAC Computer System Features: complete configuration of a computer including the Use of vacuum tubes peripheral units and the system programming Big and clumsy ↳ which make it a useful and functional machine for a High electricity consumption determined task Programming in Mechanical Language Larger AC were needed Central Processor (CPU) Lot of electricity failure occurred also known as central processing unit or CPU ↳ made by the control unit, the arithmetic and logic Second Generation unit were more reliable and faster in performance (read and write operations) Functions: ↳ instead of valves simple transistors were used in reading and writing the contents of the memory design e.g. ATLAS computers cells to forward data between memory cells and special Features: registers Transistors were used decode and execute the instructions of program Core Memory was developed Faster than First Generation computers Central Memory First Operating System was developed group of cells, fabricated with semi-conductors Programming was in Machine Language & Assembly ↳ used for general processes, such as execution of Language programs and storage of information for the Magnetic tapes & discs were used operations Became smaller in size than the First Generation Random Access Memory (RAM) - generic name of these computers memories Computers consumed less heat & electricity Page 1 PT MIDTERM Third Generation OR gate more powerful, reliable and compatible ↳ simple integrated circuits were introduced ↳ emerged in early 1960s, and examples are IBM 360 Series. gives a high output (1) if one or more of its inputs Features: are high Integrated circuits developed a plus (+) is used to show the OR operation Power consumption was low SSI & MSI Technology was used NOT gate High level languages were used Fourth Generation produces an inverted version of the input at its uses sophisticated micro-electronic devices output Features: also known as an inverter; if the input variable is A, LSI & VLSI Technology used the inverted output is known as NOT A Development of Portable Computers this is shown as A', or A with a bar over the top, as RAID Technology of data storage shown at the outputs Used in virtual reality, multimedia, simulation Started in use for Data Communication Different types of memories with very high NAND gate accessing speed & storage capacity Fifth Generation Used in parallel processing which is equal to an AND gate followed by a NOT Used superconductors gate Used in speech recognition outputs of all NAND gates are high if any of the Used in intelligent robots inputs are low Used in artificial intelligence the symbol is an AND gate with a small circle on the output, small circle represents inversion Logic Gates hell naw skip skip digital systems are said to be constructed by using NOR gate logic gates ↳ these gates are the AND, OR, NOT, NAND, NOR, EXOR and EXNOR gates ↳ basic operations are described below with the aid of truth tables which is equal to an OR gate followed by a NOT gate outputs of all NOR gates are low if any of the inputs are high AND gate the symbol is an OR gate with a small circle on the output, small circle represents inversion EXOR gate gives a high output (1) only if all its inputs are high a dot (.) is used to show the AND operation i.e. A.B. give a high output if either, but not both, of its two inputs are high encircled plus sign ( ) is used to show the EOR operation Page 2 PT MIDTERM EXNOR gate Listing the files lists all files and directories in the current dir directory lists files and directories one page at a dir /p time does the opposite to the EOR gate; will give a low output if either, but not both, of its two inputs are Moving into a directory high changes the current directory symbol is an EXOR gate with a small circle on the cd Ex. cd desktop output, small circle represents inversion ↳ moves to the "desktop" directory NAND and NOR gates are called universal functions cd.. moves back one directory since with either one the AND and OR functions and NOT can be generated cd\ moves to the root directory (e.g., C:>) Note: Creating a directory function in sum of products form can be creates a new directory implemented using NAND gates by replacing all mkdir Ex. mkdir test AND and OR gates by NAND gates ↳ creates a directory named "test" function in product of sums form can be implemented using NOR gates by replacing all AND Removing a directory and OR gates by NOR gates to remove a directory rmdir Ex. rmdir hope ↳ remove the hope directory Dos Command and Introduction M2 to Assembly Language Manipulating a file (Manipulating Strings) moves a file from one location to another Ex. move example.bat dir2 DOS Commands move ↳ moves the file "example.bat" to the "dir2" directory Microsoft Disk Operating System (MS-DOS) renames a file non-graphical command line operating system created rename Ex. rename example.bat first.bat for IBM compatible computers ↳ renames "example.bat" to "first.bat" ↳ first introduced by Microsoft in August 1981 deletes a file ↳ was last updated in 1994 with MS-DOS 6.22 del Ex. del first.bat ↳ the command shell commonly known as the ↳ deletes the file "first.bat" windows command line is still widely used Switching drives How to use the Window command line (DOS) switch between different drives MS-DOS and the Windows command line are not : Ex. d: case sensitive ↳ switch to the drive D Files and directories shown in Windows are accessible in the command line Creating a new file Use quotes when working with file or directory opens a text editor for easy file creation names that contain spaces edit and editing Filenames can be up to 255 characters with a 3- Ex. edit filename.txt character file extension quick way to create a file by typing Deleted files or directories are not moved to the copy content directly in the command line Recycle Bin when deleted via the command line con Ex. copy con filename.txt Typing "/?" after a command displays help options opens external program like Notepad, for that command start allowing for more user-friendly editing While MS-DOS is obsolete, the Windows command Ex. start notepad filename.txt line is still widely used cls clears the screen in the command prompt Page 3 PT MIDTERM Understanding the files Registers In the command line, the same thing is accomplished are powerful yet volatile processor memory, and thus by the file extensions divided into different parts as shown in the table File extensions indicate the file type, such as.txt for below: text files,.mp3 for music files, and.exe for General executable files High Low Special Register A list of file extensions and help on file types can be (12 bits) (4bits) (16 bits) Name accessed Accumulator Accumulator Accumulator If you try to run an executable file not in the current - (AX) High (AH) Low (AL) directory, an error will occur unless the directory Base Base High Base Low path is set - (BX) (BH) (BL) Setting a path allows the command line to find Data Data High Data Low Dataset external commands (DX) (DH) (DL) (DS) In 64-bit versions of Windows, you can use the start command (e.g., start notepad hijackthis.log) to Notes: open file in Notepad Registers have total of 16 bits in terms of 1 Creating a new batch file memory capacity Batch File - file that ends with.bat AX basic commands such as printing and ↳ file that help automate frequently used commands 2 scanning a single character requires only 8 bits in the command line to execute, thus, AH register must be used To create a batch file named "example," type ASCII code - crucial part of assembly language; 1 3 all data feed within the registers is converted edit example.bat at the prompt Add the following commands to the file: into ASCII codes @echo off cls Parts of and Assembly Program 2 dir 1 Title (Optional) Model size ↳ These commands turn off command display, 2 over all size of a program clear the screen, and list the directory contents Stack size Save the file by clicking File (or pressing Alt+F) 3 3 specific size of a stack to be used and selecting Save Data declarations Back at the command prompt, run the batch file 4 If ever that there will be variable declarations, 4 by typing example, which will clear the screen otherwise, optional and display the directory contents Body of the program 5 this will be the frame of the function the Introduction to Assembly Programming program Registers Procedure/Process proper There are various registers used to create a program in 6 where the real coding starts, called functions in assembly language some programming languages ↳ The following are the basic registers in order for us to print a characters and strings the screen:.MODEL SMALL (mandatory) declared to set the environment size of small due to AX register (Accumulator registers) used to receive command from the users such as the program required print and scan for inputs ↳ use HUGE for a larger environment BX register (Base register).STACK 100H (mandatory) used to execute ALU operations such as addition, for the specific size of a stack subtraction, multiplication, and division ↳ is required in order for the assembly to use and ↳ can also be used as data storage for the mean count instructions effectively time DX Register (Data register) used to store data to be used by AX and BX registers Page 4 PT MIDTERM.CODE and END MAIN (mandatory) Load Effective Address (LEA) the entry and the exit point of the main program calls data storage to access certain memory where data is located and loaded.MAIN PROC and.MAIN ENDP (mandatory) assembly requires main function where the program DATA start executing part of the program where data are stored ↳ in this part of the program everything must be ↳ to be able to use this, Data Set is required coded and specified Data Set (DS) MOV AH, 4CH (mandatory) special register that is located in DX register table this command allows the program return to DOS ↳ used to gain access to the DATA storage mode Inputs ↳ only way to stop or terminate a program ↳ without this the program hangs forces you to AH, 2 command is used to accept input default register to catch the user’s input restart your pc ↳ if AL already contain any value, using it AL INT21H (mandatory if command is taken) again will remove its current value and allows you to execute a command replace it with a new one ↳ without this line every command declared is ignored M4 Data Path Design MOV AH, 2 tells the computer to print a single character Fixed-point numbers have a specified number of digits to the right of the from data low register (DL) decimal point MOV DL, 65 ↳ is a programming library that implements fixed- content where the asci code is being saved and point numbers as instances of a class called fixed printed ↳ library itself is made by compiling a number of source files and combining the resulting object files M3 Strings and Input Command into a library Notes: MAX FIXED PRECISION defined in the header file FIXED.H as 15 – 255 AH - handles commands such as printing singles FIXED NUMERATOR character or accepting an input package stores a fixed-point number internally as an extra-long signed inteniger 3 basic commands that is being handled by AH register MAX FIXED LENGTH namely: the size of a buffer just large enough to hold the 1 Accepting an input largest possible number including minus sign, 2 Printing a single character commas, a decimal point and a terminating null Printing of string that is taken on the DATA 9 storage Fixed Point Arithmetic/Addition and Subtraction ↳ requires LEA to actually use this command Binary Numbers can represented on a Number Circle Strings Numbers are added or subtracted on the number requires a data storage where it can be stored and can circle by traversing clockwise for addition and be retrieved using Load Effective Address (LEA) counterclockwise for subtraction ↳ requires more complex coding that regular printing Unlike the number line (a) where overflow never a string by printing it by character occurs, overflow occurs when transition is made ↳ consumes significantly less memory that the from +3 to -4 while proceeding around traditional method the number circle when adding, or from -4 to +3 ↳ makes the coding time efficient and neat while subtracting Page 5 PT MIDTERM Overflow If we want to reduce the size of the word, we can occurs when the addition of two positive numbers simply remove bits on the left and the resulting sign produces a negative result will be correct, as long as the number can be ↳ or when the addition of two negative numbers represented in the remaining bits: produces a positive result. ↳ adding operands of unlike signs never produces an overflow As an example of overflow, consider adding (80 + 80 = 160)10, which produces a result of -9610 in an 8-bit two’s complement format: Ripple Carry Adder 01010000 = 80 two binary numbers A and B are added from right to + 01010000 = 80 left, creating a sum and a carry at the outputs of each ---------------- full adder for each bit position 10100000 = -96 (not 160 because the sign bit is 1) Sign Extension leftmost bit is assigned to the sign What happens to the sign bit if we place a number into a larger or smaller word? For positive numbers, all that we need to do is pad Full Subtractor the left side with 0s: truth table and schematic symbol for a ripple-borrow subtractor: For negative numbers, we cannot simply pad the left side with 0s because that would change the value of the number: Ripple-Borrow Subtractor ripple-borrow subtractor can be composed of a As it turns out, all that we need to do is copy the sign cascade of full subtractors bit for as many places as there are to the left and the ↳ two binary numbers A and B are subtracted from number will be correctly extended, regardless of the right to left, creating a difference and a borrow at the value of the sign. This is known as sign extension: outputs of each full subtractor for each bit position Page 6 PT MIDTERM Combined Adder/Subtractor processors consumed relatively little power single ripple-carry adder can perform both addition compared to other system devices and subtraction Motherboard Support ↳ by forming the two’s complement negative for B processor you decide to use in your system will when subtracting (Note that +1 is added at c0 for two’s 5 be a major determining factor in what sort of complement) chipset you must use, and hence what motherboard you buy 886 Processor slowest member of the x86 family ↳ mov instruction takes between five and twelve clock cycles to execute depending upon the operands 8286 Processor the key to improving processor speed is to perform operations in parallel two operations per clock cycle can double instruction execution speed One’s Complement Addition fetch instruction byte from memory An example of one’s complement integer addition update instruction pointer (IP) to next byte with an end-around carry: decode the instruction fetch a 16-bit operand from memory if needed update IP to point beyond the operand if necessary Compute operand address if required (e.g., bx+xxxx) Fetch the operand Store the fetched value in the destination register 8486 Processor executing instructions in parallel using a bus interface M5 Processor unit and execution unit is a special case of pipelining one of the core component of computer system pipelining allows for nearly one instruction per ↳ logic circuitry that responds to and processes the clock cycle basic instructions that drives a computer prefetch queue enables overlapping of instruction ↳ has generally replaced the term central processing fetching/decoding with execution unit (CPU) while one instruction executes, the BIU fetches and decodes the next Microprocessor adding hardware facilitates executing almost all the processor in a personal computer or embedded in operations in parallel, central to pipelining small devices Significant Role of a Processor in a Computer System Program Counter Performance a special register that holds the address of the next 1 processor is probably the most important single instruction; to be fetched from Memory (for TOY 1, determinant of system performance in the PC the PC is 10-Bit wide) Software Support: ↳ PC is incremented 1 to “Point to” the next Newer, faster processors enable the use of the instruction is being fetched from the main memory latest software 2 ↳ new processors such as Pentium with MMX Bus Technology, enable the use of specialized subsystem that transfers data between components software not usable on earlier machines inside a computer, or between computers. Reliability and Stability 3 quality of processor is one factor that ↳ collection of wires on which electrical signals pass determines how reliably your system will run between components in the system 4 Energy Consumption and Cooling Originally Page 7 PT MIDTERM System Bus Registers/Circuits Involved connects the various components of a VNA machine The circuits used in the CPU during the cycle are: Program Counter (PC) Three Major Buses of 80x86 Family an incrementing counter the address bus 1 ↳ keeps track of the memory address of which the data bus instruction is to be executed next the control bus Memory Address Register (MAR) ↳ these busses vary from processor to processor 2 address in main memory that is currently being read or written Data Bus Memory Buffer Register (MBR) 80x86 processors use the data bus to shuffle data two-way register that holds data fetched from between the various components in a computer 3 memory (and ready for the CPU to process) or system data waiting to be stored in memory ↳ size of this bus varies widely in the 80x86 family, Current Instruction Register (CIR) indeed, this bus defines the "size" of the processor 4 temporary holding ground for instruction that has just been fetched from memory 80x86 Processor Data Bus Sizes Control Unit (CU) Processor Data Bus Size decodes the program instruction in the CIR 8088 8 ↳ selecting machine resources such as data 80188 8 5 source register and particular arithmetic 8086 16 operation, and coordinates activation of those 80186 16 resources 80286 16 Arithmetic Logic Unit (ALU) 80386sx 16 6 performs mathematical and logical operations 80386dx 32 80486 32 Register notation 80586 class / Pentium (Pro) 64 very simple way of noting all the steps involved ↳ [PC], this means that the contents of the thing inside Address Bus the brackets are loaded data bus on an 80x86 family processor transfers ↳ in the case of the first line, the contents of program information between a particular memory location counter are loaded into the Memory Address Register or I/O device and the CPU ↳ address bus identifies which memory location or I/O Instruction Components device to interact with an instruction is made up of an Operation Code, or ↳ each memory location and I/O device is assigned a "opcode", and some number of operands unique address by the system designer ↳ when software needs to access a specific memory Operation Code location or device, it places the corresponding first element of a machine level instruction address on the address bus, directing the data bus to ↳ almost always a fixed length collection of bits the correct target containing a code that identifies the specific operation to be performed Control Bus ↳ the number of possible bit patterns provides an an eclectic collection of signals that control how the upper limit for the number of operations that the processor communicates with the rest of the system processor could support ↳ CPU sends data to memory and receives data from ↳ for example, an 8-bit op code would limit a memory on the data bus processor to a maximum of 256 different operations. Page 8 PT MIDTERM Operands ↳ In many processors, both concepts can be combined Most modern processors are limited at the machine in a single instruction, so that the instruction contains level to instructions with no more than two operands; a "direct address" value, plus an "index register" ID, however, these operands may take several different plus a "base register" ID (and all three need to be forms: added together to get the "real" address of the data value to be used Register Identifier Fixed vs. Variable Length Instructions most processors have multiple general-purpose registers Multiple Instruction Formats ↳ each register requires its own unique code one consequence of having flexibility in the types of ↳ the number of registers is limited by the size of the operands possible, is that different instruction formats register identification field may be required depending upon the specific types of operands employed for individual instructions Immediate Values ↳ the layout of instruction using an 8-bit immediate some instructions include the actual value to be used value will not resemble the layout of an instruction (e.g., ADD AX,25), where the number 25 is part of the using multiple indexed/based address registers instruction rather than being stored in memory Incrementing the Program Counter instruction with only one register ID code takes less Addresses space than one with 2 or 3 register ID codes plus a Direct Addresses direct address. actual numeric address of a memory location of a data ↳ as part of the instruction cycle, the Control Unit, value to be used is contained in the instruction once the instruction has been retrieved from memory, ↳ In an 80x86 processor, the instruction "ADD AX," must increment the Program Counter to point to the means that the processor will add the value found at physically next instruction memory address 25 to the contents of the AX register, ↳ the Control Unit will need to examine the op code rather than using the number 25 itself field to determine the type of instruction and from that information determine the instruction length. Indirect Addresses ↳ doing the same operation but which have different instead of having an actual address contained within operand structures (such as "ADD AX, [BX]" and "ADD the instruction, a register identification code may be AX,[25+BX]") must have different op code patterns supplied which identifies a register which contains an address of a memory location which contains the CISC vs. RISC value to be used by the instruction Complex Instruction Set Computers ↳ in an 80x86 processor, the instruction "ADD AX,[BX]" have a large number of different instruction formats, means that the BX register contains the address of a addressing modes, and instruction lengths memory location. The processor will fetch the value Reduced Instruction Set Computers from this memory address and add it to the contents have only one uniform instruction format, and many, if of the AX register not all, instructions are the same length, making it Indexed/Based Addressing faster to decode an instruction direct and indirect addressing can be combined within Control Signals a single instruction, so that the actual address being set of pulses used to identify the channels to be used is the sum of a "direct value" specified in the followed by transferred data instruction plus the contents of some register ↳ the signal applied to the device that makes ↳ there are two basic ways to think about this: corrective changes in a controlled process or machine the "direct address" and "index" 093024 11:21PM ↳ the register can be thought of as being set-up with Disclamer a "base address" location (typically for a routine) and This document might have some typos the "direct address" portion supplies a "displacement" If you see one, tell Drew :> or "offset" (from the beginning of the routine) to the Some information here could be incorrect, if you desired location. suspect one, please do double-check Page End

Use Quizgecko on...
Browser
Browser