Datapath and control Dr. ir. A.B.J. Kokkeler 1. What is programming ? “Programming is instructing a computer to do something for you with the help of.

Slides:



Advertisements
Similar presentations
The 8051 Microcontroller and Embedded Systems
Advertisements

Instruction Set Architecture
Computer Architecture Abhinav Agarwal Veeramani V.
Computer Architecture
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
CS 300 – Lecture 19 Intro to Computer Architecture / Assembly Language C Coding & The Simulator Caches.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
Microprocessors Introduction to RISC Mar 19th, 2002.
Lecture 16: Basic CPU Design
Computer ArchitectureFall 2007 © Sep 10 th, 2007 Majd F. Sakr CS-447– Computer Architecture.
Processor Types And Instruction Sets Barak Perelman CS147 Prof. Lee.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Micro-operations Are the functional, or atomic, operations of a processor. A single micro-operation generally involves a transfer between registers, transfer.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Cosc 2150: Computer Organization
ITEC 352 Lecture 12 ISA(3). Review Buses Memory ALU Registers Process of compiling.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
Computer Architecture And Organization UNIT-II General System Architecture.
Computer Organization CSC 405 (VSC) Very Simple Computer.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
1 ICS 51 Introductory Computer Organization Fall 2009.
CDA 3101 Fall 2013 Introduction to Computer Organization
IT253: Computer Organization Lecture 9: Making a Processor: Single-Cycle Processor Design Tonga Institute of Higher Education.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
ICC Module 3 Lesson 1 – Computer Architecture 1 / 6 © 2015 Ph. Janson Information, Computing & Communication Computer Architecture Clip 3 – Instruction.
CBP 2002ITY 270 Computer Architecture1 Module Structure Whirlwind Review – Fetch-Execute Simulation Instruction Set Architectures RISC vs x86 How to build.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 TM 1 Embedded Systems Lab./Honam University ARM Microprocessor Programming Model.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ read/write and clock inputs Sequence of control signal combinations.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Computer Organization and Architecture Lecture 1 : Introduction
Computers’ Basic Organization
Basic Computer Organization and Design
Control Unit Lecture 6.
Gunjeet Kaur Dronacharya Group of institutions
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Microprocessor and Assembly Language
The 8051 Microcontroller and Embedded Systems
Chapter 4 The Von Neumann Model
Morgan Kaufmann Publishers The Processor
Prof. Sirer CS 316 Cornell University
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
The Processor and Machine Language
Computer Science 210 Computer Organization
Computer Structure S.Abinash 11/29/ _02.
Control Unit Introduction Types Comparison Control Memory
Morgan Kaufmann Publishers The Processor
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Unit 12 CPU Design & Programming
Fundamental Concepts Processor fetches one instruction at a time and perform the operation specified. Instructions are fetched from successive memory locations.
COMS 361 Computer Organization
A Discussion on Assemblers
Overview Last lecture Digital hardware systems Today
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
ECE 352 Digital System Fundamentals
Instructions in Machine Language
The Stored Program Computer
Chapter 6 Programming the basic computer
Computer Systems An Introducton.
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
Presentation transcript:

Datapath and control Dr. ir. A.B.J. Kokkeler 1

What is programming ? “Programming is instructing a computer to do something for you with the help of a programming language” Different ways to control a computer: High level programming language (e.g. JAVA) No details of the hardware, easier to program but less efficient code Low-level programming language (e.g. C) More hardware knowledge required, more control, more efficient Assembly (machine instructions) Detailed hardware knowledge, Ultimate control, Highly efficient Simple to use more control runs faster

A C program #include int main(void) { int a; a = 10; printf("a is now %d\n", a); a = a + 15; printf("a is now %d\n", a); return 0; } Output: a is now 10 a is now 25

From C code to program execution (1) C code a = a + 15; Machine code (.exe file) assembler Assembler code load R2 add 15 store R2 compiler editor execute Data Example: Together also often called compiler Explained in this lecture. Interpretation of this code is described in the Instruction Set Architecture (ISA) Level used in the project

Processor blockdiagram 5

Processors Important elements – Combinatorial circuits Operations on binary signals – Switches Selection of 1 out of multiple – Memory elements Registers Memories – Clock signal 6

Combinatorial circuits Input signals are presented Collection of transistors is executing the calculation This takes time After some time, the result is available ‘+’ indicates the arithmetic operation ‘addition’ 3 Volt 0 Volt 3 Volt 7

Combinatorial circuits lsb msb Input signals are presented Collection of transistors is executing the calculation This takes time After some time, the result is available 8

Combinatorial circuits Input signals are presented Collection of transistors is executing the calculation This takes time After some time, the result is available 9

Combinatorial circuits * Except + and * there are many other operations Input signals are presented Collection of transistors is executing the calculation This takes time After some time, the result is available ‘*’ indicates the arithmetic operation ‘multiplication’ 10

Switches *

Switches * This switch has two options => Control uses 1 bit 12

Switches *

Switches *

* (very simple) ALU Data Instruction (0 = ‘+’ 1 = ‘*’) ALU = Arithmetic & Logic Unit 15

Memory elements Where do data and instruction come from? Where is data going to? Three options – (individual) register – Register banks (“registers” in AVR blockdiagram) – Memory banks (“memory” in AVR blokdiagram) ALU Data in Data out Instruction 16

Register Data out

Register Data out

Register Data out Data in

Register Data out Data in At a transistion from 0 to 1 on this input, “Data in” is stored and “Data out” takes over this value Reasoning backwards: “Data in” comes from -Another memory element -“outside” the processor (I/O) Reasoning forward: “Data out” goes to -Another memory element -“outside” the processor (I/O) In both cases, data can pass via combinatorial circuits, e.g. an ALU 20

Register Data out Data in Storage of 8 bits At a transistion from 0 to 1 on this input, “Data in” is stored and “Data out” takes over this value 21

Register banks 22

Register banks Switch with 4 possible positions => coded via 2 bits 00 Data out 23

Register banks 01 Data out Switch with 4 possible positions => coded via 2 bits 24

Register banks 10 Data out Switch with 4 possible positions => coded via 2 bits 25

Register banks 11 Read address Data out Switch with 4 possible positions => coded via 2 bits 26

Register banks 11 Read address 00 Write address 01 Data in Data out Switch with 4 possible positions => coded via 2 bits Switch with 4 possible positions => coded via 2 bits 27

Register banks Data in Data out Switch with 4 possible positions => coded via 2 bits Switch with 4 possible positions => coded via 2 bits Read address Write address 28

Register banks Data in Data out Switch with 4 possible positions => coded via 2 bits Switch with 4 possible positions => coded via 2 bits Read address Write address 29

Register banks Data in Data out Switch with 4 possible positions => coded via 2 bits Switch with 4 possible positions => coded via 2 bits Read address Write address 30

Register banks Data out Read address Data in Write address Register bank 01 31

Register bank (RB) RB Read address Write address Data out Data in 01 32

Memory (MEM) Same functionality as Registerbank Read and Write not simultaneously => 1 address input + additional line that indicates read or write Consists of a lot more memory elements (larger address range) MEM R/W address Data out Data in 1 bit that indicates whether you read or write 01 33

Register bank (RB) In Atmega: Two registers can be read from the same bank RB Read adddress 1 Data out 1 Data in Data out 2 01 Read address 2 Write address 34

Clock signal ALU Data in Data out Instruction RB Read address 1 Data out 1 Data in Data out 2 01 Read address 2 Write address 35

Clock signal ALU Data in Data out RB Data in Clock Data available for ALU ALU busy Result of ALU can be taken over Instruction Read address 1 Read address 2 Write address 36 New Data available for ALU Again, result of ALU can be taken over ALU busy Because of the clock, time is divided into ‘timeslots’. What happens during a timeslot is determined by Read addresses 1 and 2, Write address and Instruction

Clock signal ALU Data in Data out RB Data in Clock timeslot i: Read address 1, Read address 2, Instruction, Write address timeslot i timeslot i+1 Instruction Read address 1 Read address 2 Write address Data available for ALU Result of ALU can be taken over timeslot i+1: Read address 1, Read address 2, Instruction, Write address 37

Program timeslot i: 0, 0, 1, 1 timeslot i+1: 1, 0, 0, 2 Example What calculation is executed here? timeslot i: Read address 1, Read address 2, Instruction, Write address timeslot i+1: Read address 1, Read address 2, Instruction, Write address 38

Program timeslot i:0, 0, 1, 1 timeslot i+1: 1, 0, 0, 2 Example Instruction (0 = ‘+’ 1 = ‘*’) Register 0‘*’ Register 1 Register 0 Register 1 Register 2 ‘+’ R2 = (R0*R0)+R0 This way, lists of tasks (instructions) can be made that have to be executed on consecutive timeslots = Program Program is stored in a memory = Program memory timeslot i: Read address 1, Read address 2, Instruction, Write address timeslot i+1: Read address 1, Read address 2, Instruction, Write address What calculation is executed here? 39

Program ALU Data in Data out RB Data in Clock Read address 1, Read address 2, Instruction, Write address Counter that is Incremented each timeslot and points to the active instruction = Program counter Program memory timeslot i timeslot i+1 Data available for ALU Result of ALU can be taken over Read address 1, Read address 2, Instruction, Write address 40

Program ALU Data in Data out RB Data in Clock 10 Program counter Read address 1, Read address 2, Instruction, Write address timeslot i timeslot i+1 Data available for ALU Result of ALU can be taken over 41

Program for ATmega ALU Data in Data out RB Data in Clock 10 address 1, address 2, Instruction Program counter address 1, address 2, Instruction timeslot i timeslot i+1 Data available for ALU Result of ALU can be taken over 42

Program for ATmega Instruction, address 1, address 2 For the atmega, the order is 1.Instruction 2.Address 1 which acts as both ‘source’ and ‘destination’ address 3.‘Source’ address 2 address 1, address 2, Instruction Instruction, address 1, address 2 43

Program for ATmega Examples are based on arithmetic operations (addition, multiplication) Indicated as: 0 = ‘+’ en 1 = ‘*’ In programs operations are coded by ‘Mnemonics’. For example ‘+’ = ADD, ‘*’ = MUL. 44

Program for ATmega Atmega can do a lot more than addition and multiplication (has more instructions and thus more hardware blocks than “RB” and “ALU”) – Data movement MOV (move): between registers LD (load) and ST (store): amongst others between registers and memory IN and OUT: All other addressable elements – Adjusting the program counter JMP: fill the program counter with another value => the next timeslot, not the ‘next’ instruction will be executed but execution will proceed at another point in program memory. – …….. 45

Unconditional Jump ALU Data in Data uit RB Data in Clock 00 address 1, address 2, Instruction Program counter address 1, address 2, Instruction 46

Unconditional Jump ALU Data in Data out RB Data in Clock 01 Program counter address 1, address 2, Instruction address 1, address 2, Instruction 47

Unconditional Jump ALU Data in Data out RB Data in Clock 10 Program counter address 1, address 2, Instruction address 1, address 2, Instruction 48

Unconditional Jump ALU Data in Data out RB Data in Clock 11 Program counter address 1, address 2, Instruction address 1, address 2, Instruction 49

Unconditional Jump ALU Data in Data uit RB Data in Clock 00 address 1, address 2, Instruction Program counter address 1, address 2, Instruction JMP

Unconditional Jump ALU Data in Data out RB Data in Clock 01 Program counter address 1, address 2, Instruction address 1, address 2, Instruction JMP

Unconditional Jump ALU Data in Data out RB Data in Clock 10 Program counter At a JMP instruction: -Program counter is not increased automatically -Value in the address field is loaded into the Program counter address 1, address 2, Instruction address 1, address 2, Instruction 00 JMP address 1, address 2, Instruction 52

Unconditional Jump ALU Data in Data out RB Data in Clock 00 Program counter address 1, address 2, Instruction address 1, address 2, Instruction 00 JMP address 1, address 2, Instruction 53 At a JMP instruction: -Program counter is not increased automatically -Value in the address field is loaded into the Program counter

Unconditional Jump ALU Data in Data out RB Data in Clock 00 Program counter This way, ‘loops’ can be realized. address 1, address 2, Instruction address 1, address 2, Instruction 00 JMP address 1, address 2, Instruction 54

Conditional Jump ALU Data in Data out RB Data in Clock 00 Program counter ==01 Zero Flag there are multiple of these Flags, each with its own condition address 1, address 2, Instruction address 1, address 2, Instruction BREQ

Conditional Jump ALU Data in Data out RB Data in Clock 00 Program counter ==01 Zero Flag there are multiple of these Flags, each with its own condition address 1, address 2, Instruction address 1, address 2, Instruction BREQ

Conditional Jump ALU Data in Data out RB Data in Clock 10 Program counter Data that belongs to this instruction (CP, CPI, SUB and SUBI) is used during the BREQ instruction ==01 Zero Flag address 1, address 2, Instruction address 1, address 2, Instruction 00 BREQ address 1, address 2, Instruction 57

Conditional Jump ALU Data in Data out RB Data in Clock 00 Program counter If Zero Flag == 1 ==01 Zero Flag Data that belongs to this instruction (CP, CPI, SUB and SUBI) is used during the BREQ instruction address 1, address 2, Instruction address 1, address 2, Instruction 00 BREQ address 1, address 2, Instruction 58

Conditional Jump ALU Data in Data out RB Data in Clock 11 Program counter If Zero Flag == 0 ==00 Zero Flag Data that belongs to this instruction (CP, CPI, SUB and SUBI) is used during the BREQ instruction address 1, address 2, Instruction address 1, address 2, Instruction 00 BREQ address 1, address 2, Instruction 59

Processor blockdiagram 60

Assignment Learning objectives – Design an embedded system involving both hardware and software – Implement the system – Test the system 61

Assignment Activities – Weeks 1+2: Tuesday March 15, 2015 – Lecture Philips – Lecture on Cyberphysical Systems – Introduction to the assignment Getting familiar with the Arduino kit and development environment Write a project proposal (deadline, Monday, March 27, 9:00 h.) 62

Assignment Activities – Weeks 3+4: Tuesday March 29, 2015 – Lecture Philips – Presentations by the project group: 20 minutes presentations + 10 minutes questions for each group Start with exectution of the projectplan 63

Assignment Activities – Weeks 3+4: Execution of the projectplan Registration of a demo on a video Submit video to lecturers (deadline Friday, April 8, 23:59 h.) 64

Assignment More information on (also the ‘knight rider’ example) Layout Breadboard 65