CSEN402: Computer Organization Lecture 1:...

37
CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf Spring Semester 2020 Nada Sharaf Lecture 1: Introduction Spring Semester 2020 1 / 37

Transcript of CSEN402: Computer Organization Lecture 1:...

Page 1: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

CSEN402: Computer OrganizationLecture 1: Register Transfer Level I

Nada Sharaf

Spring Semester 2020

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 1 / 37

Page 2: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

General Information

Lecturer: Nada Sharaf, office: C7.211, [email protected].

TAs:Omnia Ayman, Sama El Baroudy, Fatma El Azab and NadaNasser

Textbook: Computer System Architecture, Third Edition, M. Morris,Mano

Share your questions through piazza:https://piazza.com/#spring2020/csen402csis402

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 2 / 37

Page 3: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Credits and a Huge Thank You to Dr. MohammedEl-Mahdy

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 3 / 37

Page 4: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Tentative Grading

Assignments (project) (15%)

Quizzes (15%)

Midterm (25%)

Final (45%)

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 4 / 37

Page 5: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

What

You can write algorithms

You can write programs

How do they work

How is the machine code acutally used

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 5 / 37

Page 6: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Why

Computing is everywhereI Embedded systemsI Internet of Things

Optimizations could b achievedusing:

I ArchitectureI Better programsI Enhanced hardware

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 6 / 37

Page 7: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

How

Study of the Basic Computer and how it works

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 7 / 37

Page 8: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Let us Start :)

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 8 / 37

Page 9: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Register Transfer Level

Digital systems are designed using a modular approach

Modules are connected with data and control paths

A module is best describes using:I The registers it containsI Operations done on data stored in them Microoperations

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 9 / 37

Page 10: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Microoperations

Basic operation performed onthe data in one or more registers

Result could clear contents of aregister or transfer data toanother register

ExampleI ShiftI ClearI LoadI Count

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 10 / 37

Page 11: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Microoperations

Done in one clock cycle

R ← f (R,R)

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 11 / 37

Page 12: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Digita Computer Description

The internal hardware of a digital computer is specified by:

1 The registers and their functions2 Sequence of microoperations on registers

I What are the allowed and available operations

3 Control of microopertionsI Signals to control and initiate the operations

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 12 / 37

Page 13: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Register Transfer Language

Instead of using words to describe what the operations do in terms ofthe sequence of transfers between regsiters

Special syntax and symbols

Register Transfer Language

Symbolically describes the microoperations sequence of betweenregisters

Any functionality of the system could be describes using thisdescription level

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 13 / 37

Page 14: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Registers

A register is described by anupper case letter

The letter could be followed bya numeral e.g. R3, R5, ... etc

There are some special registernames that indicate thefunctionality

I MAR: Memory AddressRegister

I PC: Program CounterI IR: Instruction Register

To save the bits of a register,flip flops are used

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 14 / 37

Page 15: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Register Representation in Block Diagram

Rectangular box with name inside it

Show the individual bits

Show the numbering of bitsIndividual bits could be distinguished

Show the partitionsPC(L) or PC(0-7) or PC(H) or PC(8-15)

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 15 / 37

Page 16: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Register Transfer

R2← R1

Used to copy contents from one register to the other

In this example contents of R1 are copied to R2

Which bits? All bits are being transferred

What happens to R1? It is unchanged i.e. non-destructive operation

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 16 / 37

Page 17: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Register Transfer: How does it Happen

R2← R1

Contents of R2 are replaced by the current content of R1

R1 is unchanged

Circuits are available from output of source to input of destination

Transfer could also be controlled

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 17 / 37

Page 18: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Control Signals

Control structures are crucial in all types of programming

We usually want actions (register transfer in our case) to happenunder certain conditions

We introduce if-then-else statements

if (P = 1) then (R2← R1)I P is our control signalI In case the control signal P holds the value 1I then load the contents of R1 into R2

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 18 / 37

Page 19: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Control Functions

A control function can be used

A control function is a Boolean variable

This variable is equal to 1 or 0.

terminated with a colon

P : R2← R1

Equivalent to if (P = 1) then (R2← R1)

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 19 / 37

Page 20: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Block Diagram

P : R2← R1

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 20 / 37

Page 21: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Timing Diagram

P : R2← R1

Control variable is synchronized using the same clock

P is activated by the rising edge of the clock pulse at time t.

On the next positive edge of the clock. the load input is active andthe data is loaded

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 21 / 37

Page 22: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Simultaneous Operations

P : R2← R1,R1← R2

What does this do? Sli.do J762

It swaps the contents

Block Diagram:

Assume registers have edge triggered flip flops

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 22 / 37

Page 23: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Other Examples: Draw Block Diagrams

A + B : R2← R1,R1← R2

AB : R2← R1,R1← R2

P : R2← R1 + R3

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 23 / 37

Page 24: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Register Transfer Symbols

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 24 / 37

Page 25: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus and Memory Transfers

A digital system has many registers that have to be connected

If separate lines are used to connected individual registers, A Lot ofwires will be used

A common bus system is usually used

Common lines

One for every every bit of a register

Binary information is transferred one at a time

How to choose which register is selected by the bus? Control Signals

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 25 / 37

Page 26: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus System

Multiple sources and destinations

Bus ← R

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 26 / 37

Page 27: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Multiplexer

f depends on the value of the selection lines

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 27 / 37

Page 28: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Multiplexers and Bus System

Multiplexer selects the source register

Binary information is then placed on the bus

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 28 / 37

Page 29: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus System with Multiplexers

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 29 / 37

Page 30: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus System with Multiplexers

MUX0 has the 0-bits of all 4 registers

MUX1 has the 1-bits of all 4 registers

MUX2 has the 2-bits of all 4 registers

MUX3 has the 3-bits of all 4 registers

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 30 / 37

Page 31: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus System with Multiplexers

Same selection lines are used

Output is formed from the four output bits of the four multiplexers

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 31 / 37

Page 32: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus System with Multiplexers

S1 S0 Register0 0 A0 1 B1 0 C1 1 D

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 32 / 37

Page 33: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Multiplexers Numbers

How many multiplexers are required for a bus system with eightregisters each having 16 bits

How many data input lines

How many selection lines: Sli.do J762

16, 8 and 3

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 33 / 37

Page 34: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Bus System

At any time, one register can place its content

Bus could be mentioned or notI

R2← R1

I

Bus ← R1,R2← Bus

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 34 / 37

Page 35: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

LogiSim

You can download it throughhttps://sourceforge.net/projects/circuit/

Online with limited capablities throughhttps://www.rollapp.com/launch/logisim

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 35 / 37

Page 36: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

References

Chapter 4

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 36 / 37

Page 37: CSEN402: Computer Organization Lecture 1: …met.guc.edu.eg/Download.ashx?id=31546&file=CSEN402_Lec1...CSEN402: Computer Organization Lecture 1: Register Transfer Level I Nada Sharaf

Thank you :)

Nada Sharaf Lecture 1: Introduction Spring Semester 2020 37 / 37