6.S078 - Computer Architecture: A Constructive Approach Combinational circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute.

Slides:



Advertisements
Similar presentations
Chapter 2 Instruction Set Principles. Computer Architecture’s Changing Definition 1950s to 1960s: Computer Architecture Course = Computer Arithmetic 1970s.
Advertisements

INSTRUCTION SET ARCHITECTURES
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
Combinational Circuits in Bluespec
Datorteknik ArithmeticCircuits bild 1 Computer arithmetic Somet things you should know about digital arithmetic: Principles Architecture Design.
CS 355 – Programming Languages
COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) Lecturer: Hui Wu Session.
Reasons to study concepts of PL
Computer Science 1620 Programming & Problem Solving.
Implementation of a Stored Program Computer
The Processor Data Path & Control Chapter 5 Part 1 - Introduction and Single Clock Cycle Design N. Guydosh 2/29/04.
Constructive Computer Architecture Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology 6.175: L01 – September 3,
Constructive Computer Architecture Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology 6.S195: L01 – September.
Games and Simulations O-O Programming in Java The Walker School
ITEC 352 Lecture 11 ISA - CPU. ISA (2) Review Questions? HW 2 due on Friday ISA –Machine language –Buses –Memory.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
December 10, 2009 L29-1 The Semantics of Bluespec Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute.
ECE 2372 Modern Digital System Design
Computer Architecture: A Constructive Approach Sequential Circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Cosc 2150: Computer Organization
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Constructive Computer Architecture Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology 6.175: L01 – September 9,
1 CS232: Computer Architecture II Fall 2011 Intel i7 Quad-core.
Constructive Computer Architecture Combinational circuits-2 Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
6.S078 - Computer Architecture: A Constructive Approach Introduction to SMIPS Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHSIC Hardware Description Language  Required Reading: –These Slides –VHDL Tutorial  Very High Speed.
Electrical and Computer Engineering University of Cyprus LAB 1: VHDL.
Discussed in class and on Fridays n FSMs (only synchronous, with asynchronous reset) –Moore –Mealy –Rabin-Scott n Generalized register: –With D FFs, –With.
Constructive Computer Architecture Combinational circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 19 & 20 Instruction Formats PDP-8,PDP-10,PDP-11 & VAX Course Instructor: Engr. Aisha Danish.
Computer Architecture 2 nd year (computer and Information Sc.)
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Computer Architecture: A Constructive Approach Combinational ALU Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
1 One Dimensional Arrays Chapter 11 2 "All students to receive arrays!" reports Dr. Austin. Declaring arrays scores :
Constructive Computer Architecture Sequential Circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology
SWE 4743 Abstraction Richard Gesick. CSE Abstraction the mechanism and practice of abstraction reduces and factors out details so that one can.
Verilog hdl – II.
Constructive Computer Architecture Combinational circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
1 CS232: Computer Architecture II Fall 2010 AMD dual-core Opteron.
Introduction to Verilog. Data Types A wire specifies a combinational signal. – Think of it as an actual wire. A reg (register) holds a value. – A reg.
Constructive Computer Architecture Sequential Circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology September.
Constructive Computer Architecture Sequential Circuits - 2 Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Prof. Necula CS 164 Lecture 171 Operational Semantics of Cool ICOM 4029 Lecture 10.
Introduction to Verilog. Structure of a Verilog Program A Verilog program is structured as a set of modules, which may represent anything from a collection.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Computer Architecture: A Constructive Approach Combinational circuits Teacher: Yoav Etsion Teaching Assistant: Yuval H. Nacson Taken (with permission)
Multiple Clock Domains (MCD) Arvind with Nirav Dave Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology.
Somet things you should know about digital arithmetic:
Sequential Circuits - 2 Constructive Computer Architecture Arvind
Sequential Circuits Constructive Computer Architecture Arvind
Combinational ALU Constructive Computer Architecture Arvind
Combinational circuits-2
Combinational Circuits in Bluespec
Combinational circuits
Constructive Computer Architecture
BSV objects and a tour of known BSV problems
Combinational circuits
Introduction to Verilog
Combinational circuits
Sequential Circuits - 2 Constructive Computer Architecture Arvind
ECE 352 Digital System Fundamentals
CPU Structure CPU must:
Combinational ALU 6.S078 - Computer Architecture:
COE 202 Introduction to Verilog
Presentation transcript:

6.S078 - Computer Architecture: A Constructive Approach Combinational circuits Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L1-1 February 8, 2012

Course Staff  Instructors  Arvind   Joel Emer   Li-Shiuan Peh   Sally Lee   Myron King   Abhinav Agarwal   Teaching Assistants  Administration

Computing Devices Then… EDSAC, University of Cambridge, UK, 1949 L01-3http://csg.csail.mit.edu/6.S078 February 8, 2012

Computing Devices Now Dramatic progress in terms of size, speed, cost, reliability L February 8, 2012

Computer architecture is about designing machines to meet some power, performance, cost and size constraints February 8, 2012L1-5

The basics: How does a program execute on hardware A C program to add two arrays: The hardware must know, for example, How to add and compare two numbers Must have a place to keep the program and data Must know how to fetch instructions and data Must know how to sequence instructions:  Fetch a[i], Fetch b[i], add, store results in c[i], increment i, … void vvadd( int n, int a[], int b[], int c[] ) { int i; for ( i = 0; i < n; i++ ) c[i] = a[i] + b[i]; } L1-6http://csg.csail.mit.edu/6.S078 February 8, 2012

L1-7 Computer Architecture is learning about how programs execute and designing hardware to execute them efficiently

Instruction Set Architecture (ISA) Computer architecture is the discipline of designing and implementing interfaces through which hardware and software interact This interface is often referred to as the Instruction Set Architecture (ISA) Examples: Intel’s IA-32, ARM, ARM-Thumb, PowerPC In this class we will use SMIPS, a subset of MIPS ISA Implementations are deeply affected by the technology issues; we will assume a simple and abstract model of technology based on Silicon L1-8http://csg.csail.mit.edu/6.S078 February 8, 2012

Computer Architecture February 8, 2012 L1-9http://csg.csail.mit.edu/6.S078 A method of constructing machines: Machine descriptions which can be simulated in software and synthesized into hardware Quantitative evaluation: To what extent designs meet various design criteria Testing and verification: Does the machine do what it is supposed to do

The goals of this subject Learn a constructive approach to studying computer architecture Learn a new method of describing architectures where there is less emphasis on figures/diagrams and more emphasis on executable descriptions Each architecture and each part of it would be defined as executable code in Bluespec Learn about test benches, including designing your own Learn about quantitative evaluation of your designs L1-10http://csg.csail.mit.edu/6.S078 February 8, 2012

L By the end-of-the-term you will design six or more different computers of increasing complexity and performance, and you will quantitatively evaluate the performance of your C programs on these machines

All the designs you do in this course can be implemented on FPGAs or realized as ASICs without significant additional effort. However, lack of time won’t permit us to explore this aspect. February 8, 2012L1-12

Arithmetic-Logic Unit (ALU) ALU performs all the arithmetic and logical functions Op - Add, Sub,... - And, Or, Xor, Not,... - GT, LT, EQ, Zero,...  Result Comp? A B ALU L1-13http://csg.csail.mit.edu/6.S078 February 8, 2012 We will first implement individual functions and then combine them to form an ALU

Full Adder: A one-bit adder function fa(a, b, c_in); s = (a ^ b)^ c_in; c_out = (a & b) | (c_in & (a ^ b)); return {c_out,s}; endfunction Structural code – only specifies interconnection between boxes L1-14http://csg.csail.mit.edu/6.S078 February 8, 2012 Not quite correct – needs type annotations

Full Adder: A one-bit adder corrected function Bit#(2) fa(Bit#(1) a, Bit#(1) b, Bit#(1) c_in); Bit#(1) s = (a ^ b)^ c_in; Bit#(1) c_out = (a & b) | (c_in & (a ^ b)); return {c_out,s}; endfunction Bit#(1) a declaration says that a is one bit wide {c_out,s} represents bit concatenation How big is {c_out,s} ? 2 bits L1-15http://csg.csail.mit.edu/6.S078 February 8, 2012

Types Every expression and variable in a Bluespec program has a type; sometimes it is specified explicitly and sometimes it is deduced by the compiler A type is a grouping of values: Integer: 1, 2, 3, … Bool: True, False Bit : 0,1 A pair of Integers: Tuple2#(Integer, Integer) A function fname from Integers to Integers: function Integer fname (Integer arg) Thus we say an expression has a type or belongs to a type The type of each expression is unique L1-16http://csg.csail.mit.edu/6.S078 February 8, 2012

Type declaration versus deduction The programmer writes down types of some expressions in a program and the compiler deduces the types of the rest of expressions If the type deduction cannot be performed or the type declarations are inconsistent then the compiler complains function Bit#(2) fa(Bit#(1) a, Bit#(1) b, Bit#(1) c_in); Bit#(1) s = (a ^ b)^ c_in; Bit#(2) c_out = (a & b) | (c_in & (a ^ b)); return {c_out,s}; endfunction type error Type checking prevents lots of silly mistakes L1-17http://csg.csail.mit.edu/6.S078 February 8, 2012

2-bit Ripple-Carry Adder function Bit#(3) add(Bit#(2) x, Bit#(2) y, Bit#(1) c0); Bit#(2) s = 0; Bit#(3) c; c[0] = c0; let cs0 = fa(x[0], y[0], c[0]); c[1] = cs0[1]; s[0] = cs0[0]; let cs1 = fa(x[1], y[1], c[1]); c[2] = cs1[1]; s[1] = cs1[0]; return {c[2],s}; endfunction fa x[0] y[0] c[0] s[0] x[1] y[1] c[1] s[1] c[2] fa is like a blackbox, its internals are not visible to the user. fa can be used as long as we understand its type signature L1-18http://csg.csail.mit.edu/6.S078 February 8, 2012

“let” syntax The “let” syntax: avoids having to write down types explicitly let cs0 = fa(x[0], y[0], c[0]); Bits#(2) cs0 = fa(x[0], y[0], c[0]); The same L1-19http://csg.csail.mit.edu/6.S078 February 8, 2012

Parameterized types: # A type declaration itself can be parameterized – the parameters are indicated by using the syntax ‘#’ For example Bit#(n) represents n bits and can be instantiated by specifying a value of n Bit#(1), Bit#(32), Bit#(8), … L1-20http://csg.csail.mit.edu/6.S078 February 8, 2012

An w-bit Ripple-Carry Adder function Bit#(w+1) addN(Bit#(w) x, Bit#(w) y, Bit#(1) c0); Bit#(w) s; Bit#(w+1) c; c[0] = c0; for(Integer i=0; i<w; i=i+1) begin let cs = fa(x[i],y[i],c[i]); c[i+1] = cs[1]; s[i] = cs[0]; end return {c[w],s}; endfunction Not quite correct // concrete instances of addN! function Bit#(33) add32(Bit#(32) x, Bit#(32) y, Bit#(1) c0) = addN(x,y,c0); function Bit#(4) add3(Bit#(3) x, Bit#(3) y, Bit#(1) c0) = addN(x,y,c0); L1-21http://csg.csail.mit.edu/6.S078 February 8, 2012

valueOf(w) versus w Each expression has a type and a value and these come from two entirely disjoint worlds n in Bit#(n) resides in the types world Sometimes we need to use values from the types world into actual computation. The function valueOf allows us to do that Thus i<w is not type correct i<valueOf(w) is type correct L1-22http://csg.csail.mit.edu/6.S078 February 8, 2012

TAdd#(w,1) versus w+1 Sometimes we need to perform operations in the types world that are very similar to the operations in the value world Examples: Add, Mul, Log We define a few special operators in the types space for such operations Examples: TAdd#(m,n), TMul#(m,n), … L1-23http://csg.csail.mit.edu/6.S078 February 8, 2012

A w-bit Ripple-Carry Adder corrected function Bit#(TAdd#(w,1)) addN(Bit#(w) x, Bit#(w) y, Bit#(1) c0); Bit#(w) s; Bit#(TAdd#(w,1)) c; c[0] = c0; let valw = valueOf(w); for(Integer i=0; i<valw; i=i+1) begin let cs = fa(x[i],y[i],c[i]); c[i+1] = cs[1]; s[i] = cs[0]; end return {c[valw],s}; endfunction L1-24http://csg.csail.mit.edu/6.S078 February 8, 2012

Integer versus Int#(32) In mathematics integers are unbounded but in computer systems integers always have a fixed size Bluespec allows us to express both types of integers, though unbounded integers are used only as a programming convenience for(Integer i=0; i<valw; i=i+1) begin let cs = fa(x[i],y[i],c[i]); c[i+1] = cs[1]; s[i] = cs[0]; end L1-25http://csg.csail.mit.edu/6.S078 February 8, 2012

Static Elaboration phase When Bluespec program are compiled, first type checking is done and then the compiler gets rid of many different constructs which have no direct hardware meaning, like Integers, loops cs0 = fa(x[0], y[0], c[0]); c[1]=cs0[1]; s[0]=cs0[0]; cs1 = fa(x[1], y[1], c[1]); c[2]=cs1[1]; s[1]=cs1[0]; … csw = fa(x[valw-1], y[valw-1], c[valw-1]); c[valw] = csw[1]; s[valw-1] = csw[0]; for(Integer i=0; i<valw; i=i+1) begin let cs = fa(x[i],y[i],c[i]); c[i+1] = cs[1]; s[i] = cs[0]; end L1-26http://csg.csail.mit.edu/6.S078 February 8, 2012