Scaling Program Synthesis by Exploiting Existing Code

Size: px
Start display at page:

Download "Scaling Program Synthesis by Exploiting Existing Code"

Transcription

1 Scaling Program Synthesis by Exploiting Existing Code James Bornholt Emina Torlak University of Washington

2 Synthesis: write programs automatically Syntax Semantics

3 Synthesis: write programs automatically Syntax Semantics

4 Synthesis: write programs automatically Target Behavior f(x) =4x +1 Syntax Semantics

5 Synthesis: write programs automatically 4*x + 1 Target Behavior f(x) =4x +1 Syntax Semantics

6 Synthesis: write programs automatically 4*x + 1 (x<<2) + 1 Target Behavior f(x) =4x +1 x + x + x + x + 1 Syntax Semantics

7 Synthesis: write programs automatically Target Behavior Permutation(L, f(l)) ^ Sorted(f(L)) Syntax Semantics

8 Synthesis: write programs automatically Quicksort Target Behavior Permutation(L, f(l)) ^ Sorted(f(L)) Bubble Sort Syntax Semantics

9 The success of synthesis End-user programming by example [FlashFill, POPL 11] Cache coherence protocols [Transit, PLDI 13] Parallel browser layout engines [PPoPP 13] Compilers for new spatial architectures [Chlorophyll, PLDI 14]

10 The success of synthesis End-user programming by example [FlashFill, POPL 11] Cache coherence protocols Synthesis [Transit, PLDI 13] turns high-level intent Parallel browser layout into engines [PPoPP 13] low-level detail Compilers for new spatial architectures [Chlorophyll, PLDI 14]

11 The success of synthesis End-user programming by example [FlashFill, POPL 11] Approximate Computing quality bounds into approximate programs Cache coherence protocols Synthesis [Transit, PLDI 13] turns high-level intent Parallel browser layout into engines [PPoPP 13] low-level detail Compilers for new spatial architectures [Chlorophyll, PLDI 14]

12 The success of synthesis End-user programming by example [FlashFill, POPL 11] Cache coherence protocols Synthesis [Transit, PLDI 13] turns high-level intent Parallel browser layout into engines [PPoPP 13] low-level detail Compilers for new spatial architectures [Chlorophyll, PLDI 14] Approximate Computing quality bounds into approximate programs Hardware Synthesis programs into hardware designs

13 The success of synthesis End-user programming by example [FlashFill, POPL 11] Cache coherence protocols Synthesis [Transit, PLDI 13] turns high-level intent Parallel browser layout into engines [PPoPP 13] low-level detail Compilers for new spatial architectures [Chlorophyll, PLDI 14] Approximate Computing quality bounds into approximate programs Hardware Synthesis programs into hardware designs Black Box Systems observed behaviors into specifications

14 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy

15 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy

16 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Video and image quality

17 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Video and image quality Sensors and simulation Machine learning

18 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Precise Implementation

19 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Precise Implementation Desired Quality

20 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Precise Implementation Approximate Compiler Desired Quality

21 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Precise Implementation Approximate Compiler Approximate Program Desired Quality

22 Approximate Computing quality bounds into approximate programs Not all applications require perfect accuracy Precise Implementation Desired Quality Approximate Program Synthesis Approximate Program Bornholt, Torlak, Ceze, Grossman. Approximate Program Synthesis. At WAX 15, collocated with PLDI 15.

23 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages

24 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages module example(input a, b, c, output y); assign y = ~a & ~b & ~c a & ~b & ~c a & ~b & c; endmodule

25 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages module example(input a, b, c, output y); assign y = ~a & ~b & ~c a & ~b & ~c a & ~b & c; endmodule

26 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages module example(input a, b, c, output y); assign y = ~a & ~b & ~c a & ~b & ~c a & ~b & c; endmodule

27 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages High-Level Synthesis (HLS)

28 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages Place and route Timing closure High-Level Synthesis (HLS) Crosstalk and feedback Quantum!

29 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages Mark Wyse UW grad student and HLS extraordinaire

30 Hardware Synthesis programs into hardware designs Synthesizing circuits from high-level languages Mark Wyse UW grad student and HLS extraordinaire float dist(float a[3], float b[3]) { float r = 0; r += (a[0] - b[0]) * (a[0] - b[0]); r += (a[1] - b[1]) * (a[1] - b[1]); r += (a[2] - b[2]) * (a[2] - b[2]); return sqrt(r); }

31 Black Box Systems observed behaviors into specifications Defining system behavior by observation

32 Black Box Systems observed behaviors into specifications Defining system behavior by observation

33 Black Box Systems observed behaviors into specifications Defining system behavior by observation

34 Black Box Systems observed behaviors into specifications Defining system behavior by observation

35 Black Box Systems observed behaviors into specifications Defining system behavior by observation Programming by example

36 Black Box Systems observed behaviors into specifications Defining system behavior by observation Programming by example Synthesizing x86 instruction specs Godefroid and Taly. Automated Synthesis of Symbolic Instruction Encodings from I/O Samples. PLDI 12.

37 Approximate Computing quality bounds into approximate programs Hardware Synthesis programs into hardware designs Black Box Systems observed behaviors into specifications

38 Machine Learning and Synthesis

39 Learning programs from examples Black Box Systems observed behaviors into specifications 9P. ^ x i 2X '(x i,p(x i ))

40 Learning programs from examples Black Box Systems observed behaviors into specifications 9P. ^ x i 2X '(x i,p(x i )) FlashFill

41 Learning programs from examples FlashFill Version Space Algebra

42 Machine learning and synthesis Program Synthesis Statistical Machine Learning

43 Machine learning and synthesis Millions of examples/parameters Program Synthesis Statistical Machine Learning

44 Machine learning and synthesis 100 instructions Millions of examples/parameters Program Synthesis Statistical Machine Learning

45 Machine learning and synthesis Approximate Computing Hardware Synthesis Black Box Systems 100 instructions Millions of examples/parameters Program Synthesis Statistical Machine Learning

46 Machine learning and synthesis Approximate Computing Hardware Synthesis Black Box Systems 100 instructions Millions of examples/parameters Program Synthesis Statistical Machine Learning

47 Programs are not uniformly distributed.

48 Programs are not uniformly distributed Stack Overflow mentions malloc longjmp

49 Programs are not uniformly distributed Stack Overflow mentions malloc longjmp

50 Programs are not uniformly distributed Stack Overflow mentions malloc longjmp

51 Programs are not uniformly distributed. Stack Overflow mentions malloc longjmp mov call push mov call test jmp lea push sub

52 Component-Based Synthesis

53 Synthesis of Loop-Free Programs Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

54 Synthesis of Loop-Free Programs f(x, y) = x + y 2 Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

55 Synthesis of Loop-Free Programs f(x, y) = x + y 2 and xor add >> 1 Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

56 Synthesis of Loop-Free Programs f(x, y) = x + y 2 and xor add >> 1 x y Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

57 Synthesis of Loop-Free Programs f(x, y) = x + y 2 and xor add >> 1 x y f(x,y) Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

58 Synthesis of Loop-Free Programs f(x, y) = x + y 2 x y xor and >> 1 add f(x,y) Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

59 Synthesis of Loop-Free Programs f(x, y) = x + y 2 and xor add >> 1 Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11.

60 Synthesis of Loop-Free Programs f(x, y) = x + y 2 and xor add >> 1 sub div rem or not mul udiv urem nand neg << 1 >>> 1 << 2 eq le ge lt Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11. gt

61 Synthesis of Loop-Free Programs f(x, y) = x + y 2 and xor add >> sub mul Solving time (secs) div udiv rem urem or nand not neg << 1 >>> Number of components << 2 eq le ge lt Gulwani, Jha, Tiwari, and Venkatesan. Synthesis of loop-free programs. PLDI 11. gt

62 lt gt Higher-level components f(l) =min{l i l i 2 L} and xor add >> 1 sub div rem or not mul udiv urem nand neg << 1 >>> 1 << 2 eq le ge

63 Higher-level components f(l) =min{l i l i 2 L}

64 Higher-level components f(l) =min{l i l i 2 L} quicksort 0 [ ]

65 Higher-level components f(l) =min{l i l i 2 L} f(l) = quicksort(l)[0] quicksort 0 [ ]

66 Higher-level components f(l) =min{l i l i 2 L} f(l) = quicksort(l)[0] quicksort 0 [ ] Mine existing code bases for common idioms

67 Higher-level components f(l) =min{l i l i 2 L} f(l) = quicksort(l)[0] quicksort 0 [ ] Mine existing code bases for common idioms Hardware Synthesis programs into hardware designs

68 Producing candidate programs f(x, y) = x + y 2 and xor add >> 1 x y f(x,y)

69 Producing candidate programs f(x, y) = x + y 2 xor add >> 1 x y and

70 Producing candidate programs f(x, y) = x + y 2 xor add >> 1 x y and mov call mov call test jmp lea push push sub

71 Producing candidate programs f(x, y) = x + y 2 xor add >> 1 x y and mov call mov call test jmp lea push push sub Learn search heuristics from existing code

72 Producing candidate programs f(x, y) = x + y 2 xor add >> 1 x y and mov call mov call test jmp lea push Learn search heuristics from existing code push sub Programming by example [FlashFill, POPL 11] Autocomplete with synthesis [CodeHint, ICSE 14]

73 Producing candidate programs f(x, y) = x + y 2 xor add >> 1 x y and Mine existing code bases for common idioms Learn search heuristics from existing code mov call push mov call test jmp lea push sub Programming by example [FlashFill, POPL 11] Autocomplete with synthesis [CodeHint, ICSE 14]

74 Producing candidate programs Mine existing code bases for common idioms Learn search heuristics from existing code Black Box Systems observed behaviors into specifications Selecting among many candidate solutions

75 Sketch-Based Synthesis

76 Sketches make synthesis more tractable

77 Sketches make synthesis more tractable bit[w] popcount(bit[w] x) { x = (x & 0x5555) + ((x >> 1) & 0x5555); x = (x & 0x3333) + ((x >> 2) & 0x3333); x = (x & 0x0077) + ((x >> 8) & 0x0077); x = (x & 0x000F) + ((x >> 4) & 0x000F); return x; }

78 Sketches make synthesis more tractable bit[w] popcount(bit[w] x) { x = (x & 0x5555) + ((x >> 1) & 0x5555); x = (x & 0x3333) + ((x >> 2) & 0x3333); x = (x & 0x0077) + ((x >> 8) & 0x0077); x = (x & 0x000F) + ((x >> 4) & 0x000F); return x; } bit[w] popsketched(bit[w] x) { loop (??) { x = (x &??) + ((x >>??) &??); } return x; }

79 Sketches make synthesis more tractable bit[w] popsketched(bit[w] x) { loop (??) { x = (x &??) + ((x >>??) &??); } return x; }

80 Sketches make synthesis more tractable bit[w] popsketched(bit[w] x) { loop (??) { x = (x &??) + ((x >>??) &??); } return x; } int[] map(int[] xs) { int[] ys = {}; for (int i=0; i<xs.length; i++) { ys.append(??(xs[i])); } return ys; int[] foldl(int[] xs) { int acc =??; for (int i=0; i<xs.length; i++) { acc =??(acc, xs[i]); } return ys; } } int[] filter(int[] xs) { int[] ys = {}; for (int i=0; i<xs.length; i++) { if (??(xs[i])) ys.append(xs[i]); } }

81 Sketches make synthesis more tractable Identify common sketches from existing code

82 Sketches make synthesis more tractable Mine existing code bases for common idioms Identify common sketches from existing code

83 Sketches make synthesis more tractable Mine existing code bases for common idioms Identify common sketches from existing code Approximate Computing quality bounds into approximate programs

84 Sketches make synthesis more tractable Mine existing code bases for common idioms Identify common sketches from existing code Approximate Computing quality bounds into approximate programs Precise Implementation Approximate Program Synthesis

85 Approximate Computing Hardware Synthesis Black Box Systems Program Synthesis Statistical Machine Learning

86 Approximate Computing Hardware Synthesis Black Box Systems Program Synthesis Statistical Machine Learning

87 Approximate Computing Hardware Synthesis Black Box Systems Program Synthesis Statistical Machine Learning Thanks!

Approximate Program Synthesis

Approximate Program Synthesis Approximate Program Synthesis James Bornholt Emina Torlak Luis Ceze Dan Grossman University of Washington Writing approximate programs is hard Precise Implementation Writing approximate programs is hard

More information

Optimizing Synthesis with Metasketches

Optimizing Synthesis with Metasketches Optimizing Synthesis Artifact with Metasketches * POPL * Consistent * Complete * Well Documented * Easy to Reuse * Evaluated * AEC * James Bornholt Emina Torlak Dan Grossman Luis Ceze University of Washington

More information

Synthesis-Aided Compiler for Low-Power Spatial Architectures

Synthesis-Aided Compiler for Low-Power Spatial Architectures Synthesis-Aided Compiler for Low-Power Spatial Architectures Phitchaya Mangpo Phothilimthana, Tikhon Jelvis, Rohin Shah, Nishant Totla, Sarah Chasins, and Ras Bodik 2 unusual ISA small memory narrow bitwidth

More information

Synthesizing Memory Models

Synthesizing Memory Models Synthesizing Memory Models from Framework Sketches and Litmus Tests James Bornholt Emina Torlak University of Washington Memory consistency models define memory reordering behaviors on mul>processors Memory

More information

Virtual Machine Tutorial

Virtual Machine Tutorial Virtual Machine Tutorial CSA2201 Compiler Techniques Gordon Mangion Virtual Machine A software implementation of a computing environment in which an operating system or program can be installed and run.

More information

Course Overview CS294: Program Synthesis for Everyone

Course Overview CS294: Program Synthesis for Everyone Course Overview CS294: Program Synthesis for Everyone Ras Bodik Emina Torlak Division of Computer Science University of California, Berkeley The name of the course this CS294 topics course has been listed

More information

Synthesis and Verification for All Emina Torlak

Synthesis and Verification for All Emina Torlak Synthesis and Verification for All Emina Torlak University of Washington emina@cs.washington.edu homes.cs.washington.edu/~emina/ Emina Racket Racket a programmable programming language Racket a programmable

More information

EECS 219C: Formal Methods Syntax-Guided Synthesis (selected/adapted slides from FMCAD 13 tutorial by R. Alur) Sanjit A. Seshia EECS, UC Berkeley

EECS 219C: Formal Methods Syntax-Guided Synthesis (selected/adapted slides from FMCAD 13 tutorial by R. Alur) Sanjit A. Seshia EECS, UC Berkeley EECS 219C: Formal Methods Syntax-Guided Synthesis (selected/adapted slides from FMCAD 13 tutorial by R. Alur) Sanjit A. Seshia EECS, UC Berkeley Solving SyGuS Is SyGuS same as solving SMT formulas with

More information

S3.0 : A multicore 32-bit Processor

S3.0 : A multicore 32-bit Processor S3.0 : A multicore 32-bit Processor S3.0 is a multicore version of S2.1 simple processor. This is a typical simple 32-bit processor. It has three-address instructions and 32 registers. Most operations

More information

Intermediate Representations

Intermediate Representations Intermediate Representations A variety of intermediate representations are used in compilers Most common intermediate representations are: Abstract Syntax Tree Directed Acyclic Graph (DAG) Three-Address

More information

CSC410 Program Synthesis AZADEH FARZAN FALL 2017

CSC410 Program Synthesis AZADEH FARZAN FALL 2017 CSC410 Program Synthesis AZADEH FARZAN FALL 2017 The idea Produce small code fragments that satisfy the given specification As a programming aid: It helps you write programs. The insight is yours, the

More information

CS222: Processor Design

CS222: Processor Design CS222: Processor Design Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Previous Class: Floating points: Add, Sub, Mul,Div, Rounding Processor Design: Introduction

More information

Postscript Control Flow

Postscript Control Flow Postscript Control Flow CSE 413, Autumn 2005 Programming Languages http://www.cs.washington.edu/education/courses/413/05au/ Variables Postscript uses dictionaries to associate a name with an object value»

More information

Practical Malware Analysis

Practical Malware Analysis Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the

More information

Project 3 Due October 21, 2015, 11:59:59pm

Project 3 Due October 21, 2015, 11:59:59pm Project 3 Due October 21, 2015, 11:59:59pm 1 Introduction In this project, you will implement RubeVM, a virtual machine for a simple bytecode language. Later in the semester, you will compile Rube (a simplified

More information

Program Synthesis in Reverse Engineering

Program Synthesis in Reverse Engineering Program Synthesis in Reverse Engineering Rolf Rolles Möbius Strip Reverse Engineering http://www.msreverseengineering.com No Such Conference Keynote Speech November 19th, 2014 Program Synthesis in Reverse

More information

Program Synthesis for Forth Forth Day 2012

Program Synthesis for Forth Forth Day 2012 Program Synthesis for Forth Forth Day 2012 Computer Science UC Berkeley Ras Bodik Mangpo Phitchaya Phothilimthana Tikhon Jelvis Rohin Shah Synthesis with sketches Extend your language with two constructs

More information

Program Synthesis for Forth Forth Day 2012

Program Synthesis for Forth Forth Day 2012 Program Synthesis for Forth Forth Day 2012 Computer Science UC Berkeley Ras Bodik Mangpo Phitchaya Phothilimthana Tikhon Jelvis Rohin Shah Synthesis with sketches Extend your language with two constructs

More information

Talen en Compilers. Johan Jeuring , period 2. December 15, Department of Information and Computing Sciences Utrecht University

Talen en Compilers. Johan Jeuring , period 2. December 15, Department of Information and Computing Sciences Utrecht University Talen en Compilers 2016-2017, period 2 Johan Jeuring Department of Information and Computing Sciences Utrecht University December 15, 2016 9 Simple stack machine 9-1 Recap: Semantic functions In the previous

More information

Abstractions and small languages in synthesis CS294: Program Synthesis for Everyone

Abstractions and small languages in synthesis CS294: Program Synthesis for Everyone Abstractions and small languages in synthesis CS294: Program Synthesis for Everyone Ras Bodik Emina Torlak Division of Computer Science University of California, Berkeley Today Today: we describe why high-level

More information

Type- & Example-Driven Program Synthesis. Steve Zdancewic WG 2.8, August 2014

Type- & Example-Driven Program Synthesis. Steve Zdancewic WG 2.8, August 2014 Type- & Example-Driven Program Synthesis Steve Zdancewic WG 2.8, August 2014 Joint work with Peter-Michael Osera CAVEATS Work in progress Similar work been done before This is our attempt to understand

More information

Compiling a Gesture Recognition Application for an Ultra Low-Power Architecture

Compiling a Gesture Recognition Application for an Ultra Low-Power Architecture Compiling a Gesture Recognition Application an Ultra Low-Power Architecture Phitchaya Mangpo Phothilimthana Michael Schuldt Rastislav Bodik Classification Applications sensor data computation Intensive

More information

CISC324: Operating Systems. Assignment 1

CISC324: Operating Systems. Assignment 1 SCHOOL OF COMPUTING, QUEEN S UNIVERSITY CISC324: Operating Systems Assignment 1 due Tuesday, Jan 22 at the 10:30 lecture January 5, 2019 Student Full Name: Student Number: Group Number: 1 1 COMPUTER ARCHITECTURE

More information

PROGRAMMING IN HASKELL. CS Chapter 6 - Recursive Functions

PROGRAMMING IN HASKELL. CS Chapter 6 - Recursive Functions PROGRAMMING IN HASKELL CS-205 - Chapter 6 - Recursive Functions 0 Introduction As we have seen, many functions can naturally be defined in terms of other functions. factorial :: Int Int factorial n product

More information

Compiler Theory. (Semantic Analysis and Run-Time Environments)

Compiler Theory. (Semantic Analysis and Run-Time Environments) Compiler Theory (Semantic Analysis and Run-Time Environments) 005 Semantic Actions A compiler must do more than recognise whether a sentence belongs to the language of a grammar it must do something useful

More information

SOURCE LANGUAGE DESCRIPTION

SOURCE LANGUAGE DESCRIPTION 1. Simple Integer Language (SIL) SOURCE LANGUAGE DESCRIPTION The language specification given here is informal and gives a lot of flexibility for the designer to write the grammatical specifications to

More information

Announcements. Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project

Announcements. Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project - Fall 2002 Lecture 20 Synthesis Sequential Logic Announcements Midterm 2 next Thursday, 6-7:30pm, 277 Cory Review session on Tuesday, 6-7:30pm, 277 Cory Homework 8 due next Tuesday Labs: project» Teams

More information

Programming by Examples: Applications, Algorithms, and Ambiguity Resolution

Programming by Examples: Applications, Algorithms, and Ambiguity Resolution Programming by Examples: Applications, Algorithms, and Ambiguity Resolution Sumit Gulwani Microsoft Corporation, Redmond, WA, USA sumitg@microsoft.com Abstract. 99% of computer end users do not know programming,

More information

Growing Solver-Aided Languages with ROSETTE

Growing Solver-Aided Languages with ROSETTE Growing Solver-Aided Languages with ROSETTE Emina Torlak & Rastislav Bodik U.C. Berkeley ExCAPE June 10, 2013 solver-aided domain-specific language Solver-aided DSL (SDSL) Noun 1. A high-level language

More information

Betriebssysteme und Sicherheit Sicherheit. Buffer Overflows

Betriebssysteme und Sicherheit Sicherheit. Buffer Overflows Betriebssysteme und Sicherheit Sicherheit Buffer Overflows Software Vulnerabilities Implementation error Input validation Attacker-supplied input can lead to Corruption Code execution... Even remote exploitation

More information

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8]

1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] Code No: R05311201 Set No. 1 1. (a) What are the closure properties of Regular sets? Explain. (b) Briefly explain the logical phases of a compiler model. [8+8] 2. Compute the FIRST and FOLLOW sets of each

More information

Quiz 2 CSCI 1103 Computer Science I Honors KEY. Tuesday November 8, 2016 Instructor Muller Boston College. Fall 2016

Quiz 2 CSCI 1103 Computer Science I Honors KEY. Tuesday November 8, 2016 Instructor Muller Boston College. Fall 2016 Quiz 2 CSCI 1103 Computer Science I Honors KEY Tuesday November 8, 2016 Instructor Muller Boston College Fall 2016 Please do not write your name on the top of this quiz. Before reading further, please

More information

Digital Design with FPGAs. By Neeraj Kulkarni

Digital Design with FPGAs. By Neeraj Kulkarni Digital Design with FPGAs By Neeraj Kulkarni Some Basic Electronics Basic Elements: Gates: And, Or, Nor, Nand, Xor.. Memory elements: Flip Flops, Registers.. Techniques to design a circuit using basic

More information

Computer Organization

Computer Organization Computer Organization (Instruction set Architecture & Assembly Language Programming) KR Chowdhary Professor & Head Email: kr.chowdhary@gmail.com webpage: krchowdhary.com Department of Computer Science

More information

Midterm 2. CMSC 430 Introduction to Compilers Fall Instructions Total 100. Name: November 21, 2016

Midterm 2. CMSC 430 Introduction to Compilers Fall Instructions Total 100. Name: November 21, 2016 Name: Midterm 2 CMSC 430 Introduction to Compilers Fall 2016 November 21, 2016 Instructions This exam contains 7 pages, including this one. Make sure you have all the pages. Write your name on the top

More information

INFOB3TC Exam 2. Sean Leather. Monday, 30 January 2012, 17:00 20:00

INFOB3TC Exam 2. Sean Leather. Monday, 30 January 2012, 17:00 20:00 Department of Information and Computing Sciences Utrecht University INFOB3TC Exam 2 Sean Leather Monday, 30 January 2012, 17:00 20:00 1 Preliminaries The exam consists of 8 pages (including this page).

More information

PRESENTED BY: SANTOSH SANGUMANI & SHARAN NARANG

PRESENTED BY: SANTOSH SANGUMANI & SHARAN NARANG PRESENTED BY: SANTOSH SANGUMANI & SHARAN NARANG Table of contents Introduction Binary Disassembly Return Address Defense Prototype Implementation Experimental Results Conclusion Buffer Over2low Attacks

More information

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering Verilog Fundamentals Shubham Singh Junior Undergrad. Electrical Engineering VERILOG FUNDAMENTALS HDLs HISTORY HOW FPGA & VERILOG ARE RELATED CODING IN VERILOG HDLs HISTORY HDL HARDWARE DESCRIPTION LANGUAGE

More information

Automation in Cryptology

Automation in Cryptology Automation in Cryptology Ashish Tiwari Abstract Inspired by the recent work on sketching-based synthesis of programs [SLRBE05, SLTB + 06], we have developed a language for specifying sketches, or partially

More information

CS251 Programming Languages Handout # 29 Prof. Lyn Turbak March 7, 2007 Wellesley College

CS251 Programming Languages Handout # 29 Prof. Lyn Turbak March 7, 2007 Wellesley College CS5 Programming Languages Handout # 9 Prof. Lyn Turbak March, 00 Wellesley College Postfix: A Simple Stack Language Several exercises and examples in this course will involve the Postfix mini-language.

More information

Projects for Compilers

Projects for Compilers Projects for Compilers 1. Project One: Lexical Analysis (Required) (1) Directions Implement a transition-diagram-based lexical analysis for the programming language TINY. (2) Outputs Source code (implemented

More information

ARM Shift Operations. Shift Type 00 - logical left 01 - logical right 10 - arithmetic right 11 - rotate right. Shift Amount 0-31 bits

ARM Shift Operations. Shift Type 00 - logical left 01 - logical right 10 - arithmetic right 11 - rotate right. Shift Amount 0-31 bits ARM Shift Operations A novel feature of ARM is that all data-processing instructions can include an optional shift, whereas most other architectures have separate shift instructions. This is actually very

More information

NetComplete: Practical Network-Wide Configuration Synthesis with Autocompletion. Ahmed El-Hassany Petar Tsankov Laurent Vanbever Martin Vechev

NetComplete: Practical Network-Wide Configuration Synthesis with Autocompletion. Ahmed El-Hassany Petar Tsankov Laurent Vanbever Martin Vechev NetComplete: Practical Network-Wide Configuration Synthesis with Autocompletion Ahmed El-Hassany Petar Tsankov Laurent Vanbever Martin Vechev I shouldn t be the one giving this talk Third year PhD student

More information

Combining Induction, Deduction and Structure for Synthesis

Combining Induction, Deduction and Structure for Synthesis Combining Induction, Deduction and Structure for Synthesis Sanjit A. Seshia Associate Professor EECS Department UC Berkeley Students: S. Jha, B. Brady, J. Kotker, W.Li Collaborators: R. Bryant, S. Gulwani,

More information

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions) By the end of this course, students should CIS 1.5 Course Objectives a. Understand the concept of a program (i.e., a computer following a series of instructions) b. Understand the concept of a variable

More information

Syntax-Guided Program Synthesis. Rajeev Alur. University of Pennsylvania

Syntax-Guided Program Synthesis. Rajeev Alur. University of Pennsylvania Syntax-Guided Program Synthesis Rajeev Alur University of Pennsylvania 1 Goal: Programming computers easier than communicating with people Can programming be liberated, period. David Harel, IEEE Computer,

More information

Syntax-Guided Program Synthesis. Rajeev Alur

Syntax-Guided Program Synthesis. Rajeev Alur Syntax-Guided Program Synthesis Rajeev Alur University of Pennsylvania 1 Goal: Programming computers easier than communicating with people Can programming be liberated, period. David Harel, IEEE Computer,

More information

Overview of Compiler. A. Introduction

Overview of Compiler. A. Introduction CMPSC 470 Lecture 01 Topics: Overview of compiler Compiling process Structure of compiler Programming language basics Overview of Compiler A. Introduction What is compiler? What is interpreter? A very

More information

Program Graph. Lecture 25: Parallelism & Concurrency. Performance. What does it mean?

Program Graph. Lecture 25: Parallelism & Concurrency. Performance. What does it mean? Program Graph Lecture 25: Parallelism & Concurrency CS 62 Fall 2015 Kim Bruce & Michael Bannister Some slides based on those from Dan Grossman, U. of Washington Program using fork and join can be seen

More information

THEORY OF COMPILATION

THEORY OF COMPILATION Lecture 10 Activation Records THEORY OF COMPILATION EranYahav www.cs.technion.ac.il/~yahave/tocs2011/compilers-lec10.pptx Reference: Dragon 7.1,7.2. MCD 6.3,6.4.2 1 You are here Compiler txt Source Lexical

More information

Program Exploitation Intro

Program Exploitation Intro Program Exploitation Intro x86 Assembly 04//2018 Security 1 Univeristà Ca Foscari, Venezia What is Program Exploitation "Making a program do something unexpected and not planned" The right bugs can be

More information

80C51 Block Diagram. CSE Overview 1

80C51 Block Diagram. CSE Overview 1 80C51 Block Diagram CSE 477 8051 Overview 1 80C51 Memory CSE 477 8051 Overview 3 8051 Memory The data width is 8 bits Registers are 8 bits Addresses are 8 bits i.e. addresses for only 256 bytes! PC is

More information

CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK

CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK Question 1: Choose the most appropriate answer 1. In which of the following gates the output is 1 if and only if all the inputs

More information

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated CNIT 127: Exploit Development Ch 1: Before you begin Updated 1-14-16 Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend, such as Denial

More information

UW CSE 351, Winter 2013 Midterm Exam

UW CSE 351, Winter 2013 Midterm Exam Full Name: Student ID: UW CSE 351, Winter 2013 Midterm Exam February 15, 2013 Instructions: Make sure that your exam is not missing any of the 9 pages, then write your full name and UW student ID on the

More information

6 THE ETRAX Introduction. Special registers. 6 The ETRAX 4

6 THE ETRAX Introduction. Special registers. 6 The ETRAX 4 6 THE ETRAX 4 6.1 Introduction The ETRAX 4 is the processor prior to the ETRAX 1 in the ETRAX family. The differences between the CRIS implementation in the ETRAX 1 and the ETRAX 4 are presented in this

More information

Lecture Code Generation for WLM

Lecture Code Generation for WLM Lecture 17+18 Code Generation for WLM CS 241: Foundations of Sequential Programs Winter 2018 Troy Vasiga et al University of Waterloo 1 Code Generation (A9/A10) Input: Output: Number of different outputs:

More information

Comparison InstruCtions

Comparison InstruCtions Status Flags Now it is time to discuss what status flags are available. These five status flags are kept in a special register called the Program Status Register (PSR). The PSR also contains other important

More information

Solver Aided Reverse Engineering of Architectural Features

Solver Aided Reverse Engineering of Architectural Features Solver Aided Reverse Engineering of Architectural Features Bill Zorn, Dan Grossman, Luis Ceze {billzorn, djg, luisceze}@cs.washington.edu Paul G. Allen School for Computer Science & Engineering University

More information

CS 432 Fall Mike Lam, Professor. Code Generation

CS 432 Fall Mike Lam, Professor. Code Generation CS 432 Fall 2015 Mike Lam, Professor Code Generation Compilers "Back end" Source code Tokens Syntax tree Machine code char data[20]; int main() { float x = 42.0; return 7; } 7f 45 4c 46 01 01 01 00 00

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it

More information

Computer Architecture, EDT030

Computer Architecture, EDT030 Department of Information Technology Computer Architecture, EDT030 Exam, Tuesday, March 7, 2000, 8.00-12.00 am The exam consists of a number of assignments with a total of 100 points. Grading: 40p grade

More information

QLOSE: Program Repair with Quantitative Objectives

QLOSE: Program Repair with Quantitative Objectives QLOSE: Program Repair with Quantitative Objectives Loris D Antoni Roopsha Samanta Rishabh Singh Everyone wants to be a programmer 2 Programming for Everybody (Getting Started with Python) 657,068 An Introduction

More information

Contents. Introduction

Contents. Introduction Contents Preface Introduction xiii xvii 1 Why Did the Chicken Cross the Road? 1 1.1 The Computer.......................... 1 1.2 Turing Machine.......................... 3 CT: Abstract Away......................

More information

Shell CSCE 314 TAMU. Functions continued

Shell CSCE 314 TAMU. Functions continued 1 CSCE 314: Programming Languages Dr. Dylan Shell Functions continued 2 Outline Defining Functions List Comprehensions Recursion 3 A Function without Recursion Many functions can naturally be defined in

More information

Chapter Two MIPS Arithmetic

Chapter Two MIPS Arithmetic Chapter Two MIPS Arithmetic Computer Organization Review Binary Representation Used for all data and instructions Fixed size values: 8, 16, 32, 64 Hexadecimal Sign extension Base and virtual machines.

More information

CD Assignment I. 1. Explain the various phases of the compiler with a simple example.

CD Assignment I. 1. Explain the various phases of the compiler with a simple example. CD Assignment I 1. Explain the various phases of the compiler with a simple example. The compilation process is a sequence of various phases. Each phase takes input from the previous, and passes the output

More information

ECEN 468 Advanced Logic Design

ECEN 468 Advanced Logic Design ECEN 468 Advanced Logic Design Lecture 26: Verilog Operators ECEN 468 Lecture 26 Operators Operator Number of Operands Result Arithmetic 2 Binary word Bitwise 2 Binary word Reduction 1 Bit Logical 2 Boolean

More information

Overview. EE 4504 Computer Organization. Much of the computer s architecture / organization is hidden from a HLL programmer

Overview. EE 4504 Computer Organization. Much of the computer s architecture / organization is hidden from a HLL programmer Overview EE 4504 Computer Organization Section 7 The Instruction Set Much of the computer s architecture / organization is hidden from a HLL programmer In the abstract sense, the programmer should not

More information

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA

SYLLABUS UNIT - I UNIT - II UNIT - III UNIT - IV CHAPTER - 1 : INTRODUCTION CHAPTER - 4 : SYNTAX AX-DIRECTED TRANSLATION TION CHAPTER - 7 : STORA Contents i SYLLABUS UNIT - I CHAPTER - 1 : INTRODUCTION Programs Related to Compilers. Translation Process, Major Data Structures, Other Issues in Compiler Structure, Boot Strapping and Porting. CHAPTER

More information

Lecture 7: Instruction Set Architectures - IV

Lecture 7: Instruction Set Architectures - IV Lecture 7: Instruction Set Architectures - IV Last Time Register organization Memory issues (endian-ness, alignment, etc.) Today Exceptions General principles of ISA design Role of compiler Computer arithmetic

More information

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 Anurag Dwivedi Digital Design : Bottom Up Approach Basic Block - Gates Digital Design : Bottom Up Approach Gates -> Flip Flops Digital

More information

Computer Systems Lecture 9

Computer Systems Lecture 9 Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions

More information

Syntactic Directed Translation

Syntactic Directed Translation Syntactic Directed Translation Translation Schemes Copyright 2016, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California have explicit permission

More information

bit[w] compress(bit[w] x, bit[w] m){ int i=0; bit[w] out = 0; for(int j=0; j<w; ++j){ if(m[j]){ out[i] = x[j]; i = i+1; } } return out; }

bit[w] compress(bit[w] x, bit[w] m){ int i=0; bit[w] out = 0; for(int j=0; j<w; ++j){ if(m[j]){ out[i] = x[j]; i = i+1; } } return out; } Compress The function that we want to sketch is defined as follows. Given an input bit-vector x and a mask m, pack all the bits in x corresponding to 1 s in the mask to the beginning of the word. The specification

More information

SAMPLE CURRICULUM GUIDE June 2014

SAMPLE CURRICULUM GUIDE June 2014 SAMPLE CURRICULUM GUIDE June 2014 A Level Computer Science A LEVEL REFORM CONTENTS Introduction Page 3 Year 1 Page 4 Year 2 Page 8 This resource is an exemplar of the types of materials that will be provided

More information

CSci 450, Org. of Programming Languages. Chapter 12 Expression Language Compilation

CSci 450, Org. of Programming Languages. Chapter 12 Expression Language Compilation CSci 450, Org. of Programming Languages Chapter 12 Expression Language Compilation H. Conrad Cunningham 7 November 2017 Contents 12.1 Chapter Introduction......................... 1 12.2 Stack Virtual

More information

7 Translation to Intermediate Code

7 Translation to Intermediate Code 7 Translation to Intermediate Code ( 7. Translation to Intermediate Code, p. 150) This chpater marks the transition from the source program analysis phase to the target program synthesis phase. All static

More information

Applications of. Program Synthesis (aka, domain-specific search) to End-user Programming & Intelligent Tutoring Systems

Applications of. Program Synthesis (aka, domain-specific search) to End-user Programming & Intelligent Tutoring Systems Applications of Program Synthesis (aka, domain-specific search) to End-user Programming & Intelligent Tutoring Systems Invited Talk @ GECCO (GP Track) 2014 Sumit Gulwani Microsoft Research, Redmond Program

More information

CDS130 Mid-term exam: Sample

CDS130 Mid-term exam: Sample CDS130 : Sample Be sure your exam booklet has 6 pages. Write your name at the top of the front page. This is a closed book exam. You may not use a calculator. You may not use MATLAB during exam except

More information

Syntax-Guided Synthesis. Rajeev Alur. University of Pennsylvania

Syntax-Guided Synthesis. Rajeev Alur. University of Pennsylvania Syntax-Guided Synthesis Rajeev Alur University of Pennsylvania 1 Program Verification Specification S Program P Verifier Proof of correctness or Witness of a bug 2 Classical Program Synthesis Specification

More information

last time Assembly part 2 / C part 1 condition codes reminder: quiz

last time Assembly part 2 / C part 1 condition codes reminder: quiz last time Assembly part 2 / C part 1 linking extras: different kinds of relocations addresses versus offset to addresses dynamic linking (briefly) AT&T syntax destination last O(B, I, S) B + I S + O jmp

More information

On Interactive Synthesis of Code Snippets

On Interactive Synthesis of Code Snippets On Interactive Synthesis of Code Snippets Tihomir Gvero, Viktor Kuncak, and Ruzica Piskac firstname.lastname@epfl.ch Swiss Federal Institute of Technology (EPFL), Switzerland Abstract. We describe a tool

More information

Programming in Omega Part 1. Tim Sheard Portland State University

Programming in Omega Part 1. Tim Sheard Portland State University Programming in Omega Part 1 Tim Sheard Portland State University Tim Sheard Computer Science Department Portland State University Portland, Oregon PSU PL Research at Portland State University The Programming

More information

CS 216 Fall 2007 Final Exam Page 1 of 10 Name: ID:

CS 216 Fall 2007 Final Exam Page 1 of 10 Name:  ID: Page 1 of 10 Name: Email ID: You MUST write your name and e-mail ID on EACH page and bubble in your userid at the bottom of EACH page including this page. If you do not do this, you will receive a zero

More information

CMa simple C Abstract Machine

CMa simple C Abstract Machine CMa simple C Abstract Machine CMa architecture An abstract machine has set of instructions which can be executed in an abstract hardware. The abstract hardware may be seen as a collection of certain data

More information

Generation System Advanced Seminar on Compilation and Run-time Systems for Object-Oriented Languages. David Bélanger

Generation System Advanced Seminar on Compilation and Run-time Systems for Object-Oriented Languages. David Bélanger VCODE: A Fast Dynamic Code Generation System 308-763 Advanced Seminar on Compilation and Run-time Systems for Object-Oriented Languages David Bélanger dbelan2@cs.mcgill.ca McGill University Montreal, QC

More information

Memory Management Basics

Memory Management Basics Memory Management Basics 1 Basic Memory Management Concepts Address spaces! Physical address space The address space supported by the hardware Ø Starting at address 0, going to address MAX sys! MAX sys!!

More information

ENEL 353: Digital Circuits Midterm Examination

ENEL 353: Digital Circuits Midterm Examination NAME: SECTION: L01: Norm Bartley, ST 143 L02: Steve Norman, ST 145 When you start the test, please repeat your name and section, and add your U of C ID number at the bottom of the last page. Instructions:

More information

INFOB3TC Solutions for Exam 2

INFOB3TC Solutions for Exam 2 Department of Information and Computing Sciences Utrecht University INFOB3TC Solutions for Exam 2 Sean Leather Monday, 30 January 2012, 17:00 20:00 Please keep in mind that there are often many possible

More information

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it.

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it. MODELING LANGUAGES AND ABSTRACT MODELS Giovanni De Micheli Stanford University Chapter 3 in book, please read it. Outline Hardware modeling issues: Representations and models. Issues in hardware languages.

More information

Nikhil Gupta. FPGA Challenge Takneek 2012

Nikhil Gupta. FPGA Challenge Takneek 2012 Nikhil Gupta FPGA Challenge Takneek 2012 RECAP FPGA Field Programmable Gate Array Matrix of logic gates Can be configured in any way by the user Codes for FPGA are executed in parallel Configured using

More information

Hyperkernel: Push-Button Verification of an OS Kernel

Hyperkernel: Push-Button Verification of an OS Kernel Hyperkernel: Push-Button Verification of an OS Kernel Luke Nelson, Helgi Sigurbjarnarson, Kaiyuan Zhang, Dylan Johnson, James Bornholt, Emina Torlak, and Xi Wang The OS Kernel is a critical component Essential

More information

Exploiting Stack Buffer Overflows Learning how blackhats smash the stack for fun and profit so we can prevent it

Exploiting Stack Buffer Overflows Learning how blackhats smash the stack for fun and profit so we can prevent it Exploiting Stack Buffer Overflows Learning how blackhats smash the stack for fun and profit so we can prevent it 29.11.2012 Secure Software Engineering Andreas Follner 1 Andreas Follner Graduated earlier

More information

C06: Memory Management

C06: Memory Management CISC 7310X C06: Memory Management Hui Chen Department of Computer & Information Science CUNY Brooklyn College 3/8/2018 CUNY Brooklyn College 1 Outline Recap & issues Project 1 feedback Memory management:

More information

OCaml. ML Flow. Complex types: Lists. Complex types: Lists. The PL for the discerning hacker. All elements must have same type.

OCaml. ML Flow. Complex types: Lists. Complex types: Lists. The PL for the discerning hacker. All elements must have same type. OCaml The PL for the discerning hacker. ML Flow Expressions (Syntax) Compile-time Static 1. Enter expression 2. ML infers a type Exec-time Dynamic Types 3. ML crunches expression down to a value 4. Value

More information

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018

Raspberry Pi / ARM Assembly. OrgArch / Fall 2018 Raspberry Pi / ARM Assembly OrgArch / Fall 2018 The Raspberry Pi uses a Broadcom System on a Chip (SoC), which is based on an ARM CPU. https://en.wikipedia.org/wiki/arm_architecture The 64-bit ARM processor

More information

Cyber Security Software Security: Understanding the Platform. Dr Chris Willcocks

Cyber Security Software Security: Understanding the Platform. Dr Chris Willcocks Cyber Security Software Security: Understanding the Platform Dr Chris Willcocks Let's take off our hats for Hilda Computer architectures are mostly simple technologies with clever wiring Software Security

More information

ReLoS. (known as RMRLS in the literature) Reversible Logic Synthesizer. Pallav Gupta James Donald August 27, 2007 Version 0.2

ReLoS. (known as RMRLS in the literature) Reversible Logic Synthesizer. Pallav Gupta James Donald August 27, 2007 Version 0.2 ReLoS (known as RMRLS in the literature) Reversible Logic Synthesizer Pallav Gupta James Donald August 27, 2007 Version 0.2 Abstract ReLoS is an integrated tool for synthesis, simulation, and test of reversible

More information

Modular Synthesis of Sketches using Models

Modular Synthesis of Sketches using Models Modular Synthesis of Sketches using Models Rohit Singh, Rishabh Singh, Zhilei Xu, Rebecca Krosnick, and Armando Solar-Lezama Massachusetts Institute of Technology Abstract. One problem with the constraint-based

More information