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/5Data Structures I Essentials 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 ratingsProgramming Concepts in C++ Rating: 0 out of 5 stars0 ratingsIntroduction to Algorithms Rating: 0 out of 5 stars0 ratingsDigital Electronics with Arduino: Learn How To Work With Digital Electronics And MicroControllers Rating: 5 out of 5 stars5/5Conceptual Programming: Conceptual Programming: Learn Programming the old way! Rating: 0 out of 5 stars0 ratingsFundamentals of Modern Computer Architecture: From Logic Gates to Parallel Processing Rating: 0 out of 5 stars0 ratingsFundamentals of Programming: Using Python Rating: 5 out of 5 stars5/5Data Structures II Essentials Rating: 0 out of 5 stars0 ratingsModern C for Absolute Beginners: A Friendly Introduction to the C Programming Language Rating: 0 out of 5 stars0 ratingsIntroduction to programming in C, a practical approach. Rating: 0 out of 5 stars0 ratingsEveryday Data Structures Rating: 0 out of 5 stars0 ratingsLearn Java with Math: Using Fun Projects and Games Rating: 0 out of 5 stars0 ratingsFundamentals of Computer Organization and Architecture Rating: 5 out of 5 stars5/5Learn Programming by Coding Like a Professional: Create Games, Apps, & Programs Rating: 0 out of 5 stars0 ratingsAlgorithm Challenges: The Dojo Collection 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 ratingsMastering C++ Network Automation Rating: 0 out of 5 stars0 ratingsWriting for Computer Science Rating: 4 out of 5 stars4/5Essential Algorithms: A Practical Approach to Computer Algorithms Using Python and C# Rating: 5 out of 5 stars5/5CODING INTERVIEWS: Advanced Guide to Help You Excel at Coding Interviews Rating: 0 out of 5 stars0 ratingsIntroduction to Algorithms & Data Structures 1: A solid foundation for the real world of machine learning and data analytics Rating: 0 out of 5 stars0 ratingsModern Programming Made Easy: Using Java, Scala, Groovy, and JavaScript Rating: 0 out of 5 stars0 ratingsLogic for Problem Solving, Revisited Rating: 5 out of 5 stars5/5Computational Thinking: A beginner's guide to problem-solving and programming Rating: 4 out of 5 stars4/5Data Structures in C / C ++: Exercises and Solved Problems Rating: 0 out of 5 stars0 ratingsDynamic programming The Ultimate Step-By-Step Guide Rating: 0 out of 5 stars0 ratingsData Structures Demystified Rating: 5 out of 5 stars5/5
Computers For You
The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/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/5The Invisible Rainbow: A History of Electricity and Life Rating: 5 out of 5 stars5/5Elon Musk Rating: 4 out of 5 stars4/5The Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsUncanny Valley: A Memoir Rating: 4 out of 5 stars4/5101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition 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/5CompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5People Skills for Analytical Thinkers Rating: 5 out of 5 stars5/5Deep Search: How to Explore the Internet More Effectively 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/5Dark Aeon: Transhumanism and the War Against Humanity Rating: 5 out of 5 stars5/5What Video Games Have to Teach Us About Learning and Literacy. Second Edition 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