Computer Science II Essentials
By Randall Raus
()
About this ebook
Related to Computer Science II Essentials
Related ebooks
Computer Science I Essentials Rating: 5 out of 5 stars5/5Computer Architecture Rating: 5 out of 5 stars5/5Data Structures I Essentials Rating: 0 out of 5 stars0 ratingsConceptual Programming: Conceptual Programming: Learn Programming the old way! Rating: 0 out of 5 stars0 ratingsEssential Algorithms: A Practical Approach to Computer Algorithms Rating: 5 out of 5 stars5/5Design And Analysis Of Algorithm Rating: 0 out of 5 stars0 ratingsComputer Programming In C Language Rating: 4 out of 5 stars4/5Practical Reverse Engineering: x86, x64, ARM, Windows Kernel, Reversing Tools, and Obfuscation Rating: 0 out of 5 stars0 ratingsHistory Of Computers Rating: 0 out of 5 stars0 ratingsC & C++ Interview Questions You'll Most Likely Be Asked Rating: 0 out of 5 stars0 ratingsAlgorithm Design A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsQt 5 Blueprints Rating: 4 out of 5 stars4/5Data Structures Demystified Rating: 5 out of 5 stars5/5Learn Design and Analysis of Algorithms in 24 Hours Rating: 0 out of 5 stars0 ratingsLinux Kernel A Complete Guide - 2021 Edition Rating: 0 out of 5 stars0 ratingsJavaScript from Zero to Proficiency (Beginner): JavaScript from Zero to Proficiency, #1 Rating: 0 out of 5 stars0 ratingsIntroducing Bootstrap 4: Create Powerful Web Applications Using Bootstrap 4.5 Rating: 0 out of 5 stars0 ratingsHaskell from Another Site Rating: 0 out of 5 stars0 ratingsMath for Computer Applications Rating: 0 out of 5 stars0 ratingsEssential Algorithms: A Practical Approach to Computer Algorithms Using Python and C# Rating: 5 out of 5 stars5/5Data Structures and Algorithms in Swift: Implement Stacks, Queues, Dictionaries, and Lists in Your Apps Rating: 0 out of 5 stars0 ratingsThe Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms Rating: 0 out of 5 stars0 ratingsComputer Practices Using C++ Rating: 0 out of 5 stars0 ratingsComputational Thinking: A beginner's guide to problem-solving and programming Rating: 4 out of 5 stars4/5Learning Object-Oriented Programming Rating: 0 out of 5 stars0 ratingsSoftware Development Accelerated Essentials: What You Didn't Know, You Needed to Know Rating: 0 out of 5 stars0 ratingsData Structures II Essentials Rating: 0 out of 5 stars0 ratingsProgramming for Everyone Rating: 3 out of 5 stars3/5Fundamentals of Computer Organization and Architecture Rating: 5 out of 5 stars5/5
Computers For You
Uncanny Valley: A Memoir Rating: 4 out of 5 stars4/5CompTIA Security+ Get Certified Get Ahead: SY0-701 Study Guide Rating: 5 out of 5 stars5/5The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution Rating: 4 out of 5 stars4/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsElon Musk Rating: 4 out of 5 stars4/5The Invisible Rainbow: A History of Electricity and Life Rating: 5 out of 5 stars5/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 4 out of 5 stars4/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 4 out of 5 stars4/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Learning the Chess Openings Rating: 5 out of 5 stars5/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 5 out of 5 stars5/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5The Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms Rating: 0 out of 5 stars0 ratingsThe Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5People Skills for Analytical Thinkers Rating: 5 out of 5 stars5/5FL Studio Cookbook Rating: 4 out of 5 stars4/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5
Reviews for Computer Science II Essentials
0 ratings0 reviews
Book preview
Computer Science II Essentials - Randall Raus
SCIENCE
CHAPTER 1
Organization of a Computer
A computer manipulates data according to predefined rules or instructions stored in memory. Memory is organized into words containing n bits of information. The central processing unit (CPU) reads or writes one word at a time by addressing memory, then, when the memory is ready, either by reading that word or by writing new contents into that word. To perform this function, registers such as the memory address register (MAR) and the memory buffer register (MBR) are used.
Without some means of communication with the outside world, programs or data cannot be stored in memory. Therefore, input/output (I/O) devices are required. Figure 1.1 shows the basic organization of a computer. In the next three sections we will discuss in greater detail how the CPU, memory, and I/O actually work.
1.1 Central Processing Unit
Sometimes the central processing unit is presented as consisting of two parts: the control unit and the arithmetic logic unit (ALU). However, we will present the CPU as consisting of five main parts: instruction handling area, timing and control, address handling area, general purpose registers, and the ALU as shown in Figure 1.2.
Figure 1.1 Organization of a Computer
The address handling area consists of registers in which the addresses of program instructions or required data are stored. The addresses are transferred to the MAR at the appropriate time and the read or write is facilitated by the MAR.
The ALU is constructed from combinational devices such as parallel-adders and logic gates so that arithmetic and logic operations can be performed on the data in the CPU’s registers.
The instruction handling area consists of registers that contain the instruction currently being executed and the data needed to facilitate the execution of the current instruction.
The timing and control part, usually known as the control unit, sends out the appropriate clock-pulse to synchronize all components of the computer. The control unit also controls transfer of data between registers by control lines that go to the select lines of the bus system’s multiplexers and decoders. This unit also controls the operation of the ALU with control lines that are connected to the ALU function inputs.
Figure 1.2 Main Parts of the CPU
The general purpose registers contain data such as the results of ALU operations or data that is temporarily being stored by the CPU so that it can be used later.
1.1.1 The Arithmetic Logic Unit
Our arithmetic logic unit has five function inputs: addition, logical complement of data A, logical complement of data B, logical AND, and logical XOR as shown in Figure 1.3. Our ALU has one additional control unit input: carry-in C, which we define as arithmetically adding 1 to the result of any operation.
Figure 1.3 also shows general purpose registers A and B, the part of the bus line that transfers data between registers A and B and the ALU, and shift register SR, which receives the output of the ALU.
Figure 1.3 ALU, Shift Register, and General Purpose Registers A and B
The example below shows how the ALU in Figure 1.3 can be used to perform three additional operations that are not part of its function inputs.
EXAMPLE
Using the ALU in Figure 1.3, perform the following operations:
A–B (subtraction)
A + B (logical OR)
Test if A = B
First enable the B’ and C input functions to form the two’s complement. Next transfer the contents of SR back to B. Then add registers A and B.
First complement register A, transferring the results back to A. Then do the same to register B so they now both contain their complement. Now perform a logical AND on A and B (AND every bit in register A with the corresponding bit in register B). Next, transfer the result back to A and complement A. The SR register will now contain the logical OR of A and B by DeMorgan’s Law:
B′)′
Perform an XOR on A and B. The SR register will contain a zero if A = B.
The function inputs to the ALU and the select inputs to the bus system—which enable operations like those shown in the above example—come from the timing and control part of the CPU. Also coming from the timing and control part is the clock pulse. The clock pulse synchronizes the ALU operations and the bus transfers to and from registers. Each ALU operation takes one clock cycle, and each register transfer takes one clock cycle. These are called micro-operations, which will be explained more fully in Section 1.3.
1.2 Registers
Data stored in words in memory is usually relatively slow to access, about 3 or 4 clock cycles, so computers require high-speed registers that can be written to or read from in one clock cycle. These registers are on-board
or part of the CPU.
We will give brief explanations of the different types of registers, then show how they work, in the following sections. There are nine types of registers in the computer:
Program Counter (PC): This register holds the address of the next instruction to be executed. It will increment on the next clock-pulse when a function input is high—this function input comes from the control unit of the CPU. Since program instructions are stored in memory in sequential order, the PC is usually incremented once per instruction. The PC is part of the address handling area of the CPU in Figure 1.2.
Instruction Register (IR): This register holds the binary code of the instruction to be executed. The instruction register (IR) is part of the instruction handling area in Figure 1.2.
Memory Address Register (MAR): This register holds the address of the data to be accessed in RAM. Since memory is usually much slower than CPU registers, the MAR is considered neither part of the CPU nor the RAM, but sort of a go-between. The CPU can store an address in the MAR in one clock-pulse and the MAR can hold the address lines to the RAM for 3 or 4 clock-pulses until memory is accessed.
Memory Buffer Register (MBR): This register is used to transfer data to and from memory. Like the MAR, the MBR is neither part of the CPU nor the memory unit, but acts as a buffer between them. It can wait 3 or 4 clock-pulses for data to be accessed in the RAM, and transfer it to or from the CPU in