Toward a general purpose computer Example: Game of Life.

Slides:



Advertisements
Similar presentations
Machine cycle.
Advertisements

Chapter 7 Henry Hexmoor Registers and RTL
ARITHMETIC LOGIC SHIFT UNIT
Solution to Exercise 8. The algorithm 1. I == 0 : Op  Decode_Op(TerminalInput) I == 1 : Dest  Decode_Dest(TerminalInput) I == 2 : Dig1  Decode_Digit(TerminalInput)
EE1A Revision What should you be expected to do in a typical exam question ? Understanding of basic principles. Ability to perform simple circuit analysis.
1 COMP541 Datapaths II Montek Singh Mar 22, 2007.
Toward a general purpose computer II Example: Game of Life.
CPEN Digital System Design Chapter 9 – Computer Design
The Processor Data Path & Control Chapter 5 Part 1 - Introduction and Single Clock Cycle Design N. Guydosh 2/29/04.
The Microcomputer System In this presentation you will: Investigate the microprocessor Title Page.
Stack Stack Pointer A stack is a means of storing data that works on a ‘Last in first out’ (LIFO) basis. It reverses the order that data arrives and is.
Computer Design Basics
Designing an ALU Taken from various sources Primary source: Digital Design and Computer Architecture by Harris &Harris.
Chap 7. Register Transfers and Datapaths. 7.1 Datapaths and Operations Two types of modules of digital systems –Datapath perform data-processing operations.
Chapter 4 Computer Design Basics. Chapter Overview Part 1 – Datapaths  Introduction  Datapath Example  Arithmetic Logic Unit (ALU)  Shifter  Datapath.
1 Arithmetic Logic Unit ALU. 2 The Bus Concept 3 CPU Building Blocks  Registers (IR, PC, ACC)  Control Unit (CU)  Arithmetic Logic Unit (ALU)
Computer Organization - 1. INPUT PROCESS OUTPUT List different input devices Compare the use of voice recognition as opposed to the entry of data via.
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Gary MarsdenSlide 1University of Cape Town Chapter 5 - The Processor  Machine Performance factors –Instruction Count, Clock cycle time, Clock cycles per.
Computer Science 101 Computer Systems Organization.
M. Mateen Yaqoob The University of Lahore Spring 2014.
IT253: Computer Organization Lecture 9: Making a Processor: Single-Cycle Processor Design Tonga Institute of Higher Education.
A four function ALU A 00 ADD B MUX SUB 11 Result AND OR
Computer Science 210 Computer Organization Control Circuits Decoders and Multiplexers.
Design of a 8-bit RISC Micro controller Core By Ayush Mittal( ) Rakesh Kumar Sahoo( ) Under Guidance of Dr. M.B.Srinivas.
EKT 221 : Chapter 4 Computer Design Basics
CBP 2002ITY 270 Computer Architecture1 Digital Logic This Time … Control Path, Arithmetic Ops 12 a U1 34 b Last Time …
CPU The Central Processing Unit (CPU), has 3 main parts: Control Unit Arithmetic and Logic Unit Registers. These components are connected to the rest.
CBP Comp 1017 Digital Technologies1 Let’s make a Computer … at least the CPU … Pentium 4 Pentium 3 Opteron Ultra Sparc Itanium 2 McKinley.
CBP 2006Comp 4070 Concepts and Philosophy of Computing 1 Wrestling with Complex Stuff. With the Correct Approach, even the smallest guy will succeed!
Our programmer needs to do this !
Computer Architecture Lecture 9 MIPS ALU and Data Paths Ralph Grishman Oct NYU.
Ch5. 기본 컴퓨터의 구조와 설계.
Computer Architecture Lecture 4 by Engineer A. Lecturer Aymen Hasan AlAwady 17/11/2013 University of Kufa - Informatics Center for Research and Rehabilitation.
CPU Overview Computer Organization II 1 February 2009 © McQuain & Ribbens Introduction CPU performance factors – Instruction count n Determined.
COMP 1321 Digital Infrastructure Richard Henson University of Worcester October 2012.
An Adder A Subtractor. A and B are the inputs of the adder/ subtractor R is the output of the adder/ subtractor F is the control to tell it to add or.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
EKT 221 : Digital 2 Computer Design Basics Date : Lecture : 2 hrs.
Chapter 5 Computer Organization TIT 304/TCS 303. Purpose of This Chapter In this chapter we introduce a basic computer and show how its operation can.
REGISTER TRANSFER AND MICROOPERATIONS
REGISTER TRANSFER AND MICROOPERATIONS
Computer Science 210 Computer Organization
More Devices: Control (Making Choices)
Introduction CPU performance factors
Homework Reading Machine Projects Labs
Combinational Logic Circuits
Morgan Kaufmann Publishers The Processor
von Neumann Architecture CPU
Prof. Sirer CS 316 Cornell University
Digital Logic Last Time … This Time … Control Path, Arithmetic Ops a
The fetch-execute cycle
Computer Science 210 Computer Organization
CSCI206 - Computer Organization & Programming
Morgan Kaufmann Publishers The Processor
Lecture 11: Hardware for Arithmetic
Levels in Processor Design
von Neumann Architecture CPU
April 3 Fun with MUXes Implementing arbitrary logical functions
Homework Reading Machine Projects Labs
Levels in Processor Design
Prof. Sirer CS 316 Cornell University
Levels in Processor Design
Combinational Circuits
Levels in Processor Design
Basic components Instruction processing
COMS 361 Computer Organization
Presentation transcript:

Toward a general purpose computer Example: Game of Life

Game of Life For Each Line For Each Cell Solve Cell

Game of Life For Each Line For Each Cell Solve Cell Generation LineCell Matrix

Modularity Generation Module Matrix Module Line Module Cell Module

Algorithm for the Generation Module 1. CurrentGen = 0 2. Solve for current Matrix 3. CurrentGen++ 4. If CurrentGen < MAX_GEN goto 2

Solve Matrix 0. j = 1 1. Calculate line (j) 2. If j < MAX_LINE 2.1 j goto STOP

Calculate Line j 0. i = 0, tmp = 0 1. Calculate Cell i. 2. If alive, set location i in tmp to alive 3. If i < MAX_CELL 3.1 i goto Store tmp in : even generation: i+16 odd generation : i-16

CellAlive(cell index i, line index j) 0. N = Count_Neighbors(i,j-1,false) 1. N = N+Count_Neighbors(i,j,true) 2. N = N+Count_Neighbors(i,j+1,false) 3. If N > MIN && N < MAX 3.1 Return alive 4. Return dead

Count_Neighbors (index i,line j, center) 0. N = 0 1. If alive in location [i-1,j]: N=N+1 2. If not center: 2.1 If alive in location [i,j]: N=N+1 3. If alive in location [i+1,j]: N=N+1 4. Return N

Algorithm implementation Algorithm How to do?What to do? The operation itselfcontrol

The operations in the algorithm: Operations: Add Subtract

The operation: Defining interfaces CountNeighbors CellAlive Calculate Line Solve Matrix Generation Return Number of Neighbor: N Alive: Dead: (i-1) location Return the line The matrix Return The Operation itself

The operation: Module Calculate Line, instruction 2 If alive If dead Calculate_Line(j) = OR tmp = Result = Calculate_Line(j) = OR tmp = Result = The j-th location If alive, set location i in tmp to alive The Operation itself

The operation: Module Calculate Line, instruction 2 If alive, set location i in tmp to alive tmp = OR(tmp,Calculate_Line(j)) The Operation itself

The operations in the algorithm: Operations: Add Subtract OR The Operation itself

Implementing instructions Module Count_Neighbors, instruction 1, 2.1, 3 decode(i-1) = AND Line (j) = Result = decode(i-1) = AND Line (j) = Result = Zero – cell in location i is dead Non Zero – cell in location i is alive If alive in location [i-1,j] The Operation itself

Implementing instructions Module Count_Neighbors, instruction 1, 2.1, 3 Alive if AND(line,decode(i-1)) is not zero If alive in location [i-1,j] The Operation itself

The operations in the algorithm: Operations: Add Subtract The logic AND + Check if zero The Operation itself

Small ALU (arithmetic logic unit) Op selector MeaningResult 00AddRes = InputA+InputB 01SubractRes = InputA+ NOT(InputB)+1 10ANDRes = AND(InputA,InputB) 11DecodeRes = decode(InputA) The Operation itself

Small ALU Status Bit The Operation itself

Small ALU Status Bit The Operation itself ALU isZero Op InputB InputA

Variables of the algorithm Count_Neighbors Line j – The current line i - The index we are processing N - The number of Neighbors so far tmp - temporary processing space

Implementation of AND(line,decode(i+1)) Reg1 Reg2 Reg3 Regn

Implementation of AND(line,decode(i+1)) Reg1 Reg2 Reg3 Regn ReadA ReadB 1 2 Connected like MUX 1

Implementation of AND(line,decode(i+1)) Reg1 Reg2 Reg3 Regn ReadA ReadB 1 2 Decoder Enable Write Write Address Write Data

Implementation of AND(line,decode(i+1)) Registers Data 1 Data 2 Data 1 Address Data 2 Address WriteAddress Write Data Write

Variables of the algorithm Count_Neighbors VariableMeaningAddress CurrentLineHold the current line 0 IThe current index1 NThe Neighbor2 TmpTemporary space3 Constant 1 5 ControlVariableA flag to determine if the operation should be performed 6 CenterIs it the center7

In generation Current Generation Matrix, gen=0 Next generation Matrix I  I+16

In generation Current Generation Matrix,gen=1 Next generation Matrix I+16  I

Variables of the algorithm Count_Neighbors VariableMeaningAddress CurrentLineHold the current line 0 IThe current index1 NThe Neighbor2 TmpTemporary space3 Constant 1 5 ControlVariableA flag to determine if the operation should be performed 6 CenterIs it the center7

Register/ALU circuit Registers Data 1 Address Data 2 Address WriteAddress Write ALU Op Extend 1 to 16 MUX R0R1 External Input 0 1 2

Control Algorithm is zero[AND(line,decode(i+1))] If alive in location [i+1,j]: N=N+1 Algorithm instruction Instruction a.Tmp = is zero[AND(Currentline, decode(i+1))] b.If controlVariable= : N=N+1 The Operation itself

Control Algorithm is zero[AND(line,decode(i-1))] Tmp = is zero[AND(line,decode(i-1))] Instruction The Operation itself t0. Tmp = i-1 t1. Tmp = decode(Tmp) t2. controlVariable = is zero[AND(CurrentLine, Tmp)] Micro-Instruction

Micro instruction implementation t0. Data 1 Address = 1 Data 2 Address = 5 WriteAddress = 3 Write = 1 Op = 01 R0R1 = 01 Micro-Instruction The Operation itself a.Tmp = i+1 b.Tmp = decode(Tmp) c.controlVariable = is zero[AND(CurrentLine, Tmp)] Subtract i 1 tmp The result of the ALU

Micro instruction implementation t1. Data 1 Address = 3 Data 2 Address = 0 WriteAddress = 4 Write = 1 Op = 11 R0R1 = 01 The Operation itself a.Tmp = i+1 b.Tmp = decode(Tmp) c.controlVariable = is zero[AND(CurrentLine, Tmp)] Decode tmp Irrelevant tmp The result of the ALU Micro-Instruction

Micro instruction implementation t2. Data 1 Address = 0 Data 2 Address = 3 WriteAddress = 6 Write = 1 Op = 10 R0R1 = 00 The Operation itself a.Tmp = i+1 b.Tmp = decode(Tmp) c.controlVariable = is zero[AND(CurrentLine, Tmp)] And Line in register i tmp controlVariable The zero status bit Micro-Instruction

Instruction Hierarchy Instruction Micro-Instruction Instruction Algorithmic Instruction The Operation itself

Instruction Hierarchy Instruction t0: Micro-Instruction t n : Micro-Instruction t0: Micro-Instruction t n : Micro-Instruction Instruction Each micro instruction = 1 cycle Timing Variables

Timing variables (example with 4 time variables) CP t0 t1 t2 t3 One instruction

Generating Timing variables example with 16 timing variables CP Register 4bits Adder 1 Decoder t0 t15

Control of Count_Neighbor

Control of Count_Neighbor

Putting it all together: implementing what to do with ROM Current State TimingCVCD1D2WAWOpR0R1 t0t1t2t3 ROM Input ROM Output The current state (4 bits) The current timing variable (1 bits) Control variable (16bits) Center Register 7 (16bits)

Putting it all together: implementing what to do with ROM Data 1 Address ROM Input ROM Output Data 2 Address Write-Data MUX control WriteAddress Write ALU Operation Current State TimingCVCD1D2WAWOpR0R1 t0t1t2t3

Putting it all together: implementing what to do with ROM ROM Input ROM Output Current State Timing CVC D1D2WAWOpR0R1 t0t1t2t     t0. Tmp = i+1 t1. Tmp = decode(Tmp) t2. controlVariable = is zero[AND(CurrentLine, Tmp)] t3. do nothing

Putting it all together: implementing what to do with ROM ROM Input ROM Output Current State Timing CVC D1D2WAWOpR0R1 t0t1t2t     t0. Tmp = i+1 t1. Tmp = decode(Tmp) t2. controlVariable = is zero[AND(CurrentLine, Tmp)] t3. do nothing

Putting it all together: implementing what to do with ROM ROM Input ROM Output Current State Timing CVC D1D2WAWOpR0R1 t0t1t2t     t0. Tmp = i+1 t1. Tmp = decode(Tmp) t2. controlVariable = is zero[AND(CurrentLine, Tmp)] t3. do nothing

Putting it all together: implementing what to do with ROM ROM Input ROM Output Current State Timing CVC D1D2WAWOpR0R1 t0t1t2t     t0. Tmp = i+1 t1. Tmp = decode(Tmp) t2. controlVariable = is zero[AND(CurrentLine, Tmp)] t3. do nothing

Control of Count_Neighbor t0. Set Current State 0001 t1. Set Current State 0001 t2. Set Current State 0001 t3. If ControlVariable=1 Set Current State 0010 t3. If ControlVariable=0 Set Current State 0011 Current State = 0001

Putting it all together: implmenting control with ROM ROM InputROM Output Current State Timing CVC NextState t0t1t2t  0100  0010    0011 Here is the branch.

ROM Timing VariableCurrentState Registers ALU Extend 1 to 16 MUX R0R1 1 Result zerobit Op D1 D2 WA Write WriteData Next State Current State