How do computers work? CPU, ROM, RAM, address bus, data bus, control bus, address decoding.

Ron Mattino
17 Feb 202327:59

Summary

TLDRThis script delves into the fundamentals of computing, focusing on the CPU and memory interaction. It explains how CPUs execute programs, the role of ROM and RAM, and the significance of address decoding. The video illustrates how data is read and written between the CPU and memory chips, the use of address, control, and data buses, and the importance of decoding in a computer system. It also touches on the evolution of computer buses and the principles behind input/output operations, concluding with a simple example of controlling an LED, showcasing the practical application of these concepts.

Takeaways

  • 💡 The CPU is the heart of any computing device, executing programs and consuming data from external memory.
  • 🔍 The CPU reads programs byte by byte, similar to reading a book word by word, with each byte having a value from 0 to 255.
  • 📚 Computer memory is organized as an array of bytes, each with a unique address starting from zero.
  • 🔱 Memory types include ROM, which contains pre-programmed code, and RAM, which holds temporary data and is erased when power is interrupted.
  • đŸ›€ïž The address bus is a set of wires that encode memory cell addresses in binary for the CPU to communicate with memory chips.
  • 🔁 The control bus, with signals like read (Rd) and write (WR), determines the operation the CPU intends to perform with memory.
  • 🔄 The data bus is bi-directional, transferring data between the CPU and memory or peripherals, with its size impacting system performance.
  • 🔑 Address decoding is crucial for memory chips to know which device the CPU is addressing, preventing data bus collisions.
  • 📉 The size of the address space is determined by the number of address bus lines and is tied to the CPU model.
  • 🔠 Hexadecimal is used in computing for its efficiency in representing binary numbers, simplifying memory address and data representation.
  • đŸ”© Real computers use a more complex decoding mechanism to allow for multiple memory and input/output devices to be addressed individually.

Q & A

  • What is the primary function of a CPU in a computing device?

    -The primary function of a CPU in a computing device is to execute programs or code. This involves reading and processing data from external memory as long as power is applied.

  • How is computer memory organized?

    -Computer memory is organized as an array of integer numbers called bytes, with each byte capable of taking a value from 0 to 255.

  • What is the difference between ROM and RAM in a computer system?

    -ROM (Read-Only Memory) typically contains pre-programmed code for the CPU to execute, while RAM (Random Access Memory) mostly contains temporary data that can be both read and written to by the CPU. ROM retains data even when the power is off, whereas RAM is erased when power is interrupted.

  • What is the purpose of the address bus in a computer system?

    -The address bus is used by the CPU to communicate the memory cell address it wants to read from or write to. It's a set of electrical wires that encode memory cell addresses using binary system (ones and zeros).

  • Why are read and write signals in a computer system active low?

    -Read and write signals are active low due to power consumption considerations. This means that the CPU pulls the read line low to perform a read operation and the write line low to perform a write operation.

  • What is the significance of the data bus in a computer?

    -The data bus is crucial for transferring data between the CPU and memory chips. It's bi-directional and its size directly affects the performance of the system. The data bus carries data in binary format, with the size of the data bus determining the size of a single memory cell.

  • How does address decoding help in differentiating between different memory chips in a computer system?

    -Address decoding uses logic gates to output logic 0 when a certain pattern of ones and zeros is present on its inputs. This mechanism allows the CPU to differentiate between memory chips by assigning them specific address ranges.

  • What is the role of the control bus in a computer system?

    -The control bus is a signaling system that includes lines like read (Rd) and write (WR) to indicate the operation the CPU intends to perform. It helps in managing the communication between the CPU and other devices on the computer motherboard.

  • Why is the hexadecimal numbering system used in computers and programming?

    -The hexadecimal numbering system is used because it simplifies the representation of binary numbers. It replaces every combination of four binary digits with one hexadecimal digit, making it easier to work with memory addresses and data.

  • How does the CPU interact with input/output devices in a computer system?

    -The CPU interacts with input/output devices using read and write operations, which are decoded into a separate address space. This is facilitated by additional signals on the control bus, such as input/output request (IOWR) and memory request (MEMR).

Outlines

00:00

đŸ–„ïž CPU and Memory Basics

This paragraph introduces the central processing unit (CPU) as the core of any computing device, responsible for executing programs. It explains how the CPU reads programs byte by byte from memory, similar to reading a book. The concept of memory cells, addresses, and the types of memory (ROM and RAM) are discussed, highlighting the permanence of ROM and the volatility of RAM. The BIOS chip and its role in system startup are also mentioned, along with a simple example of how a CPU and ROM chip interact using an address bus to read program code.

05:00

🔄 Understanding Memory Operations

The second paragraph delves into the mechanics of memory operations, focusing on the unidirectional address bus and the control bus that signals read (Rd) and write (WR) operations. It discusses the mutual exclusivity of read and write signals and the rationale behind active low signals for power consumption. The paragraph also introduces the data bus, which is bi-directional and central to the system's performance, with an example of how the CPU reads a byte of data from ROM and interprets it as a machine code instruction.

10:03

📚 Address Decoding and Memory Mapping

This section explains the concept of address decoding, which is essential for distinguishing between different memory devices in a computer system. It describes how the address space is divided into fixed ranges for ROM and RAM, using the CPU's address lines to determine the maximum addressable space. The paragraph also covers the hexadecimal numbering system as a more convenient way to represent binary numbers and how memory chips are activated based on address ranges, with examples of how ROM and RAM are assigned to different parts of the address space.

15:04

🔌 Chip Select and Memory Interaction

The fourth paragraph discusses the chip select (CS) signal and its role in activating memory chips based on address ranges. It explains how the least significant bit (LSB) and most significant bit (MSB) of an address determine which memory chip is active. The paragraph also describes the use of control lines like output enable (OE) for ROM and the right signal for RAM, and how these are used in conjunction with address decoding to prevent data bus collisions during read or write operations.

20:06

🔄 Memory Access and I/O Operations

This section describes the process of memory access and input/output (I/O) operations in a computer system. It explains how the CPU interacts with memory and I/O devices through a contiguous address space, with each device responding based on its assigned address range. The paragraph also introduces the concept of memory request and input/output request signals on the control bus to differentiate between memory and I/O operations, using an example of how to add an output port to control an LED.

25:07

🔌 Expansion and Decoding in Computer Systems

The final paragraph explores the principles of expansion and decoding in computer systems, comparing the traditional parallel connection and individual addressing of peripheral devices with modern approaches used in PCI Express buses. It discusses how expansion cards and slots operate, the role of decoder chips, and the shift towards independent communication lines for each expansion board in contemporary systems. The paragraph concludes with an invitation for viewers to engage with the content and the channel.

Mindmap

Keywords

💡CPU (Central Processing Unit)

The CPU is the primary component of a computer that performs the execution of a program's instructions. It is often referred to as the 'brain' of the computer. In the context of the video, the CPU's role is to read and execute code from memory, emphasizing its importance in the fundamental operation of any computing device.

💡Program Execution

Program execution refers to the process by which a computer runs software instructions. The video script explains that the CPU reads programs byte by byte, executing them as long as power is applied, akin to reading a book word by word.

💡Memory Cell

A memory cell is the basic unit of computer memory that stores a single piece of data, which can range from 0 to 255. The script uses the analogy of a memory cell to a book where each page is a cell, highlighting how the CPU accesses these cells through unique addresses.

💡Address

In computing, an address is a unique identifier for a memory cell. The script explains that all cells are numbered starting from zero, and this numbering system is crucial for the CPU to locate and access specific memory cells.

💡ROM (Read-Only Memory)

ROM is a type of memory that contains pre-programmed code intended for the CPU to execute. The video mentions ROM as a memory type that is typically used to store firmware, a proprietary software that runs on specific hardware.

💡RAM (Random Access Memory)

RAM is a type of memory that is used to store temporary data and can be both read and written to by the CPU. The script contrasts RAM with ROM, noting that RAM is erased when power is interrupted, unlike ROM which retains data.

💡Address Bus

The address bus is a communication system that carries the memory cell address information from the CPU to memory or input/output devices. The video script describes how the CPU uses the address bus to specify the address of the memory cell it wants to read from or write to.

💡Control Bus

The control bus is a set of signals used to manage the operations between the CPU and other devices. The script explains that the control bus includes signals like read (Rd) and write (WR), which indicate the CPU's intention to read from or write to a memory cell.

💡Data Bus

The data bus is a bi-directional communication system that carries actual data between the CPU and memory or input/output devices. The video script uses the data bus to illustrate how data, such as the contents of a memory cell, is transferred during read and write operations.

💡Firmware

Firmware is a type of software embedded in a hardware device for controlling its operation. The video script mentions firmware as the program stored in ROM that the CPU reads and executes when power is applied, emphasizing its role in the boot-up process of a system.

💡Address Decoding

Address decoding is the process of determining which device should respond to a CPU's request based on the address provided. The script explains that this is achieved through logic gates that activate memory chips only when the correct address pattern is present, preventing conflicts on the data bus.

💡Hexadecimal

Hexadecimal is a base-16 number system used in computing to simplify the representation of binary numbers. The video script introduces hexadecimal as a way to represent memory addresses and data, making it easier for humans to read and understand binary values.

💡I/O Ports (Input/Output Ports)

I/O Ports are interfaces on a computer that allow for communication with external devices such as keyboards and mice. The video script discusses how the CPU uses read and write operations on these ports, which are decoded into a separate address space, to interact with the user.

Highlights

The CPU is the heart of any computing device, executing programs and code.

CPUs read programs byte by byte, similar to reading a book word by word.

Computer memory is organized as an array of bytes, each with a value from 0 to 255.

Memory cells are numbered starting from zero, with the ordinal number called the address.

There are two types of memory: read-only memory (ROM) and random access memory (RAM).

ROM contains pre-programmed code, while RAM mostly contains temporary data.

ROM retains data even when the computer is off, unlike RAM which is erased when power is interrupted.

BIOS is a small program that executes every time you boot up your system.

The address bus is a communication system that uses binary to encode memory cell addresses.

The control bus uses signals like read (Rd) and write (WR) to indicate the operation intended by the CPU.

The data bus is bi-directional and carries data between the CPU and memory chips.

Address decoding is a mechanism used to determine which device the CPU is addressing.

The address space is divided into ranges, with each memory device assigned a specific address range.

Hexadecimal numbering is used in computers and programming for easier representation of binary numbers.

The CPU accesses memory cells by address and receives data based on the address range decoded by memory ICs.

Real computers use more complex decoding mechanisms to allow multiple memory and input/output devices to be addressed.

Input/output ports allow the CPU to interact with peripheral devices through read and write operations.

The video demonstrates how to add a simple one-bit output port to control an LED, showcasing the principles of computer engineering.

Transcripts

play00:01

the heart of absolutely any Computing

play00:03

device be it personal computer

play00:05

smartphone or a programmable calculator

play00:08

is the center processor or CPU

play00:12

the cpu's main job is to execute

play00:14

programs or code

play00:18

what this actually means is that as soon

play00:21

as power is applied the processor hungry

play00:24

for executable code starts consuming

play00:27

data from external memory

play00:29

just like a person who reads a book word

play00:32

by word the processor reads the program

play00:35

by it by bite as long as power is

play00:38

applied to the Circuit the CPU cannot

play00:40

stop and program execution continues

play00:43

forever

play00:44

and just like a book is made up of

play00:46

sequence of letters words and sentences

play00:49

computer memory is organized as array of

play00:53

integer numbers called bytes and each

play00:55

byte can take a value from 0 to 255.

play01:00

in order for the CPU to know which

play01:03

memory cell exactly IT addresses all

play01:06

cells are numbered starting from zero

play01:09

the ordinal number of a cell is called

play01:12

address

play01:13

for example memory cell number 300 has

play01:17

an address of 299

play01:19

that's because cell numbers start from

play01:22

zero

play01:23

computer memory is very similar to a

play01:26

sheet of paper you can write something

play01:28

in it that can be read later there are

play01:31

basically two types of memory read-only

play01:34

and random access

play01:36

read-only memory or ROM usually contains

play01:39

pre-programmed code which is intended

play01:41

for the CPU to execute while random

play01:44

access memory or ROM mostly contains

play01:47

temporary data either generated by the

play01:50

CPU itself or loaded by the CPU from

play01:53

external media during program execution

play01:57

as the name suggests read-only memory

play02:00

can only be read by the CPU while Random

play02:04

Access Memory can be both read and

play02:06

written to

play02:07

this means that ROM retains data even if

play02:11

you turn off your computer while Ram is

play02:14

erased every time Powers interrupted

play02:17

dim sticks installed in your PC or

play02:20

laptop is RAM

play02:22

and bios chip is wrong

play02:25

bios is a small program that is executed

play02:28

every time you boot up your system

play02:30

let's now take a glance at how it works

play02:35

imagine a very simple Computing device

play02:38

consisting of a CPU and a ROM chip

play02:41

the ROM chip contains a program called

play02:44

firmware

play02:45

the name firmware suggests that it's a

play02:48

proprietary piece of software that can

play02:50

only run on a certain device

play02:53

as the power is applied the CPU

play02:56

immediately addresses the ROM chip in an

play02:58

effort to read program code that it

play03:00

could execute

play03:02

obviously for that to happen it needs to

play03:05

read data from a number of memory cells

play03:08

so each cell is read by specifying its

play03:11

address which like was mentioned above

play03:13

is its unique ordinal number

play03:17

for the CPU to be able to tell the ROM

play03:19

chip the address of the cell it wants to

play03:22

read all computers have a communication

play03:24

system called address bus

play03:27

by Design it's basically a set of

play03:31

regular electrical wires that use binary

play03:33

system that's ones and zeros to encode

play03:36

memory cell address

play03:39

this method in fact is always used by

play03:41

computers to communicate numbers between

play03:44

devices

play03:46

imagine that the CPU wants to read cell

play03:49

whose address is 44 206.

play03:53

this is just a random sample number it

play03:56

doesn't mean anything

play03:58

let us now open Windows calculator and

play04:00

convert it to binary

play04:02

the result is this binary number

play04:07

note that it has 16 bits that's binary

play04:11

digits

play04:13

so exactly these ones and zeros the CPU

play04:17

will put up on the address bus to reach

play04:20

cell number 44 206.

play04:24

yep it's that simple

play04:27

please note and that is very important

play04:30

the least significant bit LSB of the

play04:34

address which is zero in our case will

play04:36

be put up at address line a0

play04:40

well the most significant bit MSB will

play04:43

be at line a15

play04:46

address numbering like everything in

play04:49

programming also starts at zero

play04:52

because the address is always sent from

play04:56

the CPU to external devices and never in

play05:00

the reverse Direction the address bus is

play05:03

unidirectional which means the CPU

play05:06

address lines are outputs and the ROM

play05:08

chips address pins are inputs

play05:11

so all devices on a computer motherboard

play05:14

are connected to the address bus in

play05:16

parallel

play05:18

but it's obvious that computer memory

play05:20

supports two types of communication

play05:22

reading and writing

play05:25

how would the memory chip know which

play05:28

operation exactly the CPU intends to

play05:30

perform

play05:32

for that computers use a signaling

play05:35

system called the control bus

play05:38

it also consists of regular wires and

play05:41

its two most important lines are read

play05:44

and write designated as Rd and WR

play05:49

please note both the read and write

play05:52

signals are active low meaning if the

play05:55

CPU intends to perform a read operation

play05:58

it pulls the read line low

play06:00

if it wants to write data it pulls the

play06:03

right line low

play06:05

these two signals are mutually exclusive

play06:07

because it's not possible to read and

play06:09

write simultaneously

play06:11

the reason why I read and write and

play06:14

other control signals are active low is

play06:17

power consumption considerations

play06:20

okay so the CPU outputs the binary value

play06:24

of 44 206 to the address bus

play06:29

now to let the ROM chip know it intends

play06:32

to read the contents of this memory cell

play06:35

it also activates the read line

play06:38

you might wonder now why would the ROM

play06:41

chip need the read signal if read is all

play06:43

it can do and the CPU cannot write

play06:46

anything to it

play06:47

well thing is the CPU has no idea what

play06:52

type of memory it's addressing

play06:54

actually doesn't care

play06:56

so every time it wants to read something

play06:59

no matter if it's ROM or Ram it's

play07:02

reading from it will always pull the

play07:05

ridline low

play07:06

and in fact the ROM chip does need the

play07:09

read signal because it needs to know

play07:11

when exactly it's supposed to send the

play07:13

data requested to the CPU

play07:16

looks like now we need a mechanism to

play07:19

transfer data

play07:21

and here comes to play

play07:24

the data bus

play07:26

probably the most important and also

play07:29

complicated communication system in a

play07:31

computer and it's bi-directional in our

play07:34

example the data bus carries exactly

play07:38

eight bits of data

play07:40

because the size of the data bus

play07:42

directly affects the performance of the

play07:44

entire system it is precisely this that

play07:48

we mean when we say for example that the

play07:50

computer is 8-bit and the game console

play07:53

is 16-bit and the version of Windows is

play07:55

32 or 64-bit

play07:59

in response to the cpu's request the ROM

play08:02

chip puts the contents of the memory

play08:05

cell located at address

play08:08

44206 onto the data bus

play08:11

let's say the value is 112.

play08:15

naturally the data will also be

play08:18

presented in binary format

play08:20

112 will look like this

play08:25

while the read operation is in progress

play08:27

the CPU becomes the receiving side and

play08:31

its data bus lines act as inputs and the

play08:34

ROM chips data bus pins act as outputs

play08:38

our little computer here has an 8-bit

play08:40

data bus which means the size always

play08:43

single memory cell is one byte which is

play08:46

exactly 8 Bits

play08:48

so our CPU has read exactly one byte of

play08:52

data and its value equals 112.

play08:56

like I said before the ROM chip contains

play08:59

firmware a computer programming machine

play09:02

code written by a programmer

play09:04

so 112 which is again just a sample

play09:08

value I picked is the command that tells

play09:11

the CPU to perform a certain task

play09:14

these commands are also called operation

play09:17

codes opcodes or machine code

play09:19

instructions

play09:21

so imagine it's the instruction to write

play09:25

a value of 205 to the memory cell

play09:29

located at address 62 088

play09:33

please allow me to add a ram chip to

play09:35

write to to our improvised computer

play09:38

it will be connected in parallel to both

play09:41

the address and the data bus of our

play09:43

system

play09:45

like I said the address bus is

play09:48

unidirectional and in theory we can

play09:50

connect an infinite number of devices to

play09:53

it

play09:54

but now we got a problem

play09:56

when the CPU initiates a read or write

play10:00

operation because we now got two memory

play10:03

chips in our system how would they know

play10:05

which one the CPU is addressing

play10:08

if both of them get activated

play10:10

simultaneously their outputs will

play10:12

struggle and we're going to have a

play10:14

collision on our data bus

play10:17

here another very important mechanism in

play10:21

computer engineering comes into play

play10:23

it's called address decoding

play10:26

the term decoding here has nothing to do

play10:29

with ciphering or encryption

play10:32

it's merely a set of logic gates that

play10:35

output logic 0 whenever a certain

play10:38

pattern of ones and zeros is present on

play10:41

its inputs

play10:42

what exactly this combination should be

play10:45

is determined by the Circuit of the

play10:47

decoder itself

play10:49

so in order for the CPU to know exactly

play10:52

which device it's addressing when

play10:54

designing a computer system all address

play10:57

space is divided into ranges

play11:00

some part of it is taken by Rome another

play11:03

part by Ram

play11:05

imagine a book that has several chapters

play11:09

we know exactly which page each chapter

play11:11

starts and ends in

play11:13

and it's impossible to move chapters if

play11:16

the book had already been printed

play11:18

same thing happens in a computer's

play11:21

address space

play11:22

each memory device is assigned a certain

play11:25

address range which is fixed and cannot

play11:28

be altered

play11:30

the size of the entire address space is

play11:33

determined by the number of address bus

play11:35

lines and is always tied to the CPU

play11:38

model

play11:39

our computer here has a CPU with 16

play11:42

address lines so the maximum number of

play11:45

bytes the CPU can address is 2 to the

play11:47

power of 16. which is 65

play11:51

536 bytes or 64 kilobytes

play11:56

you can also come up with this number

play11:58

using Windows calculator

play12:03

16 binary Ones Will yield a decimal

play12:06

value of 65

play12:09

535 because memory cell number one mind

play12:13

you as the address 0 not 1.

play12:16

so the address space of our computer

play12:18

starts at byte number zero and NZ byte

play12:22

number 65

play12:24

535 and the total number of bytes that

play12:28

can be addressed is 65 536.

play12:33

for the CPU to be able to work both with

play12:36

ROM and RAM

play12:39

we need to wire them in such a way that

play12:42

they're activated whenever accessing the

play12:45

address range that is assigned to each

play12:47

of them based on our concept

play12:49

or we can say these two chips must be

play12:53

properly decoded

play12:55

to keep things simple in our little

play12:57

experiment each chip will have exactly

play13:00

half the memory space which is 32

play13:03

kilobytes a piece

play13:05

ROM will take the lower 32k and RAM the

play13:09

upper 32k

play13:11

so the ROM will be located in the

play13:13

address range from 0 to 32

play13:17

767 and Ram from 32

play13:21

768 to 65 535.

play13:26

why exactly like that and not the other

play13:29

way around

play13:31

ROM is usually placed at the start of

play13:34

the address space because that's where a

play13:36

typical CPU starts program execution

play13:39

after the reset signal arrives

play13:42

when you hit reset what you actually do

play13:45

is zero the program counter PC

play13:48

so address 0 is where the very first

play13:51

firmware instruction must be located

play13:55

all data between the CPU and memory

play13:58

chips will naturally be transferred in

play14:00

binary format

play14:01

here's what it's going to look like

play14:04

to be honest these numbers do not really

play14:07

fit well with the ear and are pretty

play14:09

hard to perceive

play14:11

so in computers and programming a

play14:14

hexadecimal numbering system is used

play14:17

it differs from decimal system and that

play14:19

in addition to digits from 0 to 9 Latin

play14:23

letters from A to F are used that also

play14:26

act as digits

play14:28

so hexadecimal uses a total of 16 digits

play14:32

instead of 10.

play14:34

in essence the hexadecimal system is a

play14:38

simplified way of representing binary

play14:40

numbers

play14:41

it basically boils down to a simple

play14:44

replacement of every combination of four

play14:46

binary digits there are also 16 of them

play14:49

with one hexadecimal digit like this

play14:55

so 8-bit of binary data can be

play14:58

represented by two hex digits while 16

play15:01

bit of binary data will take up four hex

play15:03

digits and so on

play15:06

by the way in programming four bits are

play15:09

called a nibble 8 Bits are called a byte

play15:12

and 16 bits and up are called a word

play15:16

now these values will look like this and

play15:19

our ROM chip will decode to addresses

play15:22

from 0 to 7 FFF while the ram chip will

play15:26

take up address range from 8000 to ffff

play15:31

we must pronounce hex numbers by a

play15:33

single digit because 8000 is not 8 000.

play15:38

it's a different number

play15:40

hex numbers have their own designation

play15:42

and programming for example the C

play15:45

language uses prefix Ox while in

play15:48

Assembly Language Latin letter H H for

play15:52

hex uppercase or lowercase doesn't

play15:54

matter is appended at the end of the

play15:56

number

play15:57

all these designations are equivalent

play16:01

okay let us take a close look at these

play16:05

values and try to figure out how they

play16:07

differ in terms of address Buzz bits

play16:11

their binary representation tells us

play16:13

that their distinct difference is their

play16:17

most significant bit

play16:19

any HEX number in the range above 7ff

play16:22

has the highest address line that's a15

play16:25

equal to 1.

play16:28

any HEX number below 800 has address

play16:32

line a15 equal to zero

play16:35

so we need the ROM chip to activate when

play16:38

a15 is low and RAM chip to activate when

play16:42

a15 is high

play16:45

memory chips have a special control line

play16:47

for Activation called CS chip select or

play16:51

C chip enable which is basically the

play16:54

same

play16:55

the Cs signal is also active low

play17:00

if the IC is not active its outputs will

play17:04

be in the so-called z-state High

play17:06

impedance

play17:08

which means that the pin is effectively

play17:10

disconnected

play17:12

such outputs are also called Tri-State

play17:16

memory ICS also have the OE control

play17:19

signal which stands for output enable

play17:23

since ROM can only send data the Cs and

play17:27

oeither have basically the same meaning

play17:30

but for Ram active OE means the data is

play17:34

being read from the memory

play17:36

so to decode these two memory ICS all we

play17:40

have to do is use a simple inverter gate

play17:44

the ROM c signal will be wired directly

play17:47

to the a15 address line and ram C will

play17:50

be fed from the inverter

play17:53

the read signal will be wired to the

play17:55

output enable pins of both chips while

play17:58

the right signal will go to the right

play18:00

enable input of the ram chip

play18:03

the right signal is not used with the

play18:05

wrong chip naturally

play18:08

before us ladies and gentlemen is the

play18:11

real working Circuit of the simplest

play18:14

computer

play18:16

so how does it work

play18:19

once the CPU is reset its address

play18:22

pointer the program counter PC is zeroed

play18:26

so all address lines are set to logic 0.

play18:31

as the CPU immediately starts reading

play18:34

program code from memory it sets the

play18:37

read line low

play18:39

because the CE line of the ROM chip is

play18:42

also pulled Low by the a15 address line

play18:45

the ROM IC activates

play18:48

and puts up the contents of the

play18:50

requested memory cell address 0 on the

play18:53

data bus

play18:55

although Ram is wired to all buses in

play18:58

parallel it does not interfere because

play19:01

it's not active

play19:02

it's CS input is fed logic high from the

play19:06

inverter and its data lines are in the Z

play19:09

State effectively disconnected

play19:13

now imagine the CPU reads the upcode

play19:16

that instructs it to write byte AA 1070

play19:19

decimal to address b00 45 056 decimal

play19:26

the CPU sets its address bus to this

play19:29

value in binary format

play19:31

then it puts the integer number AA which

play19:35

is

play19:36

1010101 or binary on the data bus

play19:40

the AA and 55 bytes alternating zeros

play19:44

and ones is the value often used in

play19:47

programming for memory testing

play19:49

so we got the binary representation of a

play19:52

a integer on our data bus

play19:55

what happens next is the CPU pulls the

play19:59

right line low and the ram chip mind you

play20:02

the a15 is high and CS is low which

play20:06

means it's active performs the right

play20:08

operation storing value a a in a memory

play20:12

cell whose address is b00

play20:16

now this data is stored and whenever the

play20:19

processor needs it it can read it

play20:22

to do this it has to set the address bus

play20:25

to b00 and pull the read signal low

play20:30

the chip enable line of the ram chip

play20:32

will also be pulled Low by the inverter

play20:35

and it will place the contents of the

play20:37

memory cell b00 on the data bus and the

play20:40

CPU will read it switching its data

play20:43

lines to input mode

play20:47

okay so we have created a contiguous

play20:51

address space of 64 kilobytes covered by

play20:54

two memory chips

play20:56

the CPU has no idea about the structure

play20:59

it simply accesses a Cell by address and

play21:02

receives data and each of the memory ICS

play21:06

responds to the CPU based on which range

play21:10

the address requested belongs to

play21:12

in real computers decoding is of course

play21:15

much more complex

play21:16

the decoder can use several address

play21:18

lines and other signals to obtain a

play21:21

narrower address range

play21:23

using this mechanism several memory and

play21:26

input output devices can be decoded

play21:29

in any case it's up to the developer to

play21:33

decide which address range each memory

play21:35

chip must be decoded

play21:36

and when firmware is written the

play21:39

programmer naturally must be aware which

play21:42

devices decode to which address range

play21:45

for example every personal computer has

play21:47

this thing called display memory area

play21:50

also known as video Ram or vram

play21:53

it's basically your regular Random

play21:56

Access Memory however writing data to it

play21:59

changes the contents of the computer

play22:01

screen

play22:02

typically vram memory cells are located

play22:05

according to their position on the

play22:07

screen that is from left to right and

play22:10

from top to bottom the lower address is

play22:13

the upper left corner the higher address

play22:15

is the lower right corner

play22:17

all those are maybe exceptions

play22:23

now we have studied a very important

play22:26

mechanism that explains the interaction

play22:28

of the servo processor and memory

play22:31

devices

play22:32

with this knowledge it's easy to

play22:34

understand the principles of operation

play22:36

of any computer

play22:39

but it seems our virtual PC is missing

play22:42

something

play22:43

it does not in any way interact with the

play22:46

user

play22:47

all real computers in addition to memory

play22:50

have input output ports this is where

play22:53

you plug in your keyboard mouse or

play22:55

gamepad

play22:56

to work with ports the CPU also uses

play22:59

read and write operations

play23:01

but they are decoded into a separate

play23:04

address space and accessed with separate

play23:08

machine language instructions

play23:10

the address bust used however is the

play23:12

same so to separate ports from memory

play23:15

devices there exists additional signals

play23:18

on the control bus called input output

play23:21

request Iowa REC and memory request

play23:24

memric

play23:26

traditionally their active level is also

play23:29

low

play23:30

so for the CPU to be able to talk to

play23:32

memory correctly we must also decode the

play23:35

memory request signal

play23:37

here's what the schematic will look like

play23:39

then

play23:41

now both memory chips can get a logic

play23:44

low on their chip enabled inputs only on

play23:47

condition the memory request line is

play23:50

also low

play23:52

so what are we gonna do with our little

play23:54

computer now

play23:55

say we want to impersonate Arduino and

play23:59

Flash an LED

play24:01

let us add a simple one bit output port

play24:04

to our system

play24:06

we will use add d-type flip flop to

play24:08

implement it

play24:10

the data input will be wired directly to

play24:13

the data bus

play24:14

while the clock input needs to be

play24:16

properly decoded

play24:18

let our Port use the address FF

play24:22

this number corresponds to eight ones in

play24:25

binary

play24:26

like I said CPU uses the same address

play24:29

bus to the code ports so we will need an

play24:33

and gate with 8 inputs to track this

play24:36

combination on the address bus

play24:38

our Port will be right only so we also

play24:42

need to decode the cpu's bright line

play24:44

the device must react only to Port

play24:47

output instructions and ignore memory

play24:49

right instructions so we also need to

play24:52

decode the input output request signal

play24:55

if we don't the CPU won't know how to

play24:58

differentiate between memory cellff and

play25:01

port number FF and when it performs a

play25:04

write operation both will be affected

play25:07

okay

play25:08

let us analyze the circuit step by step

play25:12

say the CPU wants to turn on the LED

play25:16

so it executes a machine code

play25:18

instruction that writes value 1 to Port

play25:21

FF

play25:22

as we have wired the flip-flop D input

play25:25

to the d0 line the state of the LED will

play25:29

correspond to the least significant bit

play25:31

LSB of the data byte

play25:34

so the CPU sets the address lines from

play25:37

a0 to A7 to 8 ones that's value FF and

play25:42

puts up logic 1 on d0 line

play25:45

then it pulls the right and input output

play25:48

request lines low

play25:50

at this very moment the flip-flop will

play25:53

be clocked at the scene Boot and data

play25:56

will be copied into the register

play25:58

the LED will illuminate

play26:01

to turn the LED off the CPU must perform

play26:04

exactly the same action except the value

play26:07

written to the flip-flop board must be

play26:10

zero

play26:12

this principle of parallel connection

play26:14

and individual addressing of peripheral

play26:17

devices with the help of decoding has

play26:20

been used in computer engineering for

play26:22

decades

play26:23

and that's exactly how Isa and PCI buses

play26:27

and personal computers work

play26:29

all slots and such systems are connected

play26:32

in parallel and decoding happens on the

play26:34

expansion cords inserted

play26:37

if you've ever used the ISA Sound

play26:39

Blaster you remember you had to set up

play26:41

its address and interrupt line

play26:43

what you were actually doing is setting

play26:46

up its decoder chip

play26:48

so any expansion card can be inserted

play26:51

into any slot and will work the same way

play26:55

however starting with a PCI Express Bus

play26:58

manufacturers have abandoned this

play27:00

principle and today each motherboard

play27:03

slot has independent lines for

play27:05

communication with every individual

play27:07

expansion board installed

play27:11

and that would be it for today I hope

play27:14

you enjoyed this video and learned

play27:16

something new

play27:17

if you did make sure to give it a thumbs

play27:20

up and hit the Subscribe button if you

play27:22

haven't already

play27:24

and please don't hesitate to share it on

play27:26

social media

play27:27

this was Ron matino

play27:30

take care see you soon

play27:34

[Music]

play27:47

foreign

Rate This
★
★
★
★
★

5.0 / 5 (0 votes)

Étiquettes Connexes
CPU FunctionsComputer MemoryROM FirmwareRAM DataAddress DecodingData BusControl BusMemory AccessFirmware ExecutionPeripheral Devices
Besoin d'un résumé en anglais ?